0

I have a jsp form that I want to re-use in several pages of my application. What is the best practice about that? Do I have to duplicate the form code in each pages? Can I use an include tag or something?

Julien
  • 2,616
  • 1
  • 30
  • 43

2 Answers2

1

there is no need to use spring in what you want to do, is very simple and maybe you can resolve setting parameters on the main jsp and gettin those parameters in the included file, check this out, someone asked before about jsp file include and compilation

Include another JSP file

Community
  • 1
  • 1
Franco
  • 7,385
  • 3
  • 27
  • 22
  • Worked perfectly without doing anything with the parameters. I Just cut/past the whole tag in another file and called it with . Thanks! – Julien Apr 08 '13 at 12:25
  • yeah, sometimes parameters could be useful to dinamically include other files, in a static context like yours, there is no need of then – Franco Apr 08 '13 at 12:43
  • I do have parameters ! And it worked anymay. In fact I have included a form that uses a mapped parameter into another jsp. – Julien Apr 10 '13 at 11:43
0

If they share common then use tiles with spring . http://www.springbyexample.org/examples/simple-tiles-spring-mvc-webapp.html

abishkar bhattarai
  • 7,371
  • 8
  • 49
  • 66