0

I am trying to implement an inline search form (if that makes sense). Basically, I want two mappings for this page.

    @RequestMapping(value="/application", method=RequestMethod.GET)
    public ModelAndView view() {
        return new ModelAndView("application");
    }

    @RequestMapping(value="/application?search=t")
    public ModelAndView handleSearch() {
        CaseManager caseManager = new CaseManager();
        ModelAndView modelAndView = new ModelAndView("application");
        modelAndView.addObject("caseList", caseManager.getCaseList());

        return modelAndView;
    }

So, /application is the main page of the web app. It has a search bar where a user can enter a handful of search parameters. When they click on search, the table of results should get populated on the page. I went with this route with no luck. I end up getting a 404 on /application?search=t.

The button's href="WebappName/application?search=t"

Any assistance would be greatly appreciated! I am new to this whole web dev world and got kind of thrown into the fire.

1 Answer 1

3

You'll want to use the params argument to the @RequestMapping:

http://docs.spring.io/spring/docs/3.2.x/javadoc-api/org/springframework/web/bind/annotation/RequestMapping.html?is-external=true

e.g.:

@RequestMapping(value="/application" params="search")

If you want to capture the param value and do something with it or

@RequestMapping(value="/application" params="search=t")

if you want to dispatch to a specific param/value combination (looks like the fit in this case).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.