PDA

View Full Version : finding controller


kasim
Jul 14th, 2007, 08:09 AM
I have made the -servlet and web.xml file as shown below:
my question here is i have declared controller as testController , in url handler mapping i have specified as testController, is this will identify my controller and jsp file?
code is given below:

SpringMVC-servet.xml file:



<bean name="testController" class="com.test.spring.mvc.TestController">
<property name="testService">
<ref local="service"/>
</property>
<property name="testDTO">
<ref local="test"/>
</property>
</bean>

<bean id="simpleUrlMapping" class="org.springframework.web.servlet.handler.SimpleUrlH andlerMapping">
<property name="mappings">
<props>
<prop key="/Test.htm">testController</prop>
</props>
</property>
</bean>




web.xml file:

<web-app>

<listener>
<listener-class>org.springframework.web.context.ContextLoaderListe ner</listener-class>
</listener>

<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/ServiceLayer-Spring.xml</param-value>
</context-param>

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

<servlet-mapping>
<servlet-name>SpringMVC</servlet-name>
<url-pattern>*.htm</url-pattern>
</servlet-mapping>

</web-app>

Jörg Heinicke
Jul 14th, 2007, 04:01 PM
i have declared controller as testController , in url handler mapping i have specified as testController, is this will identify my controller and jsp file?

Yes for the controller, no for the JSP. The controller determines the view.

Jörg