Struts 1个带参数的转发路径

Struts 1 forwards path with parameters

我正在尝试在 struts 1(工作应用)中执行操作。我目前正在从一个旧框架翻译成 struts 1(一半的应用程序在这个框架中,另一个在 struts 1 中),但我找不到正确的方法来进行这种翻译。我的想法是不要触及代码,仅通过 "conf-files" 实现,在本例中为 "struts-config.xml"

我有以下案例需要翻译,说:

Action class: com.MyApp.TestClass 
Action name: Consulta parameter: dispath 
Forward 1: /login.do 
Forward 2: /signup.do?dispath=register 
Forward 3: /signup.do?dispath=register&addReferal=true

对于这个案例和注册案例:

<action path="/signup" type="com.MyApp.Signup"
            name="SignupForm" scope="request" validate="false"
             parameter="dispatch" />

在forward 1我没问题,没有一个参数。 在forward 2我没问题,有1个参数,dispatch(在action /singup中声明) 在 forward 3 我有问题,有 2 个参数,dispath 和其他我需要的。

仅当我使用 conf-file 时才会出现问题,如果我使用 java,直接设置路径,如

ActionForward a = new ActionForward();
a.setPath("/signup.do?dispath=register&addReferal=true");
action.addForward(a);

这没有错误,就像我想要的那样,但是使用 conf-file 会抛出:

15:38:56,742 ERROR [Digester] Parse Fatal Error at line 1067 column 94: La referencia a la entidad "addReferal" debe terminar con el delimitador ';'.
org.xml.sax.SAXParseException: La referencia a la entidad "addReferal" debe terminar con el delimitador ';'.
        at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
        at org.apache.xerces.util.ErrorHandlerWrapper.fatalError(Unknown Source)
        at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
        at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
        at org.apache.xerces.impl.XMLScanner.reportFatalError(Unknown Source)
        at org.apache.xerces.impl.XMLScanner.scanAttributeValue(Unknown Source)
        at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanAttribute(Unknown Source)
        at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
        at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
        at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
        at org.apache.commons.digester.Digester.parse(Digester.java:1572)
        at org.apache.struts.action.ActionServlet.parseModuleConfigFile(ActionServlet.java:1006)
        at org.apache.struts.action.ActionServlet.initModuleConfig(ActionServlet.java:955)
        at org.apache.struts.action.ActionServlet.init(ActionServlet.java:470)
        at javax.servlet.GenericServlet.init(GenericServlet.java:212)
        at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1161)
        at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:981)
        at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4069)
        at org.apache.catalina.core.StandardContext.start(StandardContext.java:4362)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:752)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:732)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:553)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
        at java.lang.reflect.Method.invoke(Method.java:599)
        at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:297)
        at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164)
        at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
        at org.apache.catalina.core.StandardContext.init(StandardContext.java:5263)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
        at java.lang.reflect.Method.invoke(Method.java:599)
        at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:297)
        at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164)
        at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
        at org.jboss.web.tomcat.service.TomcatDeployer.performDeployInternal(TomcatDeployer.java:295)
        at org.jboss.web.tomcat.service.TomcatDeployer.performDeploy(TomcatDeployer.java:108)
        at org.jboss.web.AbstractWebDeployer.start(AbstractWebDeployer.java:375)
        at org.jboss.web.WebModule.startModule(WebModule.java:83)
        at org.jboss.web.WebModule.startService(WebModule.java:61)

还有更多。

抱歉我的英语不好,谢谢你的想法!

PD:这是一个完全代表问题的例子。

& 替换为 ; in:

a.setPath("/signup.do?dispath=register**&**addReferal=true");