You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by - - <cp...@lycos.com> on 2002/01/05 21:21:19 UTC
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>
<title>test</title>
</head>
<body>
<form method="POST" action="<jsp:expression>request.getRequestURI()</jsp:expression>">
<input type="text" name="textbox" />
<input type="submit" />
</form>
<jsp:expression>request.getRequestURI()</jsp:expression><br/>
<jsp:expression>request.getParameter("textbox")</jsp:expression>
</body>
</html>
</jsp:root>
--
To unsubscribe: <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>
Re: ParseException in JSP document
Posted by "Craig R. McClanahan" <cr...@apache.org>.
On Sat, 5 Jan 2002, - - wrote:
> Date: Sat, 05 Jan 2002 12:21:19 -0800
> From: - - <cp...@lycos.com>
> Reply-To: Tomcat Users List <to...@jakarta.apache.org>,
> cpu3ghz@lycos.com
> To: tomcat-user@jakarta.apache.org
> 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>
> <title>test</title>
> </head>
> <body>
> <form method="POST" action="<jsp:expression>request.getRequestURI()</jsp:expression>">
> <input type="text" name="textbox" />
> <input type="submit" />
> </form>
> <jsp:expression>request.getRequestURI()</jsp:expression><br/>
> <jsp:expression>request.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>
<title>test</title>
<body>
<form method="POST" action="]]></jsp:text>
<jsp:expression>request.getRequestURI()</jsp-expression>
<jsp:text><![CDATA[[">
<input type="text" name="textbox">
<input type="submit">
</form>]]></jsp:text>
<jsp:expression>request.getRequestURI()</jsp:expression>
<jsp:text><![CDATA[[<br>]]></jsp:text>
<jsp:expression>request.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: <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>