Possible to include JSP document (.jspx) fragments that aren't well formed?
Does anyone know if it's possible to include a .jspx fragment in another .jspx file? When I say .jspx fragment, I mean a file that is in XML format, but, may not be well formed. For example, I want to do something like the following. Currently, I'm receiving an error message like the following. I think what it's doing is assuming that the included files are .jsps instead of .jspxs. Previously, I tried naming the included files as .jspx, but, then, when I tried to compile it with Jasper, it wouldn't compile because it said the documents needed to be well formed. I need to see if I can figure out how to tell the jasper Ant task to only compile the page.jspx instead of all files ending with .jspx. Does anyone know if it's possible to include .jspx fragments? i.e. ones that aren't well formed, or, do they have to be well formed? If the later is true, using JSPXs makes includes a lot less useful... The goal here is to use XML syntax throughout and still have flexibility in using includes. J:\at\reservations\build.xml:204: org.apache.jasper.JasperException: file:J:/at/ reservations/build/header.jspxf(9,7) lt;jsp:outputgt; must not be used in standard syntax page.jspx jsp:root xmlns:jsp=http://java.sun.com/JSP/Page; version=2.0 jsp:directive.include file=../header.jspxf/ pHello, world!/p jsp:directive.include file=../footer.jspxf/ /jsp:root header.jspxf html title... body... footer.jspxf /body /html Jon - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Ampersand problem in JSP document
Hello everyone, I am using the following fragment in a JSP document (the XML variant of JSP pages): hrefmyurl?param1=value1amp;param2=value2/href The problem is, Tomcat sends this fragment to the browser as hrefmyurl?param1=value1param2=value2/href which causes an XML parsing exception on the client. Why is the amp; character being unescaped? Since JSP documents are intended for outputting XML, why is the output violating the XML specs? I cross-checked with the gt; and lt; characters - same problem. What can I do to prevent this? I am using Tomcat 5.0.27. Regards, Andreas - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Ampersand problem in JSP document
Hi, Does it happen if you have a proper JSP XML page, e.g. jsp:root xmlns:jsp=http://java.sun.com/JSP/Page; version=1.2 jsp:text![CDATA[html body center h1Hello World/h1 /center /body /html]]/jsp:text /jsp:root ? Yoav Shapira Millennium Research Informatics -Original Message- From: news [mailto:[EMAIL PROTECTED] On Behalf Of Andreas Schildbach Sent: Monday, August 23, 2004 3:31 PM To: [EMAIL PROTECTED] Subject: Ampersand problem in JSP document Hello everyone, I am using the following fragment in a JSP document (the XML variant of JSP pages): hrefmyurl?param1=value1amp;param2=value2/href The problem is, Tomcat sends this fragment to the browser as hrefmyurl?param1=value1param2=value2/href which causes an XML parsing exception on the client. Why is the amp; character being unescaped? Since JSP documents are intended for outputting XML, why is the output violating the XML specs? I cross-checked with the gt; and lt; characters - same problem. What can I do to prevent this? I am using Tomcat 5.0.27. Regards, Andreas - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Ampersand problem in JSP document
Try to append amp to the amp; fragment it should end like this amp;amp; and the output would be amp; Andreas Schildbach escribió: Hello everyone, I am using the following fragment in a JSP document (the XML variant of JSP pages): hrefmyurl?param1=value1amp;param2=value2/href The problem is, Tomcat sends this fragment to the browser as hrefmyurl?param1=value1param2=value2/href which causes an XML parsing exception on the client. Why is the amp; character being unescaped? Since JSP documents are intended for outputting XML, why is the output violating the XML specs? I cross-checked with the gt; and lt; characters - same problem. What can I do to prevent this? I am using Tomcat 5.0.27. Regards, Andreas - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Ampersand problem in JSP document
Shapira, Yoav wrote: Does it happen if you have a proper JSP XML page, e.g. jsp:root xmlns:jsp=http://java.sun.com/JSP/Page; version=1.2 jsp:text![CDATA[html body center h1Hello World/h1 /center /body /html]]/jsp:text /jsp:root It happens with the following small jspx: jsp:root version=2.0 xmlns:jsp=http://java.sun.com/JSP/Page; hrefmyurl?param1=value1amp;param2=value2/href /jsp:root - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Ampersand problem in JSP document
John Villar wrote: Try to append amp to the amp; fragment it should end like this amp;amp; and the output would be amp; It is my understanding that if an XML document is serialized to an output stream, characters like , and are represented by their entities amp; gt; lt so an XML parser can parse the document again. Otherwise I would be ending up writing amp;amp;amp;amp;amp; somewhen and have to count the number of transformations in advance )-: Regards, Andreas - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Ampersand problem in JSP document
LOL that's true. i think yoav gave you the right solution try embedding your xml processor offending fragment into a jsp:text![CDATA[ ]]/jsp:text that should do the work It is my understanding that if an XML document is serialized to an output stream, characters like , and are represented by their entities amp; gt; lt so an XML parser can parse the document again. Otherwise I would be ending up writing amp;amp;amp;amp;amp; somewhen and have to count the number of transformations in advance )-: - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Ampersand problem in JSP document
Hi, (jumping in late) Have you tried: jsp:directive.page contentType=text/xml / and perhaps: jsp:output doctype-root-element=html doctype-public=-//W3C//DTD XHTML 1.0 Transitional//EN doctype-system=http://www.w3c.org/TR/xhtml1/DTD/xhtml1-transitional.dtd/ best, -Rob Andreas Schildbach wrote: Shapira, Yoav wrote: Does it happen if you have a proper JSP XML page, e.g. jsp:root xmlns:jsp=http://java.sun.com/JSP/Page; version=1.2 jsp:text![CDATA[html body center h1Hello World/h1 /center /body /html]]/jsp:text /jsp:root It happens with the following small jspx: jsp:root version=2.0 xmlns:jsp=http://java.sun.com/JSP/Page; hrefmyurl?param1=value1amp;param2=value2/href /jsp:root - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
XML format JSP document, and prelude problem
Hi, I'm trying to create jsp documents (ie. all syntax written in valid xml). In order to do this documents must be contained within a jsp:root element, e.g. jsp:root version=2.0 !-- Rest of doc -- /jsp:root For standalone pages this works fine. My problem is that I am also using a prelude file specified in the web.xml to do some common tasks for each page. include-prelude/template/prelude.jspf/include-prelude include-coda/template/coda.jspf/include-coda Case 1: prelude.jspf is not a valid jsp document (ie. it is a valid jsp page, but not a xml doc) Then when my main page (a valid jsp docuemnt) loads I get a jsp compile exception because the jsp:root element must be the first element in a jsp document. It is not in this case because prelude.jspf has been inserted at the start of the file. Case 2: prelude.jspf is a valid jsp doc. (i.e. contained within a jsp:root /jsp:root element). Again this then means that my main page cannot be a jsp document because the jsp:root element is already terminated in the prelude.jspf file. I get the same exception as case 1. The second case here, is that I don't try to include my main jsp page within jsp:root elements. This however simply means that my main page is not validated as an xml document, and I can include non standard elements (e.g. hr instead of hr/) Case 3: prelude.jspf incudes the jsp:root start element but does not close the element. (This would be done in coda.jspf) This results in a jsp exception because prelude.jspf is not a valid xml doc. Until I close the jsp:root element in prelude.jspf this always fails. Is it possible to generate valid jsp documents when using preludes and codas? Am I doing something silly? Keith - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
JSP Document
Tomcat 4.1.27 on Win32 given ?xml version=1.0? jsp:root xmlns=http://java.sun.com/JSP/Page version=1.2 h1Cat amp; Dog/h1 /jsp:root Generates h1Cat Dog/h1 Can anybody confirm that this is correct behaviour? I can sort of see that it makes sense (JSP is for generating any character stream...) but it does make a JSP Document look very odd. Also, is it correct that jsp:directive.include file=some jsp/ should not allow namespaces to be redelcared? Sorry if both these things are clear in the spec. Ive read it but dont feel much wiser. Thanks Sam - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JSP Document
On Sat, Sep 06, 2003 at 06:10:26PM +0100, Sam Hough wrote: : : Tomcat 4.1.27 on Win32 given : : ?xml version=1.0? : jsp:root xmlns=http://java.sun.com/JSP/Page version=1.2 : h1Cat amp; Dog/h1 : /jsp:root : : Generates : : h1Cat Dog/h1 : : Can anybody confirm that this is correct behaviour? Why did the amp; entity get changed to a plain character? That's not kosher with HTML-4.01 specs. -- Eugene Lee http://www.coxar.pwp.blueyonder.co.uk/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JSP Document
Actually I think it is, at least according to the HTML 4.01 Transitional. These are character entities and must be entered with the 'escape' character. These can assume a number or a character after the escape character. The only character which in some browsers is not rendered properly is the TM (trade mark) symbol, which doesn't have an 'escape' character representation, but only a numeric one (153;). In this scape the form: supsmallTM/small/sup is used. I can confirm also that the amp; is XHTML 1.0 Transitional valid. Hope this will help, Marco - Original Message - From: Eugene Lee [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, September 06, 2003 6:23 PM Subject: Re: JSP Document On Sat, Sep 06, 2003 at 06:10:26PM +0100, Sam Hough wrote: : : Tomcat 4.1.27 on Win32 given : : ?xml version=1.0? : jsp:root xmlns=http://java.sun.com/JSP/Page version=1.2 : h1Cat amp; Dog/h1 : /jsp:root : : Generates : : h1Cat Dog/h1 : : Can anybody confirm that this is correct behaviour? Why did the amp; entity get changed to a plain character? That's not kosher with HTML-4.01 specs. -- Eugene Lee http://www.coxar.pwp.blueyonder.co.uk/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JSP Document
Can still produce valid XHTML by doing Cat amp;amp; Dog But double escaping is not very friendly. I like the fact that JSP lets you generate any format HTML, XHTML, plain text and being able to write templates in XML but this is a bit ugly. Just want to check that it is meant to be this way before I learn how it all works. Seems like they are sticking to JSP generates anything since the JSP 2.0 syntax ${some.thing} doesnt escape XML. I think Ive spent too much time with XSL ;) - Original Message - From: Eugene Lee [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, September 06, 2003 6:23 PM Subject: Re: JSP Document On Sat, Sep 06, 2003 at 06:10:26PM +0100, Sam Hough wrote: : : Tomcat 4.1.27 on Win32 given : : ?xml version=1.0? : jsp:root xmlns=http://java.sun.com/JSP/Page version=1.2 : h1Cat amp; Dog/h1 : /jsp:root : : Generates : : h1Cat Dog/h1 : : Can anybody confirm that this is correct behaviour? Why did the amp; entity get changed to a plain character? That's not kosher with HTML-4.01 specs. -- Eugene Lee http://www.coxar.pwp.blueyonder.co.uk/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: JSP Document
Other solution: ... Cat ![CDATA[amp;]] Dog /... Especially handy when using large portions of Normal text -Original Message- From: Sam Hough [mailto:[EMAIL PROTECTED] Sent: zaterdag 6 september 2003 19:40 To: Tomcat Users List Can still produce valid XHTML by doing Cat amp;amp; Dog But double escaping is not very friendly. I like the fact that JSP lets you generate any format HTML, XHTML, plain text and being able to write templates in XML but this is a bit ugly. Just want to check that it is meant to be this way before I learn how it all works. Seems like they are sticking to JSP generates anything since the JSP 2.0 syntax ${some.thing} doesnt escape XML. I think Ive spent too much time with XSL ;) - Original Message - From: Eugene Lee [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, September 06, 2003 6:23 PM Subject: Re: JSP Document On Sat, Sep 06, 2003 at 06:10:26PM +0100, Sam Hough wrote: : : Tomcat 4.1.27 on Win32 given : : ?xml version=1.0? : jsp:root xmlns=http://java.sun.com/JSP/Page version=1.2 : h1Cat amp; Dog/h1 : /jsp:root : : Generates : : h1Cat Dog/h1 : : Can anybody confirm that this is correct behaviour? Why did the amp; entity get changed to a plain character? That's not kosher with HTML-4.01 specs. -- Eugene Lee http://www.coxar.pwp.blueyonder.co.uk/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JSP Document
My reading of the JSP spec says that Tomcat is correct here. If you need to preserve the escape, then follow Sjoerd's suggestion. Sam Hough [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Tomcat 4.1.27 on Win32 given ?xml version=1.0? jsp:root xmlns=http://java.sun.com/JSP/Page version=1.2 h1Cat amp; Dog/h1 /jsp:root Generates h1Cat Dog/h1 Can anybody confirm that this is correct behaviour? I can sort of see that it makes sense (JSP is for generating any character stream...) but it does make a JSP Document look very odd. Also, is it correct that jsp:directive.include file=some jsp/ should not allow namespaces to be redelcared? Sorry if both these things are clear in the spec. Ive read it but dont feel much wiser. Thanks Sam - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
ParseException in JSP document
I am making a JSP document and want to have jsp:expression tag as an attribute value in another tag. I got an error like org.apache.jasper.compiler.ParseException: /thispage.jsp(8,30) The value of attribute action must not contain the '' character. The following is thispage.jsp. (Tomcat 4.0.1, Linux 2.4.2-2 (Red Hat 7.1 2.96-79)) I would like to go to the same page after clicking a submit button, but I don't like to hard code. The problem looks like that jsp:expression has not been evaluated before it is parsed. Does anybody know the right way? Thank you. jsp:root xmlns:jsp=http://java.sun.com/JSP/Page; version=1.2 html head titletest/title /head body form method=POST action=jsp:expressionrequest.getRequestURI()/jsp:expression input type=text name=textbox / input type=submit / /form jsp:expressionrequest.getRequestURI()/jsp:expressionbr/ jsp:expressionrequest.getParameter(textbox)/jsp:expression /body /html /jsp:root -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
Re: ParseException in JSP document
On Sat, 5 Jan 2002, - - wrote: Date: Sat, 05 Jan 2002 12:21:19 -0800 From: - - [EMAIL PROTECTED] Reply-To: Tomcat Users List [EMAIL PROTECTED], [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: ParseException in JSP document I am making a JSP document and want to have jsp:expression tag as an attribute value in another tag. I got an error like org.apache.jasper.compiler.ParseException: /thispage.jsp(8,30) The value of attribute action must not contain the '' character. The following is thispage.jsp. (Tomcat 4.0.1, Linux 2.4.2-2 (Red Hat 7.1 2.96-79)) I would like to go to the same page after clicking a submit button, but I don't like to hard code. The problem looks like that jsp:expression has not been evaluated before it is parsed. Does anybody know the right way? Thank you. jsp:root xmlns:jsp=http://java.sun.com/JSP/Page; version=1.2 html head titletest/title /head body form method=POST action=jsp:expressionrequest.getRequestURI()/jsp:expression input type=text name=textbox / input type=submit / /form jsp:expressionrequest.getRequestURI()/jsp:expressionbr/ jsp:expressionrequest.getParameter(textbox)/jsp:expression /body /html /jsp:root The basic issue is that you must conform to all XML syntax requirements in a JSP document. Therefore, you will need to encapsulate the HTML parts of this page in jsp:text elements, something like this (not tested, so there might still be problems): jsp:root xmlns:jsp=http://java.sun.com/JSP/Page; version=1.2 jsp:text![CDATA[[ html head titletest/title body form method=POST action=]]/jsp:text jsp:expressionrequest.getRequestURI()/jsp-expression jsp:text![CDATA[[ input type=text name=textbox input type=submit /form]]/jsp:text jsp:expressionrequest.getRequestURI()/jsp:expression jsp:text![CDATA[[br]]/jsp:text jsp:expressionrequest.getParameter(textbox)/jsp:expression jsp:text![CDATA[[/body /html]]/jsp:text /jsp:root You are going to find that it's not much fun to write the XML syntax of pages like this by hand. It's much more appropriate for machine-generated page source, such as that produced by an IDE that understands how to do it right. Craig -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
Re: ParseException in JSP document
I learned that template data should be preceded by jsp:text![CDATA[ and followed by ]]/jsp:text and it works as expected. Thank you. -- On Sat, 5 Jan 2002 12:34:39 Craig R. McClanahan wrote: The basic issue is that you must conform to all XML syntax requirements in a JSP document. Therefore, you will need to encapsulate the HTML parts of this page in jsp:text elements, something like this (not tested, so there might still be problems): jsp:root xmlns:jsp=http://java.sun.com/JSP/Page; version=1.2 jsp:text[CDATA[[ html head titletest/title body form method=POST action=]]/jsp:text jsp:expressionrequest.getRequestURI()/jsp-expression jsp:text[CDATA[[ input type=text name=textbox input type=submit /form]]/jsp:text jsp:expressionrequest.getRequestURI()/jsp:expression jsp:text[CDATA[[br]]/jsp:text jsp:expressionrequest.getParameter(textbox)/jsp:expression jsp:text -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
Tomcat Newbie has problem with Apache connector and JSP: document contains no data
Gentle Folks: After spending a ridiculously long time in a frustrating and humiliating attempt to get the following configuration working on a Redhat 7.1 Linux box: - Apache 1.3.19 DSO - mod_webapps - Jakarta-Tomcat 4.0b5 I have finally gotten Tomcat to serve static content with the Default servlet (Of course, I could do that with Apache by itself) but JSP's are not working right! My problem is with JSP pages served through the Apache connector. Everything works fine through port 8080 when served by Catalina; I can't get it to work through Apache and port 80. Here's what happens: An attempt to request a .jsp page causes the request to be mapped to the JSP servlet, and the right .jsp file is compiled. (I can find the class files in the work directory under the virtual host I'm trying to access the pages from) - but no content is returned by the web server! Apache gives the dialog: Document contained no data I have turned up debugging levels and can't find a single problem or issue in a log file which would hint at the nature of the problem. A search of the tomcat-users archive and the JGuru stuff has been no help. Has anyone seen this problem or have any ideas on how to lick it?? By the way, the JSP's in question are: - the Tomcat examples, which work fine from port 8080, and - an app we wrote which runs fine under JServ/GnuJSP Regards, Mark -- Mark Dzmura Digital Mission LLC
jsp document root
Sorry to ask such a trivial question to all of you but how can I put my .jsp files outside of the ROOT Directory of tomcat in e.g. in apache\htdocs ? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: jsp document root
How is it possible to create something without a context @ the *very* top root level so you can say: / maps to things in directory /myapp Thanks. - Jon "Simon Oldeboershuis, outermedia" wrote: Regis Muller schrieb: Sorry to ask such a trivial question to all of you but how can I put my .jsp files outside of the ROOT Directory of tomcat in e.g. in apache\htdocs ? you have to configure the position of the directory in the config file: tomcat/conf/server.xml there should be some example. Context path="/myapp" docBase="apache\htdocs\myappdocbase" crossContext="false" debug="0" reloadable="true" /Context The docbase should probably given as an absolute path. simon - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]