Here I would like to show a small example on how to create a sample spring bases Rest Web services.
Project Structure:
Below is the basic project structure.
Below is the basic project structure.
Dependencies (pom.xml):
View Resolver Configuration:
<bean
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/view/" />
<property name="suffix" value=".jsp" />
</bean>
<bean
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/view/" />
<property name="suffix" value=".jsp" />
</bean>
Controller and util Class:
The controller class handling 2 different type of responses. The method printProjectjson() will return a Json response.
The controller class handling 2 different type of responses. The method printProjectjson() will return a Json response.
No comments:
Post a Comment