You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by James Smith <jk...@email.arizona.edu> on 2001/09/10 17:24:36 UTC
XML version of JSP question
Hello. I've looked through the archives, but I haven't seen a solution to
this problem. I'm using XSLT to create a JSP page and to get that to work,
I am using Tomcat 4.0 Release Candidate 1 (on a Windows 2000 box, only
running Tomcat--no Apache nor IIS). But the simple tests of the XML-version
of JSP I'm using seems to process all the scriplets first, and then the
HTML. For instance, this code in regular JSP format returns the right
results:
<%
int a = 15;
%>
<html><head><title>hi there</title></head>
<body>
Hi. My variable is: <%=a%>. <br />
<% out.println("I like mongeese!<br />"); %>
</body></html>
******the results*******************
Hi. My variable is: 15.
I like mongeese!
**********************************
While the XML-style, which looks like this:
<?xml version="1.0" ?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
version="1.2">
<jsp:scriptlet>
int a = 15;
</jsp:scriptlet>
<html><head><title>test</title></head>
<body>
Hi everyone! The number is: <jsp:expression>a</jsp:expression>.<br />
<jsp:scriptlet>
out.println("I like the mongoose!<br />");
</jsp:scriptlet>
</body></html>
</jsp:root>
Returns this:
****************************
15
I like the mongoose! Hi everyone! The number is: .
****************************************
I attempted to add a namespace to my HTML tags in the XML version; however,
when I tried to run that version, I received an exception saying that the
URI I was using (http://www.w3.org/1999/xhtml) was not resolvable:
***********************
org.apache.jasper.JasperException: This absolute uri
(http://www.w3.org/1999/xhtml) cannot be resolved in either web.xml or the
jar files deployed with this application
************************
So my questions are:
1) How do I get Jasper to resolve the namespace URI? (I'm assuming that I
have to stick a line in web.xml?)
2) How do I get Tomcat to render XML-style JSP in the right order, just as
regular style JSP renders?
Thank all of you very much for your assistance in these questions.
James Smith
Re: XML version of JSP question
Posted by James Smith <jk...@email.arizona.edu>.
Excellent. It worked. Thank you very much.
James Smith
----- Original Message -----
From: "Greg Trasuk" <st...@on.aibn.com>
To: <to...@jakarta.apache.org>
Sent: Monday, September 10, 2001 2:28 PM
Subject: RE: XML version of JSP question
> Hi James:
>
> It appears that you need to put your text into CDATA sections inside
> <jsp:text> tags. The following seems to work:
>
> <?xml version="1.0" ?>
> <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
> version="1.2">
> <jsp:scriptlet>
> int a = 15;
> </jsp:scriptlet>
> <jsp:text><![CDATA[<html><head><title>test</title></head>
> <body>
> Hi everyone! The number is:]]>
> </jsp:text> <jsp:expression>a</jsp:expression>
> <jsp:text>.<br /></jsp:text>
> <jsp:scriptlet>
> out.println("I like the mongoose!<br />");
> </jsp:scriptlet>
> <jsp:text><![CDATA[</body></html>]]></jsp:text>
> </jsp:root>
>
> Greg Trasuk, President
> StratusCom Manufacturing Systems Inc. - We use information technology to
> solve business problems on your plant floor.
> http://stratuscom.ca
>
> > -----Original Message-----
> > From: James Smith [mailto:jksmith@email.arizona.edu]
> > Sent: Monday, September 10, 2001 11:25 AM
> > To: tomcat-user@jakarta.apache.org
> > Subject: XML version of JSP question
> >
> >
> > Hello. I've looked through the archives, but I haven't seen
> > a solution to
> > this problem. I'm using XSLT to create a JSP page and to get
> > that to work,
> > I am using Tomcat 4.0 Release Candidate 1 (on a Windows 2000 box, only
> > running Tomcat--no Apache nor IIS). But the simple tests of
> > the XML-version
> > of JSP I'm using seems to process all the scriplets first,
> > and then the
> > HTML. For instance, this code in regular JSP format returns the right
> > results:
> >
> > <%
> > int a = 15;
> > %>
> > <html><head><title>hi there</title></head>
> > <body>
> > Hi. My variable is: <%=a%>. <br />
> > <% out.println("I like mongeese!<br />"); %>
> > </body></html>
> >
> > ******the results*******************
> >
> > Hi. My variable is: 15.
> > I like mongeese!
> >
> > **********************************
> >
> > While the XML-style, which looks like this:
> >
> > <?xml version="1.0" ?>
> > <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
> > version="1.2">
> > <jsp:scriptlet>
> > int a = 15;
> > </jsp:scriptlet>
> > <html><head><title>test</title></head>
> > <body>
> > Hi everyone! The number is:
> > <jsp:expression>a</jsp:expression>.<br />
> > <jsp:scriptlet>
> > out.println("I like the mongoose!<br />");
> > </jsp:scriptlet>
> > </body></html>
> > </jsp:root>
> >
> > Returns this:
> > ****************************
> > 15
> >
> >
> >
> > I like the mongoose! Hi everyone! The number is: .
> > ****************************************
> >
> > I attempted to add a namespace to my HTML tags in the XML
> > version; however,
> > when I tried to run that version, I received an exception
> > saying that the
> > URI I was using (http://www.w3.org/1999/xhtml) was not resolvable:
> >
> > ***********************
> >
> > org.apache.jasper.JasperException: This absolute uri
> > (http://www.w3.org/1999/xhtml) cannot be resolved in either
> > web.xml or the
> > jar files deployed with this application
> >
> > ************************
> >
> > So my questions are:
> > 1) How do I get Jasper to resolve the namespace URI? (I'm
> > assuming that I
> > have to stick a line in web.xml?)
> > 2) How do I get Tomcat to render XML-style JSP in the right
> > order, just as
> > regular style JSP renders?
> >
> > Thank all of you very much for your assistance in these questions.
> >
> > James Smith
> >
>
RE: XML version of JSP question
Posted by Greg Trasuk <st...@on.aibn.com>.
Hi James:
It appears that you need to put your text into CDATA sections inside
<jsp:text> tags. The following seems to work:
<?xml version="1.0" ?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
version="1.2">
<jsp:scriptlet>
int a = 15;
</jsp:scriptlet>
<jsp:text><![CDATA[<html><head><title>test</title></head>
<body>
Hi everyone! The number is:]]>
</jsp:text> <jsp:expression>a</jsp:expression>
<jsp:text>.<br /></jsp:text>
<jsp:scriptlet>
out.println("I like the mongoose!<br />");
</jsp:scriptlet>
<jsp:text><![CDATA[</body></html>]]></jsp:text>
</jsp:root>
Greg Trasuk, President
StratusCom Manufacturing Systems Inc. - We use information technology to
solve business problems on your plant floor.
http://stratuscom.ca
> -----Original Message-----
> From: James Smith [mailto:jksmith@email.arizona.edu]
> Sent: Monday, September 10, 2001 11:25 AM
> To: tomcat-user@jakarta.apache.org
> Subject: XML version of JSP question
>
>
> Hello. I've looked through the archives, but I haven't seen
> a solution to
> this problem. I'm using XSLT to create a JSP page and to get
> that to work,
> I am using Tomcat 4.0 Release Candidate 1 (on a Windows 2000 box, only
> running Tomcat--no Apache nor IIS). But the simple tests of
> the XML-version
> of JSP I'm using seems to process all the scriplets first,
> and then the
> HTML. For instance, this code in regular JSP format returns the right
> results:
>
> <%
> int a = 15;
> %>
> <html><head><title>hi there</title></head>
> <body>
> Hi. My variable is: <%=a%>. <br />
> <% out.println("I like mongeese!<br />"); %>
> </body></html>
>
> ******the results*******************
>
> Hi. My variable is: 15.
> I like mongeese!
>
> **********************************
>
> While the XML-style, which looks like this:
>
> <?xml version="1.0" ?>
> <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
> version="1.2">
> <jsp:scriptlet>
> int a = 15;
> </jsp:scriptlet>
> <html><head><title>test</title></head>
> <body>
> Hi everyone! The number is:
> <jsp:expression>a</jsp:expression>.<br />
> <jsp:scriptlet>
> out.println("I like the mongoose!<br />");
> </jsp:scriptlet>
> </body></html>
> </jsp:root>
>
> Returns this:
> ****************************
> 15
>
>
>
> I like the mongoose! Hi everyone! The number is: .
> ****************************************
>
> I attempted to add a namespace to my HTML tags in the XML
> version; however,
> when I tried to run that version, I received an exception
> saying that the
> URI I was using (http://www.w3.org/1999/xhtml) was not resolvable:
>
> ***********************
>
> org.apache.jasper.JasperException: This absolute uri
> (http://www.w3.org/1999/xhtml) cannot be resolved in either
> web.xml or the
> jar files deployed with this application
>
> ************************
>
> So my questions are:
> 1) How do I get Jasper to resolve the namespace URI? (I'm
> assuming that I
> have to stick a line in web.xml?)
> 2) How do I get Tomcat to render XML-style JSP in the right
> order, just as
> regular style JSP renders?
>
> Thank all of you very much for your assistance in these questions.
>
> James Smith
>