anonymous10
Programmer
I am setting an attribute in my JSP and access the attribute in my action class. I end up getting a null pointer exception.
In my JSP I do
<%
request.setAttribute("messageList", aMsgList);
System.out.println("Before for loop. Size =" +aMsgList.size());
<li> <A href="inboxMsg.do?Id=<%=i%>"><%=aTaskId%><%=aTaskMsg%></A></li>
%>
My struts config is as follows
<action
path="/inboxMsg"
type="com.abcd.def.actions.InboxAction">
<forward name="success" path="/WEB-INF/jsp/inboxmessage.jsp"/>
<forward name="failure" path="/WEB-INF/jsp/failure.jsp"/>
</action>
In my action class I try to read my arraylist as follows
ArrayList MsgList = (ArrayList) request.getAttribute("messageList");
int anIndex=Integer.parseInt(request.getParameter("Id"));
System.out.println("Size of Message List=" + MsgList.size());
When the last line is executed I get a null pointer exception.
I would be grateful for any suggestions.
In my JSP I do
<%
request.setAttribute("messageList", aMsgList);
System.out.println("Before for loop. Size =" +aMsgList.size());
<li> <A href="inboxMsg.do?Id=<%=i%>"><%=aTaskId%><%=aTaskMsg%></A></li>
%>
My struts config is as follows
<action
path="/inboxMsg"
type="com.abcd.def.actions.InboxAction">
<forward name="success" path="/WEB-INF/jsp/inboxmessage.jsp"/>
<forward name="failure" path="/WEB-INF/jsp/failure.jsp"/>
</action>
In my action class I try to read my arraylist as follows
ArrayList MsgList = (ArrayList) request.getAttribute("messageList");
int anIndex=Integer.parseInt(request.getParameter("Id"));
System.out.println("Size of Message List=" + MsgList.size());
When the last line is executed I get a null pointer exception.
I would be grateful for any suggestions.