• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

accessing objects in request

 
James Workmen
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
author & internet detective
Marshal
Posts: 34669
366
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
sreenath reddy
Ranch Hand
Posts: 415
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi james
u need to change that parameter to attribute in ur tag
 
James Workmen
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just had to change parameter to name. It worked.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic