File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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 REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "accessing objects in request" Watch "accessing objects in request" New topic

accessing objects in request

James Workmen

Joined: Oct 06, 2004
Posts: 26
In Action class, I am setting
Boolean editproj = new Boolean(true);

in my JSP, when I compile this,

(1) <logic resent parameter="IS_EDIT_PROJECT">
</logic resent>
(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()%>
<% if(checkProject.booleanValue()) { %>
Booelan value is true.
else { %>
Boolean value is false
<% } %>

The answer I get is
Booelan value is true.

Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 32818

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.

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, 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

Joined: Oct 06, 2004
Posts: 26
I just had to change parameter to name. It worked.
I agree. Here's the link:
subject: accessing objects in request
It's not a secret anymore!