Actually, I'm confused as to why you'd ever use a scriptlet for setting the
content type in a JSP. In addition, the default content type is already
text/html, so setting it explicitly seems redundant. The output's actually
supposed to be XML, right? How 'bout something like:

<%@ page contentType="text/xml" %>
<%@ include file="mary.xml" %>

Quoting Julius Davies <[EMAIL PROTECTED]>:

> 
> Paul Caton,
> 
> The error message your getting is because of the fact that
> "response.setContentType()" doesn't return anything.  You used "<%= %>" in
> your jsp, which needs an Object or a primitive inbewteen those brackets. 
> Your jsp is then going to call toString() on that Object (or just blithely
> print the primitive) and make that part of your webpage.
> 
> Since "response.setContentType()" doesn't return anything, there is no Object
> to call toString() on, or no primitive to blithely print!
> 
> Try "<% %>" instead.  Omit the equals sign.  Don't forget to put a semicolon
> at the end.
> 
> yours,
> 
> Julius Davies, Programmer, CUCBC
> Email: [EMAIL PROTECTED], Ph: 604.730.6385
> 
> 
> Code inside "<%= %>" should never end with a semicolon.
> 
> Code inside "<% %>" needs semicolons at the end of each line.
> 
> 
> 
> > -----Original Message-----
> > From: Caton, Paul [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, December 03, 2002 10:49 AM
> > To: Tomcat Users List
> > Subject: RE: Not getting CSS with XML
> > 
> > 
> > Okay, I put the Java expression first so that now the JSP file looks
> > like this:
> > 
> >   <%= response.setContentType("text/html;charset=UTF-8") %><%@ include
> > file="mary.xml" %>
> > 
> > 
> > After I recompiled and tried to access the page I got this error
> > message:
> > 
> >   > org.apache.jasper.JasperException: Unable to compile class for
> > JSPNote: sun.tools.javac.Main has been deprecated.
> >   > An error occurred at line: 1 in the jsp file: /mary.jsp
> > 
> >   > Generated servlet error:
> >   >
> > /opt/local/jakarta-tomcat-4.0.6-LE-jdk14/work/Standalone/local
> > host/acsam
> > /mary$jsp.java:54: Incompatible type for method. Can't convert void to
> > java.lang.Object.
> >   > out.print( response.setContentType("text/html;charset=UTF-8") );
> > 
> > Paul.
> > 
> > 
> > **************************
> > 
> > Charlie wrote:
> > 
> > Make sure you have it *before* your include and before any 
> > whitespace in
> > your jsp.
> > 
> > --
> > To unsubscribe, e-mail:   
> > <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail: 
> > <mailto:[EMAIL PROTECTED]>
> > 
> > 
> 
> --
> To unsubscribe, e-mail:  
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
> 


-- 
Kris Schneider <mailto:[EMAIL PROTECTED]>
D.O.Tech       <http://www.dotech.com/>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to