posted 16 years ago
Hi.
I spend whole night working on a piece of code.
It suppose to Iterate through a bean. The Bean is ArrayList and name in the request scope is eventsList.It holds objects of EventBean.
The Iteration works fine. But the problems start when I'm trying to pass a parameter "eventId", to the DispatchAction by the html:link.
I don't receive the parameter (null).
Here is the piece of .jsp code:
.
.
.
<logic:iterate id="event" name="eventsList" indexId="cnt">
<tr>
<!-- link to the event detail -->
<!-- Event time/date -->
<td><bean:write name="event" property="eventStart" /></td>
<!-- Event name -->
<td><bean:write name="event" property="gameName" /></td>
<!-- link to join the event -->
<th><html:link href="EventDetails.do?command=details"
paramId="Id" paramName="event" paramProperty="eventId">details</html:link></th>
</tr>
</logic:iterate>
.
.
.
Here is mapping for this action
<action path="/EventDetails"
type="uk.ac.aber.rmm03.gamescalendar.controller.EventDisplayDispatchAction"
scope="request"
validate="false"
parameter="command">
<forward name="displayEvent" path="/WEB-INF/secured/displayevent.jsp" />
</action>
And piece of code from the EventDisplayDispatchAction
.
.
.
public class EventDisplayDispatchAction extends DispatchAction {
public ActionForward details(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException {
int gameId = 0;
System.out.println("AAA" + request.getParameter("Id"));
gameId = Integer.parseInt(request.getParameter("Id"));
.
.
.
It fails on "System.out.println("AAA" + request.getParameter("Id"));"
And gives me:
"java.lang.NumberFormatException: null
java.lang.Integer.parseInt(Unknown Source)
java.lang.Integer.parseInt(Unknown Source)
uk.ac.aber.rmm03.gamescalendar.controller.EventDisplayDispatchAction.details(EventDisplayDispatchAction.java:32)
.
.
."
I would much appreciate some help.
Cheers