Announcement Announcement Module
Collapse
No announcement yet.
The same controller with two usage scenarios Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • The same controller with two usage scenarios

    I have a user form. To register an user account, a user signon check isn't needed; while it is needed for editing a user account. My queestion is how to handl this situation in the servlet.xml file. I have it as the following where the controller has two instance and I get an error message: ' nested exception is org.xml.sax.SAXParseException: An element with the identifier "secure_editUser" must appear in the document.'


    <bean id="urlMapping" class="org.springframework.web.servlet.handler.Sim pleUrlHandlerMapping">
    <property name="mappings">
    <props>

    <!-- Users -->
    <prop key="/user/new.htm">userFormController</prop>

    </property>
    </bean>

    <bean id="userValidator" class="com.xxx.biz.validators.UserValidator"/>

    <!--
    -->
    <bean name="userFormController" class="com.xxx.web.user.UserFormController">
    <property name="communityManager"><ref bean="communityManager"/></property>
    <property name="validator"><ref bean="userValidator"/></property>
    <property name="commandClass"><value>userForm</value></property>
    <property name="formView"><value>editUserForm</value></property>
    <property name="successView"><value>successEditUser</value></property>
    </bean>

    <bean id="secureHandlerMapping" class="org.springframework.web.servlet.handler.Sim pleUrlHandlerMapping">
    <property name="interceptors">
    <list>
    <ref bean="signonInterceptor"/>
    </list>
    </property>
    <property name="urlMap">
    <map>
    <!-- Users -->
    <entry key="/user/edit.htm"><ref local="secure_editUser"/></entry>
    </property>
    </bean>

    <bean id="signonInterceptor" class="com.xxx.web.user.SignonInterceptor"/>

    <!-- Users controllers & validators -->
    <bean name="secure_editUser" class="com.xxx.web.user.UserFormController">
    <property name="communityManager"><ref bean="communityManager"/></property>
    <property name="validator"><ref bean="userValidator"/></property>
    <property name="commandClass"><value>userForm</value></property>
    <property name="formView"><value>editUserForm</value></property>
    <property name="successView"><value>successEditUser</value></property>
    </bean>

  • #2
    Check your definition of secureHandlerMapping; the urlMap property isn't closed:
    Code:
        <property name="urlMap">
            <map>
                <!-- Users -->
                <entry key="/user/edit.htm"><ref local="secure_editUser"/></entry>
        </property>
    Try adding a </map> tag.

    Comment


    • #3
      Thank for pointing the error. It, however, is an error on copy/paste. My servlet.xml file does have the closing tag.

      Comment

      Working...
      X