Victor, Victor, Victor... you have to use the form passed int the action.
So you have to do
NameZoomFrm frm = (NameZoomFrm)form;
Then set the values. You don't do the session.setAttribute.
-----Original Message-----
From: Vic Cekvenich [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, September 25, 2001 4:13 PM
To: [EMAIL PROTECTED]
Subject: initial values to edit .... and then view save
I am trying to in my action, retreive data from a DB, and then send it
to the page for editing. (The page would then send it back to same
action to be saved to DB. Also, I would try to use same page and action
for insterts and validtaion later).
Only.... I can't get it to work. (looked in mail archives and Struts-simple)
What am I doing wrong? It will not even display the vales.... or if it
does, I can't see the edited values.
TIA,
Vic
Page:
<body>
Here is a name edit...<p>
<html:form action="/nameZoomAct">
<bean:message key="name.First"/>:
<html:text property="fstName"/> <p>
<bean:message key="name.Last"/> :
<html:text property="lstName"/>
<html:submit property="submit" value="Submit"/>
</html:form>
</body>
Config:
<action path= "/nameZoomAct"
type= "app.NameZoomAct"
name = "NameZoomFrm"
scope="request"
input="/WEB-INF/pages/NameZoomPg.jsp">
<forward name="nameZoomPg"
path="/WEB-INF/pages/NameZoomPg.jsp"/>
</action>
action...
{
HttpSession session = request.getSession();
NameZoomFrm frm = null;
NameZoomFrm frm2 = null;
String PK = request.getParameter("PK");
if (PK != null) { // do we have an argument PK passed?
frm = new NameZoomFrm();
BigDecimal pkBD = new BigDecimal (PK);
frm.dbCon();
frm.retreive(pkBD);
frm.dbDisCon();
debug(this,"DB fst nam is "+pkBD + frm.getFstName());
session.setAttribute("NameZoomFrm", frm);
form = frm;
} else { // we are editing then!
frm = (NameZoomFrm)form;
frm2 = (NameZoomFrm) session.getAttribute("NameZoomFrm");
debug(this,"form Edited fst nam is " + frm.getFstName());
debug(this,"ses E fst nam is " + frm2.getFstName());
}
return(mapping.findForward("nameZoomPg"));