This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Little Book of Impediments (e-book only) and have Tom Perry on-line!
See this thread for details.
Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Okay to write JSP tags in HTML?

 
Rob Wehrstein
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there anything wrong with writing JSP tags in psuedo-HTML? I've been writing tags in XHTML, but it would seem that XHTML could not be compliant with both an XHTML standard and the HTML5 standard.
 
Stefan Evans
Bartender
Posts: 1807
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you mean by pseudo HTML?
I normally go for XHTML compliant where it is reasonable and possible.
Remember that JSP gets evaluated and produces HTML. As long as the end result of evaluating the JSP matches your end use, then I would think that you are fine.

That can mean that your JSP might not be easily run through tools like lint without errors/warnings.
 
Rob Wehrstein
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
By psuedo HTML, I mean non-HTML-compliant HTML (for example: a JSP scriptlet). I thought about putting an HTML5 doctype in the JSP tag file, but it is not clear to me if this is compliant with the JSP tag specification.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65335
97
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The JSP engine could care less about anything that's not JSP markup. It could be the Declaration of Independence for all it cares.

The JSP is evaluated on the server before being sent to the client. What the browser sees is the resulting HTML, which should be valid HTML.

By the way -- DON'T use scriptlets! They're obsolete by 14 years. 14 years! You should be using the JSTL and EL.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65335
97
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
P.S. Read this article for a deeper understanding of how JSP works.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic