Announcement Announcement Module
Collapse
No announcement yet.
Spring 3 RequestMapping Not working Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring 3 RequestMapping Not working

    Hi All,
    I am trying to configure the spring controller. But I am getting a 404 error. Below is my whole Structure. All my controllers are in the specified package.

    Code:
    action-sevlet.xml
    
    <context:annotation-config />
     
    	<!-- Scans the classpath for annotated components that will be auto-registered as Spring beans.
     	For example @Controller and @Service. Make sure to set the correct base-package-->
    	<context:component-scan base-package="com.my.company" />
     
    	<!-- Configures the annotation-driven Spring MVC Controller programming model.
    	Note that, with Spring 3.0, this tag works in Servlet MVC only!  -->
    	<mvc:annotation-driven /> 
    .....
    .....
    2)
    Code:
    @Controller
    @RequestMapping(value="/user")
    public class LoginController {
    	
    	@Autowired
    	private LoginServiceBO loginServiceBO;
    3)
    Code:
    @RequestMapping(value="/loginPage", method=RequestMethod.GET)
    	protected String sendLoginForm(Model model){
    4) index.jsp
    Code:
    <c:redirect url="/user/loginPage"/>
    5) I am trying to invoke my controller using the URL , http:localhost:8080/SpringAnnotation/user/loginPage, I am getting the 404 page not found error.


    type Status report

    message /SpringAnnotation/user/loginPage

    description The requested resource (/SpringAnnotation/user/loginPage) is not available.

    Could someone please help me out with this.
    Really Appreciate the help.

    Thanks,
    Rajesh

  • #2
    It seems odd that your "sendLoginForm()" method is protected. Try changing it to public and rerunning your test.

    Comment


    • #3
      Did not work with public

      Originally posted by dkarr View Post
      It seems odd that your "sendLoginForm()" method is protected. Try changing it to public and rerunning your test.
      Thanks Darr,
      I tried the public option but it did not work.

      Comment


      • #4
        Hi

        Show your web.xml - haven't you mapped everything ("/*") to Spring's DispatcherServlet?

        regards
        Grzegorz Grzybek

        Comment

        Working...
        X