aspose file tools*
The moose likes Struts and the fly likes accessing objects in request Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "accessing objects in request" Watch "accessing objects in request" New topic
Author

accessing objects in request

James Workmen
Greenhorn

Joined: Oct 06, 2004
Posts: 26
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

Joined: May 26, 2003
Posts: 30758
    
156

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
I just had to change parameter to name. It worked.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: accessing objects in request