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

    3. <small id='3l1sH'></small><noframes id='3l1sH'>

      <legend id='3l1sH'><style id='3l1sH'><dir id='3l1sH'><q id='3l1sH'></q></dir></style></legend>

        #{} ${} 和 %{} 有什么区别?

        what#39;s the difference between #{} ${} and %{}?(#{} ${} 和 %{} 有什么区别?)
        • <bdo id='8MVmI'></bdo><ul id='8MVmI'></ul>
            <i id='8MVmI'><tr id='8MVmI'><dt id='8MVmI'><q id='8MVmI'><span id='8MVmI'><b id='8MVmI'><form id='8MVmI'><ins id='8MVmI'></ins><ul id='8MVmI'></ul><sub id='8MVmI'></sub></form><legend id='8MVmI'></legend><bdo id='8MVmI'><pre id='8MVmI'><center id='8MVmI'></center></pre></bdo></b><th id='8MVmI'></th></span></q></dt></tr></i><div id='8MVmI'><tfoot id='8MVmI'></tfoot><dl id='8MVmI'><fieldset id='8MVmI'></fieldset></dl></div>

              <small id='8MVmI'></small><noframes id='8MVmI'>

              <legend id='8MVmI'><style id='8MVmI'><dir id='8MVmI'><q id='8MVmI'></q></dir></style></legend>
              <tfoot id='8MVmI'></tfoot>

                <tbody id='8MVmI'></tbody>

                  本文介绍了#{} ${} 和 %{} 有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我目前正在使用 struts2,我只是不明白 ${var}#{var} 之间有什么区别>%{var} 它们的作用域不同吗?他们是什么?

                  I'm currently working with struts2, and I just don't understand what the difference is between ${var}, #{var}, and %{var} are they different scopes? what are they?

                  我找到了一个#:

                  <s:select label="Year"
                        id="%{param.name}"
                        list="#{'2010':'2010','2011':'2011','2012':'2012','2013':'2013','2014':'2014', '2015':'2015'}"
                        value="%{currentYear}"
                        required="true"
                  />
                  

                  这里看起来像是一个关联数组,但在其他时候我看到它是 #var (不带括号)有什么想法吗?

                  here it looks like it's an associative array, but there's other times I've seen it as #var (without the brackets) any ideas?

                  推荐答案

                  • ${} - 标准 JSP EL 表示法.
                  • #{} - 标准 UEL 表示法;没用过,可以用.
                  • %{} - OGNL 表达式表示法.
                    • ${} - Standard JSP EL notation.
                    • #{} - Standard UEL notation; never used it, may work.
                    • %{} - OGNL expression notation.
                    • JSP EL 表示法之所以有效,是因为有一个请求包装器,它将首先遵循值堆栈进行查找,然后如果在值堆栈上找不到值,则回退到正常的 JSP 评估.

                      JSP EL notation works because there's a request wrapper that will defer to the value stack for lookups first, then fall back to the normal JSP evaluation if there's no value found on the value stack.

                      OGNL 表达式符号仅在 S2 标记内有效.每当您评估 OGNL 表达式时,IMO 都应该使用它,尽管它通常是可选的.它是可选的,然而,这有点废话.通常是,但并非总是如此.最好使用它并明确和交流.

                      OGNL expression notation is valid only within S2 tags. IMO it should be used whenever you are evaluating an OGNL expression, although it is quite often optional. When it is optional is somewhat of a crap shoot, however. It often is, buuuut not always. Best to use it and be explicit and communicative.

                      可能询问 # 变量,例如 #session 等.# 用于解析映射"部分中的值堆栈上的值.我将值堆栈视为堆栈和范围的组合:如果已将对象推送到堆栈上,则不需要 #.如果一个值已经创建,你需要#.

                      You may be asking about # variables, like #session etc. # is used to resolve a value on the value stack that's in the "map" portion. I view the value stack as a combination stack and scope: if an object has been pushed on the stack, you don't need the #. If a value has been created, you need the #.

                      例如,如果您使用 <s:set> 创建变量,则必须使用 # 前缀访问它,例如:

                      For example, if you use <s:set> to create a variable, you must access it using a # prefix, like:

                      <s:set var="foo" value="'plugh'"/>
                      <s:property value="#foo"/>
                      

                      这篇关于#{} ${} 和 %{} 有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  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 的游戏框架.有什么建议吗?)

                  <tfoot id='vdQ0k'></tfoot>
                    <bdo id='vdQ0k'></bdo><ul id='vdQ0k'></ul>
                  • <legend id='vdQ0k'><style id='vdQ0k'><dir id='vdQ0k'><q id='vdQ0k'></q></dir></style></legend>
                      <tbody id='vdQ0k'></tbody>

                    1. <small id='vdQ0k'></small><noframes id='vdQ0k'>

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