<legend id='2zF8O'><style id='2zF8O'><dir id='2zF8O'><q id='2zF8O'></q></dir></style></legend>
      1. <tfoot id='2zF8O'></tfoot>
          <bdo id='2zF8O'></bdo><ul id='2zF8O'></ul>
      2. <i id='2zF8O'><tr id='2zF8O'><dt id='2zF8O'><q id='2zF8O'><span id='2zF8O'><b id='2zF8O'><form id='2zF8O'><ins id='2zF8O'></ins><ul id='2zF8O'></ul><sub id='2zF8O'></sub></form><legend id='2zF8O'></legend><bdo id='2zF8O'><pre id='2zF8O'><center id='2zF8O'></center></pre></bdo></b><th id='2zF8O'></th></span></q></dt></tr></i><div id='2zF8O'><tfoot id='2zF8O'></tfoot><dl id='2zF8O'><fieldset id='2zF8O'></fieldset></dl></div>

        <small id='2zF8O'></small><noframes id='2zF8O'>

        如何从表单操作中调用客户 URL 操作?

        How to call custome URL action from Form action?(如何从表单操作中调用客户 URL 操作?)

      3. <i id='0WJ6E'><tr id='0WJ6E'><dt id='0WJ6E'><q id='0WJ6E'><span id='0WJ6E'><b id='0WJ6E'><form id='0WJ6E'><ins id='0WJ6E'></ins><ul id='0WJ6E'></ul><sub id='0WJ6E'></sub></form><legend id='0WJ6E'></legend><bdo id='0WJ6E'><pre id='0WJ6E'><center id='0WJ6E'></center></pre></bdo></b><th id='0WJ6E'></th></span></q></dt></tr></i><div id='0WJ6E'><tfoot id='0WJ6E'></tfoot><dl id='0WJ6E'><fieldset id='0WJ6E'></fieldset></dl></div>
        <legend id='0WJ6E'><style id='0WJ6E'><dir id='0WJ6E'><q id='0WJ6E'></q></dir></style></legend>
            <tbody id='0WJ6E'></tbody>

              <small id='0WJ6E'></small><noframes id='0WJ6E'>

              <tfoot id='0WJ6E'></tfoot>

              • <bdo id='0WJ6E'></bdo><ul id='0WJ6E'></ul>

                1. 本文介绍了如何从表单操作中调用客户 URL 操作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我关注了 这篇文章 并创建了一个自定义 URL 应用程序.动作被调用,但 url 显示会话 id 像

                  I followed this post and created a custom URL application. The action is getting called but the url shows with session id like

                  http://localhost:8080/CustomURL%7Busername%7D.action;jsessionid=9C1FB3EB633209C18625BBB40EA61000

                  我只想像 http://localhost:8080/CustomURL/rajesh

                  查看我的struts.xml:

                  <struts>
                  <constant name="struts.mapper.alwaysSelectFullNamespace"
                      value="false" />
                  <constant name="struts.enable.SlashesInActionNames" value="true" />
                  <constant name="struts.patternMatcher" value="namedVariable" />
                  <package name="default" namespace="/" extends="struts-default">
                      <action name="">
                          <result name="success">home.jsp</result>
                      </action>
                  
                      <action name="{username}" class="com.rajesh.struts2.CustomURL"
                          method="customUrl">
                          <result name="success">welcome.jsp</result>
                      </action>
                  
                  </package>
                  

                  查看我的 JSP 页面:

                  <%@ taglib prefix="s" uri="/struts-tags"%>
                  <html>
                  <head>
                  <title>Struts 2 Custom URL</title>
                  </head>
                  <body>
                      <h1>Struts 2 Custom URL</h1>
                      <h3>Enter your name below</h3>
                      <s:form action="{username}">
                          <s:textfield name="username" />
                          <s:submit />
                      </s:form>
                  </body>
                  </html>
                  

                  参见下面的 java 文件:

                  public class CustomURL extends ActionSupport {
                  
                      private String username;
                  
                      public String getUsername() {
                          System.out.println("Getter");
                          return username;
                      }
                  
                      public void setUsername(String username) {
                          System.out.println("Setter");
                          this.username = username;
                      }
                  
                      private static final long serialVersionUID = -4337790298641431230L;
                  
                      public String customUrl() {
                          return SUCCESS;
                      }
                  }
                  

                  推荐答案

                  首先你应该去掉动作扩展,如果你不想让用户认为他们的名字有扩展名.

                  First of all you should get rid of action extension, if you don't want user to think their name has an extension.

                  <constant name="struts.action.extension" value=",,action"/> 
                  

                  接下来的模式匹配器应该是regex.

                  Next the pattern matcher should be regex.

                  <constant name="struts.patternMatcher" value="regex"/>
                  

                  动作映射

                  <action name="/CustomURL/{username}" class="com.rajesh.struts2.CustomURL" method="customUrl">
                      <result name="success">welcome.jsp</result>
                  </action>
                  

                  在JSP 中你不需要使用form 标签,而是使用anchor 标签.并使用已知名称.

                  In the JSP you don't need to use form tag, but anchor tag. And use known names.

                  <a href="http://localhost:8080/CustomURL/rajesh">Click my name</a>
                  

                  这篇关于如何从表单操作中调用客户 URL 操作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  Java Bytecode Manipulation Library Suggestions(Java 字节码操作库建议)
                  Java CLI UI-design: frameworks or libraries?(Java CLI UI 设计:框架还是库?)
                  About the use of Beans.xml configuration file in Spring Framework application(关于Spring Framework应用中Beans.xml配置文件的使用)
                  What is the difference between Spring, Struts, Hibernate, JavaServer Faces, Tapestry?(Spring、Struts、Hibernate、JavaServer Faces、Tapestry 有什么区别?)
                  Are there any android application framework like spring?(有没有像spring这样的android应用程序框架?)
                  Java Swing based game framework. Any advice?(基于 Java Swing 的游戏框架.有什么建议吗?)
                  • <i id='xJAvO'><tr id='xJAvO'><dt id='xJAvO'><q id='xJAvO'><span id='xJAvO'><b id='xJAvO'><form id='xJAvO'><ins id='xJAvO'></ins><ul id='xJAvO'></ul><sub id='xJAvO'></sub></form><legend id='xJAvO'></legend><bdo id='xJAvO'><pre id='xJAvO'><center id='xJAvO'></center></pre></bdo></b><th id='xJAvO'></th></span></q></dt></tr></i><div id='xJAvO'><tfoot id='xJAvO'></tfoot><dl id='xJAvO'><fieldset id='xJAvO'></fieldset></dl></div>
                        • <bdo id='xJAvO'></bdo><ul id='xJAvO'></ul>

                              <tbody id='xJAvO'></tbody>

                          1. <legend id='xJAvO'><style id='xJAvO'><dir id='xJAvO'><q id='xJAvO'></q></dir></style></legend>
                            <tfoot id='xJAvO'></tfoot>

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