Results 1 to 3 of 3

Thread: successview for SimpleFormController

  1. #1

    Default successview for SimpleFormController

    Hi All,

    When specifying your form based on SimpleFormController in the XML config. file, does the JSP used for successview have to be "public", I'd like to have it hidden from public view in my WEB-INF/jsp directory.

    Here's what I have so far:

    <bean id="updateAccountFormController" class="com.xxx.controller.UpdateAccountFormControl ler">
    <property name="sessionForm" value="true"/>
    <property name="commandName" value="updateAccountCommand"/>
    <property name="commandClass" value="com.thresholdcorp.hsmgmt.orm.Customer"/>
    <property name="validator">
    <bean class="com.thresholdcorp.thresholdusers.validator. UpdateAccountValidator"/>
    </property>
    <property name="formView" value="updateaccount"/>
    <property name="successView" value="updateaccountok.jsp"/>
    <property name="dao">
    <ref bean="customerDao"/>
    </property>
    </bean>

  2. #2
    Join Date
    Mar 2009
    Posts
    126

    Default

    Spring recommends that you should not keep your jsp's public.You should keep them always in WEB-INF directory.You can use the InternalSourceViewResolver provided by spring to hide your jsps.
    You can use the following code in your bean definitions file:
    <bean id="viewResolver"
    class="org.springframework.web.servlet.view.Intern alResourceViewResolver">
    <property name="viewClass">
    <value>org.springframework.web.servlet.view.JstlVi ew
    </value>
    </property>
    <property name="prefix">
    <value>/WEB-INF/jsp/</value>
    </property>
    <property name="suffix">
    <value>.jsp</value>
    </property>
    </bean>
    and you need to change your success view value as "updateaccountok"
    I hope this solves your query.
    Cheers,
    Sushant

  3. #3

    Unhappy Tried your suggestion, got an error

    Thanks for the response, I can see that it should've worked but after applying the form I now get an error as though it can't find the success view JSP. My config. settings are below:

    HTTP Status 404 - /user/updateaccountok

    type Status report

    message /user/updateaccountok

    description The requested resource (/user/updateaccountok) is not available.
    Apache Tomcat/5.5.27

    ----------------------------------------------------------------------
    <bean id="updateAccountFormController" class="com.thresholdcorp.thresholdusers.controller .UpdateAccountFormController">
    <property name="sessionForm" value="true"/>
    <property name="commandName" value="updateAccountCommand"/>
    <property name="commandClass" value="com.thresholdcorp.hsmgmt.orm.Customer"/>
    <property name="validator">
    <bean class="com.thresholdcorp.thresholdusers.validator. UpdateAccountValidator"/>
    </property>
    <property name="formView" value="updateaccount"/>
    <property name="successView" value="updateaccountok"/>
    <property name="dao">
    <ref bean="customerDao"/>
    </property>
    </bean>

    <bean id="viewResolver" class="org.springframework.web.servlet.view.Intern alResourceViewResolver">
    <property name="viewClass"><value>org.springframework.web.se rvlet.view.JstlView</value></property>
    <property name="prefix"><value>/WEB-INF/jsp/</value></property>
    <property name="suffix"><value>.jsp</value></property>
    </bean>

Tags for this Thread

Posting Permissions

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