You might try adding the userId property to the ActionForm, and seeing if that approach works better for you.
-- Ted Husted, Husted dot Com, Fairport NY USA. -- Java Web Development with Struts. -- Tel +1 585 737-3463. -- Web http://www.husted.com/struts/ "Jakkampudi, ChandraseKhar" wrote: > > The form is initially populated from a value object like > > <html:text property="userName" value="<%=userInfo.getUserName()%>"/> > and > <html:hidden property="userID" value="<%=userInfo.getUserID()%>"/> > > userInfo is not my ActionForm bean, rather it is a value object that is > created as part of the previous request (via a database call) that specifies > which userId is to be modified. This is also in request scope. > > On coming back to the input page when validation fails etc. the user name is > retained (magic of struts action form bean) but not the user Id which is why > I used the request.setAttribute in the first place. > > Is this not the right way to do things? Any help is appreciated. > > -JC > > -----Original Message----- > From: Ted Husted [mailto:[EMAIL PROTECTED]] > Sent: Thursday, February 14, 2002 4:03 PM > To: Struts Users Mailing List > Subject: Re: Request: Property vs Attribute > > As long as it is on the ActionForm bean, you can have the action put the > UserID there. > > While the request attributes are there, and there's nothing to prevent > you from using them, everything really does work a lot better if you > forget about the parameters, and use the ActionForm bean instead. > > -- Ted Husted, Husted dot Com, Fairport NY USA. > -- Java Web Development with Struts. > -- Tel +1 585 737-3463. > -- Web http://www.husted.com/struts/ > > "Jakkampudi, ChandraseKhar" wrote: > > > > UserID is a member of my action form sub class. I do not have a reset > method > > defined and I do not use the html:reset. > > I do use html:hidden tag as you suggested but for scalability and other > > reasons I do not use a session scoped form but use request scope. > > > > -JC > > > > -----Original Message----- > > From: Pedone, Tim [mailto:[EMAIL PROTECTED]] > > Sent: Thursday, February 14, 2002 3:44 PM > > To: 'Struts Users Mailing List' > > Subject: RE: Request: Property vs Attribute > > > > Is userID a member of your ActionForm subclass? If you make it a member of > > your ActionForm, it will get maintained (provided you don't wipe it out in > > your reset() method) for you if you have a <html:hidden > property="userID"/> > > tag in your jsp. I tried this using a session scoped form and it worked. > > > > Tim > > > > -----Original Message----- > > From: Jakkampudi, ChandraseKhar [mailto:[EMAIL PROTECTED]] > > Sent: Thursday, February 14, 2002 12:29 PM > > To: 'Struts Users Mailing List' > > Subject: Request: Property vs Attribute > > > > I have a jsp that displays details of a user. The display is in a form > that > > can also be used to modify user details. Access to this page is via a url > > like http://xyz.com/userDetails.do?userID=123. However the userid is not a > > editable field and I use a hidden variable to pass this information back > to > > the server fo updates. On validation, if I return to the input page, the > > hidden variable is lost. So I use request.setAttribute("userID", "123") in > > the perform method of the action before redirecting to set the information > > back. > > > > However because of this I have to have this conditional at the top of my > jsp > > > > String userID = request.getParameter("userID"); > > if (userID == null){ > > userID = (String) request.getAttribute("userID"); > > } > > > > This is because the logic:present tag just uses the getParameter command > and > > returns false even if the required string is an attribute of the request. > > I know I can change the source, but it would be difficult to maintain as I > > have to remember this fact everytime we do an upgrade. > > > > Any suggestions on how to implement this better without using scriptlets. > > > > -JC > > > > -- > > To unsubscribe, e-mail: > > <mailto:[EMAIL PROTECTED]> > > For additional commands, e-mail: > > <mailto:[EMAIL PROTECTED]> > > > > -- > > To unsubscribe, e-mail: > > <mailto:[EMAIL PROTECTED]> > > For additional commands, e-mail: > > <mailto:[EMAIL PROTECTED]> > > > > -- > > To unsubscribe, e-mail: > <mailto:[EMAIL PROTECTED]> > > For additional commands, e-mail: > <mailto:[EMAIL PROTECTED]> > > -- > To unsubscribe, e-mail: > <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: > <mailto:[EMAIL PROTECTED]> > > -- > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>