When you use struts 2 tags, if you use the code:
<S: Set Name = "name" value = "<% =" '"+ request. getparameter (" name ") +"' "%>"/>
Or
<S: Set Name = "name" value = "$ {Param. name}"/>
The following errors will occur:
According to TLD or attribute directive in Tag file, attribute value does not accept any expressions
However, you must use:
<S: Set Name = "name" value = "# parameters. name [0]"/>
Yes
This may be because you have used the <% .. %> code or JSP El expression.Struts 2 does not support mixed use of struts tag and JSP El expression since version 2.0.11 (it is still possible not to use el in struts tag ), and only support ognl (about ognl introduction of the Chinese connection: http://www.blogjava.net/max/archive/2007/04/28/114417.html ).
Reason see: http://struts.apache.org/2.0.11/docs/release-notes-2011.html
Http://www.javaeye.com/news/193
Related discussions include:
Http://www.nabble.com/AppFuse-Struts-2-Basic-%2B-Hibernate---upgrade-to-AppFuse-2.0.1--%3E-Struts-Taglib-problem--td14749012s2369.html
Http://issues.appfuse.org/browse/APF-941
Http://www.nabble.com/Update-from-2.0.9-to-2.0.11-td14594912.html
Trick tip:
For <s: Property>
<S: property value = "# parameters. Name"/>
For <s: Set>, use (otherwise, an error occurs ):
<S: Set Name = "name" value = "# parameters. name [0]"/>
However, if you use the struts include tag to transmit parameters, <s: Property> and <s: Set> cannot obtain transmitted parameters, for example:
<Body>
<S: Include value = "/welcome. jsp">
<S: Param name = "name"> Scott </S: param>
</S: Include>
</Body>
In webcome. jsp, the "name" parameter cannot be obtained through <s: Property> and <s: Set>:
<S: property value = "# parameters. Name"/>
<S: Set Name = "name" value = "# parameters. name [0]"/>
And can only be used
<% Request. getparameter ("name") %>
To obtain