Results 1 to 2 of 2

Thread: finding controller

  1. #1
    Join Date
    May 2007
    Posts
    104

    Default finding controller

    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:
    PHP Code:


    <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.SimpleUrlHandlerMapping">
            <
    property name="mappings">
                <
    props>
                    <
    prop key="/Test.htm">testController</prop>            
                </
    props>
            </
    property>
        </
    bean

    web.xml file:

    PHP Code:
    <web-app>  

        <
    listener>
            <
    listener-class>org.springframework.web.context.ContextLoaderListener</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

  2. #2
    Join Date
    Nov 2005
    Location
    Reutlingen, Germany
    Posts
    2,098

    Default

    Quote Originally Posted by kasim View Post
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •