<tfoot id='I8ZZs'></tfoot>

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

      <bdo id='I8ZZs'></bdo><ul id='I8ZZs'></ul>

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

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

      Struts 2中静态包含页面的参数传递

      时间:2023-10-14

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

            <bdo id='oakfQ'></bdo><ul id='oakfQ'></ul>
          • <small id='oakfQ'></small><noframes id='oakfQ'>

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

              • 本文介绍了Struts 2中静态包含页面的参数传递的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我有一个静态包含我的 JSP 的父文件.

                I have a parent file where my JSP is statically included.

                <%@include file="test.jsp" %>
                

                在包含的文件中,我想使用 Struts2 标记访问父 JSP 的变量.

                In the included file I want to access the variable of parent JSP using Struts2 tag.

                请让我知道是否有可能或者我应该去 dynamic 包含.

                Please let me know if it is possible or should I go for dynamic include.

                推荐答案

                您不能访问变量,但可以使用 OGNL 从值堆栈中访问变量.请参阅 OGNL 基础知识 了解更多关于 Struts 中的变量以及如何使用的信息他们.

                You can't access the variable but you can access the variable from the the value stack using OGNL. See OGNL Basics to learn more about variables in Struts and how to use them.

                除了上面给出的示例和描述之外,自 WebWork 1.x 以来,EL 中还有一些重大变化.最大的一个是不再使用正斜杠 / 而是使用点 . 访问属性.此外,我们现在使用 [n] 代替使用 .. 向下遍历堆栈,其中 n 是某个正数.最后,在 WebWork 1.x 中,可以使用 @foo 访问特殊的命名对象(确切地说是请求范围属性),但现在使用 #foo 访问特殊变量.但是,需要注意的是,#foo 确实 访问请求属性.因为 XWork 不是只为 web 构建的,所以没有请求属性"的概念,因此 #foo 只是对 OgnlContext other 中另一个对象的请求比根.

                Besides the examples and descriptions given above, there are a few major changes in the EL since WebWork 1.x. The biggest one is that properties are no longer accessed with a forward slash / but with a dot .. Also, rather than using .. to traverse down the stack, we now use [n] where n is some positive number. Lastly, in WebWork 1.x one could access special named objects (the request scope attributes to be exact) by using @foo, but now special variables are accessed using #foo. However, it is important to note that #foo does not access the request attributes. Because XWork is not built only for the web, there is no concept of "request attributes", and thus #foo is merely a request to another object in the OgnlContext other than the root.

                要动态包含 JSP 内容,请使用 s:include 标签

                To include JSP content dynamically use s:include tag

                包括 servlet 的输出(servlet 或 JSP 页面的结果).

                Include a servlet's output (result of servlet or a JSP page).

                注意:提供给包含页面的任何附加 params 都无法通过 <s:property...> 标签在呈现的页面中访问,因为没有 valuestack将被创建.但是,您可以通过 HttpServletRequest 对象在 servlet 中访问它们,或者通过 scriptlet 从 JSP 页面访问它们.

                Note: Any additional params supplied to the included page are not accessible within the rendered page through the <s:property...> tag since no valuestack will be created. You can, however, access them in a servlet via the HttpServletRequest object or from a JSP page via a scriptlet.

                如何访问参数

                参数作为请求参数传递,因此使用 ${param.ParamName} 表示法来访问它们.不要使用属性标签访问包含文件中的参数.

                Parameters are passed as request parameters, so use the ${param.ParamName} notation to access them. Do not use the property tag to access parameters in included files.

                <s:include value="test.jsp"/>
                

                这篇关于Struts 2中静态包含页面的参数传递的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:FopFactory.newInstance() 时出现 Fop 异常 下一篇:Struts2 Fileupload 在动作类中给出空文件

                相关文章

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

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

                  <tfoot id='MLOwe'></tfoot>

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