mardi 24 mars 2015

How to have initiate a form that is on all pages?

I need to have a search box on all pages of my website. I know, to have a form I need to initiate it like following method;however, it is useful if user gets to "/search" address, how can I initiate a form that is in all pages like searchbox of tripadvisor that is located on all pages ? should I call the method all the time?


Sample initialize method



@RequestMapping(value = "/search", method = RequestMethod.GET)
public String initCreationForm(Model model) {
if (!model.containsAttribute(BINDING_RESULT_NAME)) {
model.addAttribute(ATTRIBUTE_NAME, new Search());
}
return "search";
}


Current form


My current form looks like following:



<form:form modelAttribute="search" role="form" method="GET">
.....
</form:form>

Aucun commentaire:

Enregistrer un commentaire