A Strange problem with struts
843836Apr 16 2005 — edited Jan 11 2007I define a CartAction class which extends a DispatchAction as follows:
public class CartAction extends DispatchAction
I define a method in CartAction :
public ActionForward addWare(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
in the file struts-config.xml,the raletive configuration is as follows:
<action
input="/order/cart.jsp"
parameter="action"
path="/cart"
scope="request"
type="org.apache.struts.actions.DispatchAction">
<forward name="success" path="/order/cart.jsp" redirect="true"/>
If I type in http://localhost:8080/eBuy/cart.do?
The error message turned out to be :
javax.servlet.ServletException: Request[cart] does not contain handler parameter named 'do'. This may be caused by whitespace in the label text.
If I type in http://localhost:8080/eBuy/cart.do?action=addWare
The error message is:
java.lang.IllegalArgumentException: Path http://localhost:8080/eBuy/cart.do does not start with a "/" character
org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1047)
org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:259)
org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:386)
org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig(TilesRequestProcessor.java:314)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:229)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1192)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:412)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
Thanks.