Pass multiple parameters to the result of an action

Source: Internet
Author: User
Document directory
  • Comment

 

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.