wood burning stoves 2.0*
The moose likes Struts and the fly likes Action: Unable to retrieve values from request Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Action: Unable to retrieve values from request" Watch "Action: Unable to retrieve values from request" New topic
Author

Action: Unable to retrieve values from request

clyles
Greenhorn

Joined: Apr 30, 2002
Posts: 7
I'm having a problem viewing the values placed in the request within an Action class. I tried to simplify the process by removing only what is needed to get my example to work. Here are the details:

There is the action:
<action path="/Reports/jellyReports"
type="com.voyageru.home.actions.JellyReportAction"
validate="false"
parameter="campusreport"
scope="request">
<forward name="campus_report"
path="/Reports/CampusReport.jsp"/>
</action>

Code:

public ActionForward campusreport(ActionMapping mapping, ActionForm form,HttpServletRequest request, HttpServletResponse response)throws Exception {

request.setAttribute("trackId", "564");
request.setAttribute("campusId", "76");
return mapping.findForward("campus_report");
}

JSP:
<body>
Track Id ==> <%= request.getParameter("trackId")%>
<br>
Campus Id ==> <%= request.getParameter("campusId")%>
</body>

Result:
Track Id ==> null
Campus Id ==> null


Any ideas?
Jason Moors
Ranch Hand

Joined: Dec 04, 2001
Posts: 188
Shouldn't your action be called JellyReportAction? not campusreport?

In Struts it is common practice to use a FormBean to pass information between the action and the JSP page.

Jason.
[ March 13, 2006: Message edited by: Jason Moors ]
Samuel Cox
Ranch Hand

Joined: Nov 16, 2004
Posts: 96

Try

clyles
Greenhorn

Joined: Apr 30, 2002
Posts: 7
Turns out the problem was due to not using: request.getAttribute(). I knew the problem was simple...I just didn't see it....thanks for the help.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Action: Unable to retrieve values from request
 
Similar Threads
JSP form to javabean
Please solve the problem.
Html Input to oracle through servlet and JSP output
getParameter gives null value
what does .do file extension indicate