Reputation: 2209
I have done my Dynamic web project using Servlet 3.0.
Can I convert this project to Spring project by some kind of web service (REST calls) and Spring Boot.
Or Is there any other possible ways to do that.?
Note: My project includes servlet controller class (GET and POST) , web content like jsp, ajax, javascript, css, html, etc
Upvotes: 6
Views: 11866
Reputation: 304
You can try doing this, if you are using annotations:
Mark class as @Controller and remove extends part of class, in your doGet and doPost add annotation @Requestmapping(value="/someURL" method="RequestMethod.GET" and @Requestmapping(value="/someURL" method="RequestMethod.Post"
In the above methods return the name of jsp file, where you want to forward your processed data.
You will have access to Model object in the above controller classes and jsp in order to process data.
In your web.xml define DispatcherServlet and a configLocation to scan controllers.
Essentially what you are doing is to introduce Spring just defining DispatcherServlet and then the spring controller classes are loaded.When you hit a URL it will be routed to correct controller.
Good Luck.
Upvotes: 9