Announcement Announcement Module
Collapse
No announcement yet.
Having Trouble Following View Mapping in Petstore Sample App Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Having Trouble Following View Mapping in Petstore Sample App

    Ladies and Gentlemen;

    I am trying to model a starter Spring app off of the petstore sample app and I getting confused with the view mapping. Specifically discussing the following form bean definition :

    <bean id="findOwnersForm" class="org.springframework.samples.petclinic.web.F indOwnersForm">
    <property name="formView"><value>findOwnersForm</value></property>
    <property name="selectView"><value>selectOwnerView</value></property>
    <property name="successView"><value>ownerRedirect</value></property>
    <property name="clinic"><ref bean="clinic"/></property>
    </bean>

    I do not see where the "ownerRedirect" view is resolved to a jsp. The "findOwnersForm" is resolved in the urlMapping bean as follows:

    <bean id="urlMapping" class="org.springframework.web.servlet.handler.Sim pleUrlHandlerMapping">
    <property name="mappings">
    <props>
    <prop key="/welcome.htm">clinicController</prop>
    <prop key="/vets.htm">clinicController</prop>
    <prop key="/owner.htm">clinicController</prop>
    <prop key="/findOwners.htm">findOwnersForm</prop>
    <prop key="/editOwner.htm">editOwnerForm</prop>
    <prop key="/addOwner.htm">addOwnerForm</prop>
    <prop key="/addVisit.htm">addVisitForm</prop>
    <prop key="/addPet.htm">addPetForm</prop>
    <prop key="/editPet.htm">editPetForm</prop>
    </props>
    </property>
    </bean>

    However, there is no mapping for the ownerRedirect, or its cousin ownerView. The support document states :

    "ownerView displays a owner's data and a list of the owner's pets and their data (see petclinic.web.ClinicController).
    ownerRedirect redirects to ownerView."

    I am clearly missing something here. Thank you in advance for your patience and your response.

    John Olmstead
    Meyertool Company
    Cincinnati Ohio
    [email protected]

  • #2
    ...depends on your resolver, when u have something like this in your petstore-servlet.xml:

    <bean id="viewResolver"
    class="org.springframework.web.servlet.view.UrlBas edViewResolver">
    <property name="prefix"><value>/WEB-INF/jsp/</value></property>
    <property name="suffix"><value>.jsp</value></property>
    </bean>

    ...then "ownerRedirect" is mapped to /WEB-INF/jsp/ownerRedirect.jsp.

    See spring-reference chapter 12.5.

    Hope that helps,
    markus

    Comment


    • #3
      Sorry, I missed the views.properties page.

      I missed the reference to the views.properties file in the petclinic-servlet.xml. Thanks Folks!

      Comment

      Working...
      X