• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Jeanne Boyarsky
  • Tim Cooke
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
Bartenders:

Using XML style JSP tags

 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Sheriff
Posts: 67735
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Sheriff
Posts: 67735
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Sheriff
Posts: 67735
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Time flies like an arrow. Fruit flies like a banana. Steve flies like a tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic