struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rauf Khan" <forum.k...@gmail.com>
Subject Passing parameter through <html:link>
Date Fri, 02 Mar 2007 13:02:50 GMT
Hi

  Iam facing problem with <html:link>.

  my JSP page has two forms for which iam using *LookupDispatchAction* for
submitting the page information. Below this iam displaying the details of
the employees for which i have added two links (Edit, Delete) by using
<html:link>. Each employee has a unique id which i need to pass when the
link of edit/delete is clicked so that appropriate edit/delete action is
called. The problem facing is how to pass this empid through this
<html:link>.

   For storing the employee details i have created a employee bean and
storing these objects in a vector and iterating throught the vector to
display the values.


struts-config
-----------------
<action path="/dispatch"   name="DispatchForm"   type="
com.employee.EmployeeDispatchAction"    parameter="method"  scope="request"
unknown="false" input="/dispatchAction.do">
        <forward name="next" path="dispatchActionpage"/>
</action>

*JSP Page*

<html:link action="/dispatch.do"><bean:message key="label.Edit"/>
</html:link>   &nbsp;&nbsp;

<html:link action="/dispatch.do"><bean:message key="label.Delete"/>
</html:link>

*EmployeeDispatchAction*

*protected* Map getKeyMethodMap()

{

      Map map = *new* HashMap();

     map.put("label.Edit", "EditEmployee");

     map.put("label.Delete", "DeleteEmployee");

*    return*(map);

}

*public* ActionForward EditEmployee(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
*throws*IOException, ServletException {

             ********* code here for edit employee w.r.t his id getting
through the parameter passed through the link ********

}

*public* ActionForward DeleteEmployee(ActionMapping mapping, ActionForm
form, HttpServletRequest request, HttpServletResponse response)
*throws*IOException, ServletException {

             ********* code here for delete employee w.r.t his id getting
through the parameter passed through the link ********

}



Thanks in advance.

Regards

Khan

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message