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>
Cameron Hudson
  • 3,190
  • 1
  • 26
  • 38

1 Answers1

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
}
Muhammad Waqas
  • 367
  • 3
  • 13
Anurag
  • 44
  • 6