Use annotation in Spring MVC to jump to another action in the action

Source: Internet
Author: User

use annotation in Spring MVC to jump to another action in the action
The return value of the method in action is a string line, and the general case is to return a JSP, such as:
return "XX": it means returning to a JSP page
What if you want to jump to another action in this action?
return "Redirect://.do?"For example:
@RequestMapping (params="Action=delete")  PublicString Delete (@RequestParam ("type") intType, @RequestParam ("URL") (String URL) {Map<string, object> policy =NULL; if(Type = =0) { if(logger.isdebugenabled ()) {Logger.debug ("Delete an Access policy"); } Policy= This. Visitorproxymanager.getvisitorpolicies ("Policy"); Policy.remove (URL); if(logger.isdebugenabled ()) {Logger.debug ("Delete Access Policy succeeded"); } return "redirect:/console/visitorpolicylist.do?action=list&type=0"; } Else { if(logger.isdebugenabled ()) {Logger.debug ("Delete Session access policy"); } Policy= This. Visitorproxymanager. Getvisitorpolicies ("Sessionpolicy"); Policy.remove (URL); if(logger.isdebugenabled ()) {Logger.debug ("Delete Session access policy succeeded"); } return "redirect:/console/visitorpolicylist.do?action=list&type=1"; } }

Use annotation in Spring MVC to jump to another action in the 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.