简体   繁体   English

是否可以在现有Servlet-Jsp项目中的Spring框架中添加新模块

[英]Is it possible to add a new module in Spring framework in a Existing Servlet-Jsp Project

I have a requirement to add a new module(on Spring framework) in an Existing Project (on Servlet-Jsp Technology). 我需要在现有项目(基于Servlet-Jsp技术)中添加一个新模块(在Spring框架上)。 I have to convert the Login Authentication module of project in Spring Technology. 我必须在Spring Technology中转换项目的Login Authentication模块。 Is it possible, if Not then What is the other way for it. 如果不是,那有可能吗?还有另一种方法吗? Actually that's a live project and very vast. 实际上,这是一个实时项目,非常庞大。 So we want to slowly migrate the whole project from Servlet-JSP to Spring. 因此,我们希望将整个项目从Servlet-JSP缓慢迁移到Spring。 Plz Guide me regarding that. 请给我指导。 Thank you. 谢谢。

Just map spring servlet in your web.xml to the separate url and step-by-step move you servlets to spring controllers. 只需将web.xml中的spring servlet映射到单独的url,然后逐步将servlet转移到spring控制器。

web.xml web.xml

<servlet>
    <servlet-name>spring-web</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
    <servlet-name>spring-web</servlet-name>
    <url-pattern>/spring/*</url-pattern>
</servlet-mapping>

In this example all requests with path started from /spring will be addressed by spring-web meanwhile other servlets should continue to work as before. 在这个例子中,所有从/spring开始的路径请求都将由spring-web处理,而其他servlet应该继续像以前一样工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM