1

I have an HTML form in which I'd like to have additional URL parameters after the form query. For example, the URI I'd like to end up with may look like this:

/publications?pub_type=article&year=2016/titles

However, I don't know how to write the action of the HTML form for this. Is it possible?

<form method="get" action="/publications [?] /titles ">
...
</form>

1 Answer 1

1

You can do like this:

In form action

action="/publications/pubTypeVal/yearVal/titles"

And server-side

@RequestMapping(value = "publications/{pubTypeVal}/{yearVal}/titles", method=RequestMethod.GET)

public String hello(@PathVariable("pubTypeVal") String pubTypeVal, @PathVariable("yearVal") String yearVal) {
// your implementation
}
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.