You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Wineman, Corey J." <Co...@anser.org> on 2001/11/09 23:40:06 UTC

JSP or XML syntax in Tomcat

Hello,

When I use the sessionTest.jsp script appended below, the xml format
"<jsp:scriptlet>" tags are being ignored and the resulting page prints
the contents of the scriptlet instead of "<h3>New Session</h3>" as I
expected. When I use the traditional  "<% javacode %>"  format to enter
scriptlet code, the page works as expected. 

I thought you could use traditional JSP syntax or XML syntax in Tomcat.
As long as you don't mix and match. Am I screwing up the syntax??

-Corey
----------------------------------------------

<jsp:directive.page session="true"/>

<html>
<head>
<title>Wineman JSP Page</title>
</head>
<body bgcolor=white>

<h1>Static content</h1>

<jsp:scriptlet>
    if( session.isNew() )
    {
        out.println( "<h3>New Session</h3>" );
    }
</jsp:scriptlet>


</body>
</html>

----------------------------------------------------
Here's the result page I get for the sessionTest.jsp page from above:

Static content
if( session.isNew() ) { out.println( "
New Session
" ); } 

--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>


Re: JSP or XML syntax in Tomcat

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Fri, 9 Nov 2001, Wineman, Corey J. wrote:

> Date: Fri, 9 Nov 2001 17:40:06 -0500
> From: "Wineman, Corey J." <Co...@anser.org>
> Reply-To: Tomcat Users List <to...@jakarta.apache.org>
> To: tomcat-user@jakarta.apache.org
> Subject: JSP or XML syntax in Tomcat
>
> Hello,
>
> When I use the sessionTest.jsp script appended below, the xml format
> "<jsp:scriptlet>" tags are being ignored and the resulting page prints
> the contents of the scriptlet instead of "<h3>New Session</h3>" as I
> expected. When I use the traditional  "<% javacode %>"  format to enter
> scriptlet code, the page works as expected.
>
> I thought you could use traditional JSP syntax or XML syntax in Tomcat.
> As long as you don't mix and match. Am I screwing up the syntax??
>
> -Corey
> ----------------------------------------------
>
> <jsp:directive.page session="true"/>
>
> <html>
> <head>
> <title>Wineman JSP Page</title>
> </head>
> <body bgcolor=white>
>
> <h1>Static content</h1>
>
> <jsp:scriptlet>
>     if( session.isNew() )
>     {
>         out.println( "<h3>New Session</h3>" );
>     }
> </jsp:scriptlet>
>
>
> </body>
> </html>
>
> ----------------------------------------------------

Is this your *entire* page?  If so, it's not valid XML syntax, so it's
being treated as being in the usual JSP syntax.

Chapter 5 of the JSP 1.2 spec covers all the rules about what your page
has to look like, including the fact that it must have a single outermost
<jsp:root> element that conforms to the spec's requirements, and that the
*entie* page must be specified in XML syntax.

The JSP spec is available from
<http://java.sun.com/products/jsp/download.html">.

Craig McClanahan



--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>