Thanks 
I changed it to session.setAttribute and fixed it,
 But now I have another problem even I push the edit link of the second or 
third or any row,
 the "projectname" and "seqno" of the last row is sent to the action.
 What can I do?

 On 8/15/05, Michael Rasmussen <[EMAIL PROTECTED]> wrote: 
> 
> Balkan,
> 
> which line is line 26 in edit action? Can you provide the entire stack 
> trace?
> 
> Off hand I would guess that your call to request.getAttribute("key")
> is returning null...I don't see any other likely suspects.
> 
> Your JSP does this:
> 
> pageContext.setAttribute("key",key); what is pageContext?
> 
> if you are putting a variable in page scope, it will not be available
> for the action when you repost to the server...you have a new page
> scope (which is different from request scope) when you come back to
> the server. If you want a variable to live across multiple trips to
> the server, try putting it in the session.
> 
> On 8/15/05, Balkan Guler <[EMAIL PROTECTED]> wrote:
> > hello,
> > I have a action form operForm and List operMenus field. operMenu is an
> > other class that has some field.
> > I am listing all of the operMenu objects and their fields.
> > At the end of the each row I have an edit link that sends, its row's 
> primary
> > key to an action.
> > operMenu class has two primary key and I instantiate a hashmap and put 
> the
> > primary keys into hashmap.
> > In action class I want to get the hashmap but I am taking null pointer
> > exception.
> > <logic:iterate id="omenu" indexId = "count" name="operForm"
> > property="operMenus">
> > <tr >
> > <td class ='row<%=count.intValue() %2 %>'> <bean:write name="omenu" 
> property
> > =" compositeId.projectname"/></td>
> > <td class ='row<%=count.intValue() %2 %>'> <bean:write name="omenu" 
> property
> > ="compositeId.seqno"/></td>
> > <td class ='row<%= count.intValue() %2 %>'> <bean:write name="omenu"
> > property ="parentseqno"/></td>
> > <td class ='row<%=count.intValue() %2 %>'> <bean:write name="omenu" 
> property
> > ="groupseqno"/></td>
> > <bean:define id="projectName" name="omenu" property="
> compositeId.projectname
> > "/>
> > <bean:define id="seqNo" name="omenu" property="compositeId.seqno "/>
> > <%java.util.HashMap key = new java.util.HashMap();
> > key.put("projectname", projectName);
> > key.put("seqno", seqNo);
> > pageContext.setAttribute("key",key);%>
> > <td class = 'row<%=count.intValue() %2 %>'><html:link action ="edit"
> > paramId="index" paramName="key">Edit</html:link></td>
> > </tr>
> > </logic:iterate>
> > -*************************************************************
> > editAction:::::::::::::::
> > public ActionForward execute(ActionMapping mapping, ActionForm form,
> > HttpServletRequest request, HttpServletResponse response) throws 
> Exception {
> >
> > java.util.HashMap keymap = (java.util.HashMap
> )request.getAttribute("key");
> >
> > String projectname = (String)keymap.get("projectname");
> > String seqno = (String)keymap.get("seqno");
> >
> > System.out.println(projectname);
> > return mapping.findForward(FORWARD_detail);
> > }
> > And the error message:
> > java.lang.NullPointerException
> > at actions.editAction.execute(editAction.java:26)
> > What is the problem??
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
>

Reply via email to