[英]Application object in spring MVC
I used to write web development application using Servlets and jsps, recently i have started learning spring. 我曾经使用Servlet和jsps编写Web开发应用程序,最近我已经开始学习spring。 Using Servlets i had built an application in which i have maintained the two objects using application context and some objects using session. 通过使用Servlet,我构建了一个应用程序,其中使用应用程序上下文维护了两个对象,使用会话维护了一些对象。 Now in springs i don't know how to do this. 现在在春天,我不知道该怎么做。
Lets understand the problem with an example. 让我们用一个例子来理解问题。
I have following obj 我有以下obj
player p1= new Player();
player p2 = new Player();
match m1 = new Match(p1,p2);
I want to maintain the match obj in application context so that i can manage the data using session of both the users/players and reflect on both side. 我想在应用程序上下文中维护match obj,以便我可以使用两个用户/播放器的会话来管理数据并在两个方面进行反映。
thanks in advance. 提前致谢。
In Spring terms application
is a singleton
scope. 在Spring术语中, application
是singleton
范围。 Please, read more info about Spring MVC around the Internet. 请在Internet上阅读有关Spring MVC的更多信息。
UPDATE 更新
http://docs.spring.io/spring/docs/current/spring-framework-reference/htmlsingle/#spring-web http://www.mkyong.com/tutorials/spring-mvc-tutorials http://www.tutorialspoint.com/spring/spring_web_mvc_framework.htm http://docs.spring.io/spring/docs/current/spring-framework-reference/htmlsingle/#spring-web http://www.mkyong.com/tutorials/spring-mvc-tutorials http:// www .tutorialspoint.com / spring / spring_web_mvc_framework.htm
And here you can find a lot of 'Hello worlds' for many Spring cases: https://spring.io/guides 在这里,您可以找到许多适用于许多Spring案例的“ Hello worlds”: https : //spring.io/guides
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.