• 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: 1826
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
Posts: 65664
129
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
Posts: 65664
129
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.
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!