Hello:
I'm developing a web application using Struts 1.1 and Tiles. I have a tile for
searchs consisting in a JSP with the following code:
.....
<html:form action="/search">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td colspan="3">Buscar Noticias</td>
</tr>
<tr>
<td valign="top">
<html:text property="searchText"/>
</td>
<td valign="middle" width="40">
<html:submit property="searchType">
<bean:message key="search.go"/>
</html:submit>
</td>
</tr>
<tr>
<td colspan="3">
<html:submit property="searchType">
<bean:message key="search.adv"/>
</html:submit>
</td>
</tr>
</table></td>
</html:form>
.......
I have an ActionForm asociated to it with the definition of searchText property
and the get, set and reset methods. Also, there is a LookupDispatchAction
defining the mappings according with the selected button. Here is the class:
public class SearchAction extends LookupDispatchAction {
public ActionForward op_search(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) {
return mapping.findForward("showSearch");
}
public ActionForward op_advSearch(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) {
return mapping.findForward("showAdvSearch");
}
protected Map getKeyMethodMap() {
Map<String, String> map = new HashMap <String, String> ();
map.put("", "op_search");
map.put("search.go", "op_search");
map.put("search.adv", "op_advSearch");
return (map);
}
}
The line map.put("", "op_search"); is for the case I press Enter in the input
area instead of pressing one of the defined buttons (I'm not sure if it work
this way, maybe I don't need it).
When I execute my application in Mozila Firefox, pressing Enter in the input
area, it works fine and forwards to showSearch correctly. But when execute it
in Internet Explorer, I get the following exception:
SEVERE: Servlet.service() for servlet action threw exception
javax.servlet.ServletException: Request[/search] does not contain handler
parameter named searchType
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.doPost(ActionServlet.java:525)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
at
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:667)
at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:595)
What's the problem here? It's mine or it's an Internet Explorer bug with Struts
1.1? Is there another way of doing what I want (calling the correct forward
when I press Enter in the input area), something like a default value for my
property or another method (searchText)?
I need some help as soon as you can, please.
Thanks in advance.