Results 1 to 3 of 3

Thread: Having Trouble Following View Mapping in Petstore Sample App

  1. #1
    Join Date
    Aug 2004
    Location
    Cincinnati Ohio
    Posts
    7

    Default 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
    jolmstead2k@yahoo.com
    John Olmstead
    jolmstead2k@yahoo.com

  2. #2
    Join Date
    Aug 2004
    Location
    München/Germany
    Posts
    7

    Default

    ...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

  3. #3
    Join Date
    Aug 2004
    Location
    Cincinnati Ohio
    Posts
    7

    Default Sorry, I missed the views.properties page.

    I missed the reference to the views.properties file in the petclinic-servlet.xml. Thanks Folks!
    John Olmstead
    jolmstead2k@yahoo.com

Similar Threads

  1. Replies: 9
    Last Post: Nov 1st, 2005, 10:36 PM
  2. Replies: 4
    Last Post: Oct 5th, 2005, 11:04 AM
  3. Content Provider vs View Model
    By Martin Kersten in forum Swing
    Replies: 21
    Last Post: Mar 10th, 2005, 02:25 PM
  4. Replies: 13
    Last Post: Dec 7th, 2004, 10:00 AM
  5. Replies: 2
    Last Post: Sep 10th, 2004, 07:03 AM

Posting Permissions

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