• Post Reply Bookmark Topic Watch Topic
  • New Topic

XMLNS in a JSP?  RSS feed

 
Jessica Sant
Sheriff
Posts: 4313
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A customer of mine is complaining that our App Server can't handle XML Name Space tags in a JSP page. BUT... I'm wondering if its even legal to have XMLNS in a JSP???
The code looks EXACTLY like a taglib tag... so our app server is interpretting it as such, and is throwing an exception 'cause there's no taglib tld defined. Now, if it is legal to have XMLNS in a JSP, I can write the code to work around it and what not... but I wanted to post over here to see if anyone had a valid argument as to why this should or should not be allowed.
(Why this guy wants to do it is a totally other question... I have no idea)
Thanks for any ideas!
[ January 28, 2002: Message edited by: Jessica (Bradley) Sant ]
 
Roy Ben Ami
Ranch Hand
Posts: 732
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
im pretty sure u can.
u just need to include a page directive at the start stating that the page will have text/xml content.
check this link
 
Jessica Sant
Sheriff
Posts: 4313
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Roy-
Thanks for the link, it started me down the right path - here's some more info that helps to answer my own question:
Writing JSPs in XML using JSP 1.2
as well as the JSP 1.2 specification -- Section 5.2 and 5.5
Basically the key sentence in the 'OnJava' article is this: "A JSP can now use either traditional JSP syntax or XML syntax within its source file. However, it is important to note that a JSP source file cannot intermix JSP syntax and XML syntax"
The file I was working with looked like this (it works fine as a .html, but fails as a .jsp):

BUT -- I believe the code needs to look like this:
 
Roy Ben Ami
Ranch Hand
Posts: 732
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
im glad it got u in the right track!
thanks for the info, it is actually quite an interesting and valuable topic to know
 
Guy Allard
Ranch Hand
Posts: 776
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jessica - I think that in some cases you should be able to get away without the CDATA sections (an ugly bit of XML) as well.
Also, as far as I recall, the XML with namespaces spec's tell you it is legal to have an 'xmlns' tag in any element anywhere in a wellformed (& valid?) document.
Regards, Guy
[ January 29, 2002: Message edited by: Guy Allard ]
 
Jessica Sant
Sheriff
Posts: 4313
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah.... so after thinking about this a bit more... it seems I was on the wrong track...
The problem is that a bit of code like this:

To the app server, it looks like a taglib... But now I'm leaning towards the fact that it is legal... and we've just gotta get the server to skip over it... hmmm....
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!