<small id='Hvbil'></small><noframes id='Hvbil'>

  • <tfoot id='Hvbil'></tfoot>
    <legend id='Hvbil'><style id='Hvbil'><dir id='Hvbil'><q id='Hvbil'></q></dir></style></legend>

        • <bdo id='Hvbil'></bdo><ul id='Hvbil'></ul>
        <i id='Hvbil'><tr id='Hvbil'><dt id='Hvbil'><q id='Hvbil'><span id='Hvbil'><b id='Hvbil'><form id='Hvbil'><ins id='Hvbil'></ins><ul id='Hvbil'></ul><sub id='Hvbil'></sub></form><legend id='Hvbil'></legend><bdo id='Hvbil'><pre id='Hvbil'><center id='Hvbil'></center></pre></bdo></b><th id='Hvbil'></th></span></q></dt></tr></i><div id='Hvbil'><tfoot id='Hvbil'></tfoot><dl id='Hvbil'><fieldset id='Hvbil'></fieldset></dl></div>

      1. 在 Struts 2 中在没有查询字符串的情况下在 URL 中传递参数

        Passing parameters in URL without query string in Struts 2(在 Struts 2 中在没有查询字符串的情况下在 URL 中传递参数)
        <legend id='Akwxw'><style id='Akwxw'><dir id='Akwxw'><q id='Akwxw'></q></dir></style></legend>
        • <bdo id='Akwxw'></bdo><ul id='Akwxw'></ul>
        • <small id='Akwxw'></small><noframes id='Akwxw'>

          <tfoot id='Akwxw'></tfoot>

            <tbody id='Akwxw'></tbody>

                <i id='Akwxw'><tr id='Akwxw'><dt id='Akwxw'><q id='Akwxw'><span id='Akwxw'><b id='Akwxw'><form id='Akwxw'><ins id='Akwxw'></ins><ul id='Akwxw'></ul><sub id='Akwxw'></sub></form><legend id='Akwxw'></legend><bdo id='Akwxw'><pre id='Akwxw'><center id='Akwxw'></center></pre></bdo></b><th id='Akwxw'></th></span></q></dt></tr></i><div id='Akwxw'><tfoot id='Akwxw'></tfoot><dl id='Akwxw'><fieldset id='Akwxw'></fieldset></dl></div>
                  本文介绍了在 Struts 2 中在没有查询字符串的情况下在 URL 中传递参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我想使用类似的网址

                  host/ActionName/123/abc/

                  而不是像传递查询字符串

                  instead of passing query string like

                  host/ActionName?parm1=123&parm2=abc

                  如何在 Struts 2 中做到这一点?

                  How can I do that in Struts 2?

                  我做了如下,但它不起作用,显示 500 错误代码

                  I done as below but it is not working, showing 500 error code

                  <constant name="struts.enable.SlashesInActionNames" value="true"/>
                  <constant name="struts.mapper.alwaysSelectFullNamespace" value="false"/>
                  
                  <package name="default" extends="struts-default" namespace="/">
                          <action name="/action/*"
                      class="gov.apiic.serviceRequest.action.ServiceRequest" method="method" >
                      <param name="p1">{1}</param>
                      <result name="success">views.jsp</result>
                      </action>
                  </package>
                  

                  推荐答案

                  在 2.1+ 下使用普通的 Struts2 是不可能的.作为一种解决方法,您可以使用 UrlRewriter 过滤器来做到这一点.从 Struts2 2.1+ 在通配符的帮助下,您可以使用类似 host/ActionNmae/param1-123/param2-abc 的内容,请参阅 this 帖子,但不像 host/ActionNmae/123/abc/.不同之处在于,在第二种情况下,没有参数名称.解决方法是使用 参数后动作名称.

                  It was not possible with plain Struts2 under the 2.1+. As a workaround you can do this with UrlRewriter filter. From Struts2 2.1+ with the help of wildcards you can use something like host/ActionNmae/param1-123/param2-abc see this post, but not like host/ActionNmae/123/abc/. The difference is that in the second case there's no parameter names. The workaround is to use Parameters after the action name.

                  @Action(value = "/ActionNmae/*/*", params = {"param1", "{1}", "param2", "{2}"}  
                  

                  这篇关于在 Struts 2 中在没有查询字符串的情况下在 URL 中传递参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  How to send data to COM PORT using JAVA?(如何使用 JAVA 向 COM PORT 发送数据?)
                  How to make a report page direction to change to quot;rtlquot;?(如何使报表页面方向更改为“rtl?)
                  Use cyrillic .properties file in eclipse project(在 Eclipse 项目中使用西里尔文 .properties 文件)
                  Is there any way to detect an RTL language in Java?(有没有办法在 Java 中检测 RTL 语言?)
                  How to load resource bundle messages from DB in Java?(如何在 Java 中从 DB 加载资源包消息?)
                  How do I change the default locale settings in Java to make them consistent?(如何更改 Java 中的默认语言环境设置以使其保持一致?)

                        <tbody id='fEDlT'></tbody>
                      • <small id='fEDlT'></small><noframes id='fEDlT'>

                        <legend id='fEDlT'><style id='fEDlT'><dir id='fEDlT'><q id='fEDlT'></q></dir></style></legend>

                        <tfoot id='fEDlT'></tfoot>

                          • <bdo id='fEDlT'></bdo><ul id='fEDlT'></ul>
                            <i id='fEDlT'><tr id='fEDlT'><dt id='fEDlT'><q id='fEDlT'><span id='fEDlT'><b id='fEDlT'><form id='fEDlT'><ins id='fEDlT'></ins><ul id='fEDlT'></ul><sub id='fEDlT'></sub></form><legend id='fEDlT'></legend><bdo id='fEDlT'><pre id='fEDlT'><center id='fEDlT'></center></pre></bdo></b><th id='fEDlT'></th></span></q></dt></tr></i><div id='fEDlT'><tfoot id='fEDlT'></tfoot><dl id='fEDlT'><fieldset id='fEDlT'></fieldset></dl></div>