Integration of struts2 and spring

Source: Internet
Author: User

Students who have just been in touch with the framework will encounter such a problem:

 

When you use myeclipse to configure an SSH framework, you write a logon verification action. However, when you access it on the page, the following occurs:

 

Execute is executed every time it is the first time you log on, and then log on again. This is the first time you log on.
In addition, the console only outputs the information added to the execute method when it is executed for the first time.
Login can continue only after Tomcat refresh is restarted

 

 

The solution is:

The bean in the spring configuration file is Singleton by default, so it is loaded only once.
You can add an attribute scope = "prototype" to the bean you configured the action"
Example:
<Bean id = "loginaction" class = "com. tianhao. Action. loginaction" Scope = "prototype"> </bean>

In this way, each call to loginaction is to load a new action instance.

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.