• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Using XML style JSP tags

 
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?
 
Marshal
Posts: 67451
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • 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
Marshal
Posts: 67451
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • 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
Marshal
Posts: 67451
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • 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.
 
Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic