isn't that coupling presentation with code?
[My Blog]
All roads lead to JavaRanch
Billy Vandory wrote:Is JSTL in or out?
And is it common practice to have JSTL generate HTML?
(I'm reading Head First Servlets and JSP and it shows code for a JSTL that generates HTML.
Just seems odd to me, to have a Java class generate HTML code - isn't that coupling presentation with code?)
shows code for a JSTL
Bear Bibeault wrote:
Billy Vandory wrote:Is JSTL in or out?
Very, very in.
And is it common practice to have JSTL generate HTML?
The whole purpose of a JSP is to generate HTML.
(I'm reading Head First Servlets and JSP and it shows code for a JSTL that generates HTML.
Just seems odd to me, to have a Java class generate HTML code - isn't that coupling presentation with code?)
The fact that the tags are written in Java is moot. From the point of view of the JSP they are a black box whose implementation is irrelevant.
shows code for a JSTL
Huh? What do you mean by "shows code for a JSTL"? That doesn't make much sense. Are you (very incorrectly) using the term JSTL to mean custom tags? (JSTL is a specific standardized library of custom tags.)
Billy Vandory wrote:So as far as a design approach to a login screen, would creating a Custom Tag Handler to generate the Login Dialog Box with the appropriate fields, and using that custom tag within a JSP be an appropriate design?
Bear Bibeault wrote:
Billy Vandory wrote:So as far as a design approach to a login screen, would creating a Custom Tag Handler to generate the Login Dialog Box with the appropriate fields, and using that custom tag within a JSP be an appropriate design?
Why implement it as a tag at all? Is it something that will be re-used on many pages?
If it turns out that it is appropriate to implement as a tag, and if there's HTML involved, I'll first try to implement it as a tag file. Or even a hybrid of a tag file with a backing bean to help it out if need be. As I said above, I only resort to building HTML in Java code when it's absolutely necessary.
But first, figure out if a tag is called for in the first place.
Billy Vandory wrote:Well the web site I'm building (as I'm learning) I envision to have login/password field in the top right corner in many pages.
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime. |