put your .shtml file in public_html folder and the servlet file in
"servlet" folder. give "code=your_servlet"
On Wed, 22 Dec 1999, Qiong Dai wrote:
> I am new to Java Servlet. Today I tried server side include. I wrote a
> servlet and a shtml file which include that servlet. After I built the
> servlet and loaded the shtml file, it kept on saying file not found(404
> error).
>
> I can run both the servlet and the shtml seperatedly(of course not able to
> display the content of the servlet output). I am wondering I am not
> correctly using the servlet aliase. I have a Java webserver. I put my shtml
> file under <server-root> and <server-root>/bin, and <server-root>/class, all
> of them give the same mesg. And I also try to modify the servlet aliase to
> set the aliase to /servlet/*.shtml instead of *.sthml , it still doesn't
> work.
>
> Can any gurus help me out?
>
> -----Original Message-----
> From: A mailing list for discussion about Sun Microsystem's Java Servlet
> API Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of
> Sherbahadur Khurshid
> Sent: Wednesday, December 22, 1999 10:09 AM
> To: [EMAIL PROTECTED]
> Subject: Please Help: JHTML -> JSP will this work?
>
>
> Hi,
>
> We based our servlets and JHTML pages on 3rd party libraries which
> rely on the ServletOutputStream. Now we need to move to the JavaWebServer
> 2.0
> and JSP and we've run into problems. Since JSP pages cannot obtain
> the ServletOuputStream (since they can't mix text and binary output)
> we wrote a wrapper class which extends ServletOutputStream but writes
> everything to a Writer that's passed in to the contructor. Since our
> 3rd party libraries pick up the ServletOutputStream from a container
> (and not directly from the response object) we dump our own
> wrapper class (WrapServletOutputStream) into the container
> - which works fine since WrapServletOutputStream extends
> ServletOutputStream.
> The 3rd party library classes write output to our WrapServletOutputStream
> which in turn writes the output to the Writer passed in to the constructor.
> There is only 1 problem - how to write bytes to the Writer ?
> Since Writers provide no means of writing bytes (and since I can't
> write the bytes directly to the ServletOutputStream - since it's not
> available) I overloaded the write(int) method so that it would
> store the bytes in a byte array an then keep trying to convert
> the byte array to a String (since the bytes really represent
> characters - since we are outputting html pages). As soon as it
> manages to convert the byte array to a String it resets the byte
> array. This approach seems to be working so far - but I'm wondering
> if it can get me into trouble later on. Can anyone see a problem
> with this approach (including efficiancy issues)?
>
> //Here's the WrapServletOutputStream class:
> public class WrapServletOutputStream extends ServletOutputStream
> {
> Writer charOut = null;
> private String lineSeparator;
>
> // Note: the byte array is of size 10 to accomodate multi-byte languages
> byte[] bytesOfAChar = new byte[10];
> int count = 1;
>
> /*
> * All output sent to this stream is written to the Writer passed
> * in to the constructor.
> */
> public WrapServletOutputStream(Writer out)
> {
> charOut = out;
> lineSeparator = System.getProperty("line.separator");
> }
>
> /* Here is the method which buffers the bytes into an array
> * until they are successfully converted to a String
> */
> public void write(int b)throws IOException
> {
> bytesOfAChar[count - 1] = (byte)b;
>
> String aChar = new String(bytesOfAChar,0,count);
> if(aChar.equals(""))
> count++;
> else
> {
> count = 1;
> charOut.write(aChar);
> charOut.flush();
> }
> }
>
> public void print(String s) throws IOException
> {
> charOut.write(s);
> charOut.flush();
> }
>
> public void print(char c) throws IOException
> {
> print(String.valueOf(c));
> }
>
> public void println(String s) throws IOException
> {
> print(s);
> newLine();
> }
>
> public void println(char c) throws IOException
> {
> print(c);
> newLine();
> }
>
> public void flush() throws IOException
> {
> charOut.flush();
> }
>
> public void close() throws IOException
> {
> charOut.close();
> }
>
> private void newLine() throws IOException
> {
> charOut.write(lineSeparator);
> }
>
> }
>
> ___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>
> ___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html