Four questions about the transfer value of the JSP page and the action to the Action and action

Source: Internet
Author: User

Scenario One : The JSP is submitted to an action, and if the action method is finished, it goes to another method in that action.

Then you can return the other method directly, and then configure the method in Struts.xml.

Scenario Two :

The JSP page submits an action, and if the Giantaction method executes, it goes to a method in another action

Redirect is required at this time

Only the return "name value" is required

The redirection name value is then configured in Struts.xml, and type types use redirect.

If you need to pass parameters, you can use the Param tag as follows, and then define the parameters in the download action, and get and set to

situation three :

On a page that is displayed on an action page, if you want to go to a method in another action by using the button.

Such as:

By clicking the button to go to another JSP page, you can go directly to another action when committing:

In the Struts.xml, write the action directly to

, if you need to pass parameters, you can put the parameters in the URL through the Param object to the key value in the input hidden field of value. The Get and set methods for the properties of the parameter are then written in the action above and can be passed to the action.

Scenario Four :

If it is necessary to pass the parameters through Struts.xml, that is the following:

You need to take the value of Paperid before passing it, you can add the hidden field on the JSP page and fetch the Paperid.

As follows: So there is a Paperid value in the action above.

The XML is then passed to pass the parameters as follows:

You only need to define the corresponding Paperid property in the passed action, and you can get the value from both the Got and set.

Four questions about the transfer value of the JSP page and the action to the Action and action

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.