I sometimes put HTML in my Java helper classes in my Tomcat 4.1.27 container.
I read this is not considered good practice to have HTML in a Java class. Please advise is it because of a maintenance issue or why?
If I dont put HTML in Java classes then I would have to for example put Java for loops in JSP Scriptlets to output HTML stuff such as links.
I have restrictions where I cant upgrade or use JSTL at this time. [ December 19, 2007: Message edited by: Ed Carrington ]
Joined: Nov 03, 2007
The main idea is to separate the view from any business logic. It will be easier to reuse the code, and better for maintenance. It won't be easy to read html written in java code that's all. Scriplets in JSP might be a bit easier to use, but the same problem is encountered.
Don't know what restriction you could have for not using JSTL, but using EL is much better for you to distinguish between html and java code.
Originally posted by Ed Carrington: I have restrictions where I cant upgrade or use JSTL at this time.
My condolences. Welcome to 2001.
Tomcat 4 is two revs out-of-date at this time. Surely your pointy-haired boss can be convinced to upgrade to at least Tomcat 5?
In any case, almost every tutorial on JSP will show you how to use scriptlets on the pages. Using scriptlets is a much better tactic than putting HTML in Java. At least it's a step towards using JSTL/EL on the pages, [ December 19, 2007: Message edited by: Bear Bibeault ]