Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Struts 2 »

Re: How to reduce redundant form code in JSPs?

uni

2007-01-03

Replies:

Hi,

> There are lots of ways :-) You didn't list what technologies you're
> using, but here are some possibilities:
>
> - if you're using JSP 2.0, you could create a tag file to represent each
> type of form field and encapsulate the common markup there
>
> - you could write a JSP Custom Tag to emit the markup (though I don't
> recommend that, since altering the markup then involves recompiling)
>
> - if you're using Tiles, you could create a tile definition to
> encapsulate the common markup
>
> - if you're using Struts 2, you could create a Struts 2 component / tag
> to handle this
>
> - you could use a plain ol' jsp:include tag or @include directive
Im using Struts 1 without tiles. I took a look at all the options and finally
created a JSP2 tag file - this approach is great because you don't need to
recompile code in case of changes and the designer can change the layout by
only modifying the tag file (basically a JSP fragment), without having to
modify code.

Thanks for your help,

Thorsten


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)

©2008 junlu.com - Jax Systems, LLC, U.S.A.