Struts2_4 _ is the injection value of the Action attribute.

Source: Internet
Author: User

Struts2_4 _ is the injection value of the Action attribute.

Struts2 provides the dependency injection function for the attributes in Action. In the configuration file of struts2, You can inject values for the attributes in Action. The attributes must provide the setter method.

1) employeeAction class:

Public class employeeAction {private String savePath; public String getSavePath () {return savePath;} public void setSavePath (String savePath) {this. savePath = savePath;} public String execute () {return "success ";}}

2)Struts. xml file:

 

 

  


   

   ZhuRu

   
    
/Index. jsp

   

  

 

3) index. jsp file:

$ {SavePath}




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.