Struts2 wildcard action mapping with ognl expressions as field-names
I am trying to populate a parameter named 'member.id' in an action class using regular expression and wildcard action mapping with Struts开发者_JAVA技巧2. The action mapping is something like this:
<action name = "validationEmailHTML/{sac:[^/]*}/{member.id:[0-9]*}" class = "controller.signUp.ValidationEmailContentController">
<interceptor-ref name="securityStack"/>
<result name="success">/signup/validationemail.jsp</result>
<result name="dbconnectionerror">/error/500.jsp</result>
<result name="unknownerror">/error/500.jsp</result>
</action>
The first parameter 'sac' gets populated correctly but the 'member.id' is being ignored. Am I missing something here or is it because ognl expressions to specify field-names is not an option when regex is used as a pattern-matcher?
It seems that it is impossible to use OGNL expressions for parameter names when the regular expression pattern-matcher is used in struts2. The only possible way is to use simple value members in your action class and write the code to set the value of properties of complex objects inside the class methods.
精彩评论