LookupDispatchAction with html:link
843838Mar 27 2006 — edited Mar 25 2008I am new to struts and I want to use LDA (LookupDispatchAction) with html link tags.
Following is the code for a similar use with buttons...
struts config
==========
<action path="/login" type="tilesexample.login.actions.LoginAction" name="LoginFormBean" scope="request" validate="true" input="layout.login " parameter="submit">
<forward name="login_success" path="layout.homepage"></forward>
<forward name="login_failure" path="layout.login "></forward>
</action>
jsp
===
<html:submit property="submit">
<bean:message bundle="dispatch-messages" key="submit.login"/> <!--this is mapped in my resource file)
</html:submit>
action
=====
LoginAction extends LookupDispatchAction
{
protected Map getKeyMethodMap()
{
Map map = new HashMap();
map.put("submit.login", "login");
map.put("submit.logout", "logout");
return map;
}
public ActionForward login (...)
{
/*...CODE HERE...*/
}
public ActionForward logout (...)
{
/*...CODE HERE...*/
}
}
It works fine for the button, but I want to call the logout method when the user clicks on "logout" link...
when i write the link as
<html:link action="/logout">
<bean:message bundle="dispatch-messages" key="submit.logout"/>
</html:link>
and click on the link, i get the following error,
[3/27/06 15:33:50:172 IST] 6a789e8f WebGroup E SRVE0026E: [Servlet Error]-[Request[/logout] does not contain handler parameter named submit]: javax.servlet.ServletException: Request[logout] does not contain handler parameter named submit
at org.apache.struts.actions.LookupDispatchAction.execute(LookupDispatchAction.java:199)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:974)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:555)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:200)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:119)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:276)
at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
at com.ibm.ws.webcontainer.cache.invocation.CacheableInvocationContext.invoke(CacheableInvocationContext.java:114)
at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:186)
at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334)
at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:618)
at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:439)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:593)
Please help...