Announcement Announcement Module
Collapse
No announcement yet.
Clarification on hrefs within a jsp please Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Clarification on hrefs within a jsp please

    In my springapplet-servlet.xml file I have the following url mappings,

    <bean id="loginController" class="ui.action.Login"/>
    <bean id="listPortfoliosController" class="ui.action.ListPortfolios"/>

    <bean id="urlMapping" class="org.springframework.web.servlet.handler.Sim pleUrlHandlerMapping">
    <property name="mappings">
    <props>
    <prop key="/start.do">loginController</prop>
    <prop key="/listportfolios.do">listPortfoliosController</prop>
    </props>
    </property>
    </bean>

    and in my web.xml I have:
    <servlet>
    <servlet-name>springapp</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherSe rvlet</servlet-class>
    <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
    <servlet-name>springapp</servlet-name>
    <url-pattern>*.do</url-pattern>
    </servlet-mapping>

    These work fine for getting my appliaction going.

    Now within the listportfolio.jsp which provides the view for the listportfoliocontroller and hence listportfolios.do I have a form and also some hrefs. Originally these were referring to /listportfolio.do which seemed to work but thinking about it didnt make much sense to me as I am already on the listportfolio.do page so I changed them to call /listPortfolioController but this doesnt work.

    Which is the correct method, and if it is the second method how do I configure my xml files to get it to work.

    Also can I just check the AbstractFormController class is only meant to be used when users are using a form in an add/edit screen rather than any page which uses the <form> tag to pass user entered parameters.

  • #2
    You are doing it correctly by linking to /listportfolios.do .

    The AbstractFormController should be used if you need to prepare the data to be shown in the form. So, like you said, it is good for add/edit type forms. If you just want to get a value passed in the form POST or as a querystring param, you extend AbstractController and user request.getParameter("paramName). And if you want to have the data bound to a command object and possibly validated, extend BaseCommandController.

    Comment


    • #3
      Originally posted by dgynn
      You are doing it correctly by linking to /listportfolios.do .
      Ok thanks, I suppose thinking about this call will go straight way go to the specfied controller

      Comment

      Working...
      X