Announcement Announcement Module
Collapse
No announcement yet.
Signon with BeanNameUrlHandlerMapping newbie problem Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Signon with BeanNameUrlHandlerMapping newbie problem

    Im completle new to Spring and wanted to write a sample application from scratch. Now I want to make a signon similar to the petstore example.

    I have got a public Controller Access:

    Code:
    <bean id="defaultHandlerMapping" class="org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping"/>
    	
    	<bean name="login.html" class="at.newsagg.web.LoginFormController"> 
    		<property name="commandName">
    			<value>login</value>
    		</property> 
    		<property name="commandClass"> 
    			<value>at.newsagg.model.User</value> 
    		</property> 
    		<property name="formView">
    			<value>login</value>
    		</property> 
    		<property name="successView">
    			<value>main.html</value>
    		</property> 
    		<property name="userManager">
    			<ref bean="userManager"/>
    		</property> 		
    	</bean>
    and protected entries that require authentification ... which is currently empty:
    Code:
    	<bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping"> 
    		<property name="interceptors">
    			<list>
    				<ref bean="loginInterceptor"/>
    			</list>
    		</property>
    		<property name="mappings"> 
    			<props> 
    				<!-- <prop key="/login.html">loginFormController</prop>  -->
    		 	</props> 
    		</property> 
    	</bean>
    		
    	<bean id="loginInterceptor" class="at.newsagg.web.LoginInterceptor"/>
    I have got an Interceptor doing almost the same thing like in the example.

    My problem is that I get following error message when I submit the form with the userdata to "login.html".

    form tag in the jsp:
    Code:
    <form method="post" action="<c&#58;url value="login.html"/>">
    Error Message:
    Code:
    WARN - DispatcherServlet.doService&#40;465&#41; | No mapping for &#91;/equinox/login.html&#93; in DispatcherServlet with name 'action'

  • #2
    It seems that you have missed out the leading slash in the bean name for the LoginFormController. You should change it from login.html to /login.html or whatever is needed to make it correspond to the undefined mapping shown in the error message. Without seeing the full configuration I can't give you exact values, but essentially you need the path to the resource without the servlet context path.

    Rob

    Comment


    • #3
      oops ... I missed that slash :shock:

      thank you

      Comment

      Working...
      X