• Post Reply Bookmark Topic Watch Topic
  • New Topic

Using XML style JSP tags

 
Gezza Hall
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all. I want to substitute my jsp scriptlets and expressions for the xml style equivalent, but cannot get them to work.

For example:



would become...



but this doesn't work, so I tried:



which does...but this defeats the object - I want to rid my page of all instances of <% and %>

What am I doing wrong please?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The JSP "document syntax" is primarily intended to be used for machine-generated pages rather than hand-written pages.

If you want to rid your pages of scriptlets (a worthy goal). you'd be better off doing so by refactoring to be sure that all processing is handled by the page's servlet controller and the use of the JSTL and custom tags on the JSP itself.
 
Gezza Hall
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Bear,

this is kind of what I suspected, that the xml tag versions are intended for xslt translators and the like?

In which case I have a problem, I mean even my taglib declarations have the same symbols in them, ie <%@ taglib uri="/tags/struts-bean" prefix="bean" %>
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why do you want to get around something like taglib declarations?
 
Gezza Hall
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
An odd reason - we are using a content repository which doesn't recognise the <% tags. So I was trying to find a way of making everything on the pages xml compliant. When it imports the files it strips them all out.

But I'm starting to think - why should I? I should be able to program my jsp's however I like! The content repository will have to get around it.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I agree. You were trying to solve the problem at the wrong point.

However, bear in mind that writing your pages without Java scriplets is a worthy goal in and of itself.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!