Document directory
Today, I encountered a problem. In webwork 2.2, I sent multiple parameters to the result of an action:
The original configuration is as follows:
<Action name = "blahblahaction" class = "blahaction" method = "blah">
<Result name = "success" type = "Redirect">/Some. Action? Field1 =$ {field1} & field2 =$ {field2} </result>
</Action>
The following prompt appears during running:
The reference to entity "field2" must end with the ';' delimiter.
I thought it was an ognl problem. I went around to search for it ...... No problem was found after reading the DTD.
Later, I suddenly found that it was a SAX Parser error during the modification process, so I thought it might be a problem with XML.
After repeated queries, the solution is obtained:
The principle of replacing "& amp;" with "&" is the same as the escape in HTML. I forgot the XML syntax.
The configuration is as follows:
<Action name = "blahblahaction" class = "blahaction" method = "blah">
<Result name = "success" type = "Redirect">/Some. Action? Field1 =$ {field1} & amp; field2 =$ {field2}
</Result>
</Action>
Working properly!
Comment # Re: How to pass multiple parameters <Param name = "paraa"> xx1 </param> to the Redirect result of webwork
<Param name = "parab"> xx2 </param>
This is not enough.
# Re: How to pass multiple parameters to the Redirect result of webwork. Here, we will configure the multiple parameters of result, rather than the parameters of action, which have different lifecycles. <Param> the parameter is used to assign values to the action initialization, but cannot pass the <param> value to the result, when result type = "Redirect", it is equivalent to an event that ends the action lifecycle and passes the parameter to the next action or URL.
In fact, if the above Code is not abbreviated, all parameters are specified as follows:
<Action name = "blahblahaction" class = "blahaction" method = "blah">
<Result name = "success" type = "Redirect">
<Param name = "location">/Some. Action? Field1 =$ {field1} & amp; field2 =$ {field2} </param>
<Param name = "parse"> true </param>
</Result>
</Action>
Because the result of type = "reirect" only accepts the location and parse parameters, and does not support custom Param, This is a limitation. This restriction can be found on the webwork wiki. I hope webwork can change it in the future. However, lightbody may think that the ognl expression is powerful enough.