• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

accessing objects in request

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!!
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 415
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I just had to change parameter to name. It worked.
 
reply
    Bookmark Topic Watch Topic
  • New Topic