Author
accessing objects in request
James Workmen
Greenhorn
Joined: Oct 06, 2004
Posts: 26
posted Nov 26, 2004 13:01:00
0
In Action class, I am setting Boolean editproj = new Boolean(true); request.setAttribute("IS_EDIT_PROJECT",editproj); in my JSP , when I compile this, (1) <logic resent parameter="IS_EDIT_PROJECT"> IS_EDIT_PROJECT is found. </logic resent> <br> (2) <bean arameter id="isNew" name="IS_EDIT_PROJECT" value="IS_EDIT_PROJECT not found"/> <input type="text" name="returnto" value="<%=isNew%>"> The answer I get (1) Nothis. So that mean, it is not present (2) IS_EDIT_PROJECT not found But, when I try <% Boolean checkProject = (Boolean)request.getAttribute("IS_EDIT_PROJECT"); boolean isNewProject = checkProject.booleanValue(); %> isNewProject = <%= checkProject.toString()%> <br> <% if(checkProject.booleanValue()) { %> Booelan value is true. <%} else { %> Boolean value is false <% } %> The answer I get is Booelan value is true. Help!!
Jeanne Boyarsky
internet detective
Marshal
Joined: May 26, 2003
Posts: 26144
James, Parameters and attributes are different. Parameters are passed from the previous page (like when a user submits a form.) Attributes can be set at any time and are distinguished by the get/setAttribute() call.
[Blog ] [JavaRanch FAQ ] [How To Ask Questions The Smart Way ] [Book Promos ]
Blogging on Certs: SCEA Part 1 , Part 2 & 3 , Core Spring 3 , OCAJP , OCPJP beta , TOGAF part 1 and part 2
sreenath reddy
Ranch Hand
Joined: Sep 21, 2003
Posts: 415
Hi james u need to change that parameter to attribute in ur tag
James Workmen
Greenhorn
Joined: Oct 06, 2004
Posts: 26
posted Nov 29, 2004 09:26:00
0
I just had to change parameter to name. It worked.
subject: accessing objects in request