Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Spring 3.2 -- 404 error calling a controller method from a link in a JSP

  1. #1
    Junior Member
    Join Date
    Apr 2013
    Thanked 0 Times in 0 Posts

    Default Spring 3.2 -- 404 error calling a controller method from a link in a JSP

    I'm trying to use a link in my JSP to pass a parameter to a method in my Spring controller, but I get a 404 error. Here is the relevant part of my JSP code.

    <c:forEach var="bulletin" items="${bulletins}">
        <c:if test="${bulletin.approved}">
            <a href="/bulletin/${bulletin.id}" >${bulletin.name}
                -- ${bulletin.subject}</a>
            <br />
            <br />

    Here is the method in my controller.

    @RequestMapping(value = "/bulletin/{id}", method = RequestMethod.GET)
    public ModelAndView getSingleBulletin(@PathVariable("id") int id,
            Model model) {
        ModelAndView mav = new ModelAndView();
        try {
            Bulletin bulletin = bulletinDAO.getSingleBulletin(id);
            if (bulletin != null) {
                ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder
                HttpSession session = attributes.getRequest().getSession(true);
                session.setAttribute("bulletin", bulletin);
        } catch (Exception e) {
        return mav;

  2. #2
    Member Chris.Brown.SPE's Avatar
    Join Date
    May 2008
    Fort Wayne, Indiana
    Thanked 31 Times in 31 Posts

    Default Re: Spring 3.2 -- 404 error calling a controller method from a link in a JSP

    Are you able to make the part of the method you need into a static method? I'm pretty sure you can call static methods all you want from a JSP, but for instance methods you would need an instance of the controller.
    Writing code is your job, helping you fix and understand it is mine.

    <-- Be sure to thank and REP (Star icon) those who have helped you. They appreciate it!

Similar Threads

  1. Replies: 4
    Last Post: February 1st, 2013, 09:23 AM
  2. 404 Status Error
    By preeti91 in forum Java Servlet
    Replies: 2
    Last Post: September 5th, 2012, 07:10 AM
  3. Http 404 Error - Img attached
    By narayanyr in forum What's Wrong With My Code?
    Replies: 2
    Last Post: August 16th, 2012, 08:57 PM
  4. Replies: 0
    Last Post: October 14th, 2011, 11:03 AM
  5. Spring Mvc 404 error
    By jadeite100 in forum Web Frameworks
    Replies: 2
    Last Post: January 5th, 2010, 07:47 PM

Tags for this Thread