Announcement Announcement Module
Collapse
No announcement yet.
No mapping for [/SpringApp/price.htm] in DispatcherServlet with name 'springapp' Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • No mapping for [/SpringApp/price.htm] in DispatcherServlet with name 'springapp'

    Hi..
    I'm a spring newbie.. I'm following the Spring Framework MVC application step-by-step tutorial.. I'm using netbeans 6.1 and jdk 1.6. I was able to develop and run the application upto adding a form. but when I added a form to increase the price with PriceIncreaseFormController I get

    No mapping for [/SpringApp/price.htm] in DispatcherServlet with name 'springapp'

    error on glassfish V2 output window.

    my Web application context is as follows..Here Im unable to add xsi:schemaLocation since it's not allowed to post urls until i make 15 posts..It's as in the tutorial though..

    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="I can't use urls"
    xmlns:xsi=""
    xmlns=""
    xmlns:aop=""
    xmlns:tx=""
    xsi:schemaLocation=""


    <bean class="org.springframework.web.servlet.mvc.support .ControllerClassNameHandlerMapping"/>

    <!--
    Most controllers will use the ControllerClassNameHandlerMapping above, but
    for the index controller we are using ParameterizableViewController, so we must
    define an explicit mapping for it.
    -->
    <bean id="urlMapping" class="org.springframework.web.servlet.handler.Sim pleUrlHandlerMapping">
    <property name="mappings">
    <props>
    <prop key="/index.htm">indexController</prop>
    </props>
    </property>
    </bean>


    <bean id="productManager" class="springapp.service.SimpleProductManager">
    <property name="products">
    <list>
    <ref bean="product1"/>
    <ref bean="product2"/>
    <ref bean="product3"/>
    </list>
    </property>
    </bean>

    <bean id="product1" class="springapp.domain.Product">
    <property name="description" value="Lamp"/>
    <property name="price" value="5.75"/>
    </bean>

    <bean id="product2" class="springapp.domain.Product">
    <property name="description" value="Table"/>
    <property name="price" value="75.25"/>
    </bean>

    <bean id="product3" class="springapp.domain.Product">
    <property name="description" value="Chair"/>
    <property name="price" value="22.79"/>
    </bean>

    <bean id="messageSource" class="org.springframework.context.support.Resourc eBundleMessageSource">
    <property name="basename" value="messages"/>
    </bean>

    <bean name="/price.htm" class="springapp.web.PriceIncreaseFormController">
    <property name="sessionForm" value="true"/>
    <property name="commandName" value="priceIncrease"/>
    <property name="commandClass" value="springapp.service.PriceIncrease"/>
    <property name="validator">
    <bean class="springapp.service.PriceIncreaseValidator"/>
    </property>
    <property name="formView" value="priceincrease.htm"/>
    <property name="successView" value="hello.htm"/>
    <property name="productManager" ref="productManager"/>
    </bean>


    <bean id="viewResolver"
    class="org.springframework.web.servlet.view.Intern alResourceViewResolver"
    p:viewClass="org.springframework.web.servlet.view. JstlView"
    prefix="/WEB-INF/jsp/"
    p:suffix=".jsp" />

    <!--
    The index controller.
    -->
    <bean name="indexController"
    class="org.springframework.web.servlet.mvc.Paramet erizableViewController"
    p:viewName="index" />

    <bean name="/hello.htm" class="springapp.web.HelloController">
    <property name="productManager" ref="productManager"/>
    </bean>



    </beans>

    I guess the error is in this xml. Can anyone please help me on this?

    Thanks in advance..

  • #2
    Please use [ code][/code ] tags when posting code.

    First off all I recommend that you check the javadocs for the HandlerMapping classes you use. After that register a BeanNameHandlerMapping.

    Comment

    Working...
    X