You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Jakkampudi, ChandraseKhar" <CJ...@aivia.net> on 2002/02/14 21:29:11 UTC
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: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>