• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Action: Unable to retrieve values from request

 
clyles
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 96
Scala Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try

 
clyles
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic