Skip to content

Instantly share code, notes, and snippets.

@seycileli
Last active January 31, 2020 17:55
Show Gist options
  • Save seycileli/3d2ce4a0f5f9ed7108a2c63b9a1d5cc0 to your computer and use it in GitHub Desktop.
Save seycileli/3d2ce4a0f5f9ed7108a2c63b9a1d5cc0 to your computer and use it in GitHub Desktop.
How to create dispatcher-servlet.xml in IntelliJ IDE
Right click WEB-INF folder | NEW | FILE
name file dispatcher.xml || dispatcher.servlet.xml
insert the follow code;
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.3.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-4.3.xsd">
<!-- Controller goes here -->
<context:component-scan
base-package="com.project-name-here.controller">
</context:component-scan>
<!-- MVC annotation driven -->
<mvc:annotation-driven></mvc:annotation-driven>
<!-- Declare the view Resolver BEAN -->
<bean id="viewResolver"
class="org.springframework.web.servlet.view.UrlBasedViewResolver">
<property name="viewClass"
value="org.springframework.web.servlet.view.JstlView"></property>
<property name="prefix" value="/WEB-INF/views/"></property>
<property name="suffix" value="*"></property>
</bean>
</beans>
- IntelliJ IDE will then ask to configure. Click configure.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment