You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Juan Carlos Fernández Galante <ju...@upcnet.es> on 2001/11/27 12:07:07 UTC

How can I execute a jsp from Catalina?

Hi,

I want to execute a jsp from, but I don´t know whats are the steps.




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: How can I execute a jsp from Catalina?

Posted by Tor Magne Hougen <95...@mobilpost.com>.
OK, there are a lot of help and example in the Web Applications that follows
with tomcat:

http://localhost:8080/examples/

If you cant find soulutions there. Sorry i cant help you

Regards.
Tor Magne

Juan Carlos Fernández Galante wrote:

> Thanks, for your help, but I want to make a Web Server, and I want to make
> use of Catalina and Jasper Api.
>
> I had achieved execute a servlet with the next code:
> ---------------------------------------------
>  public Prueba1()
>   {
>   //Set the servlet Name and the servlet Class
>   StandardWrapper theStandardWrapper = new StandardWrapper();
>   theStandardWrapper.setServletName("servlet.OCSPServlet");
>   theStandardWrapper.setServletClass("servlet.OCSPServlet");
>
>   try
>   {
>    //Sets the loader
>    WebappLoader theWebappLoader = new WebappLoader();
>    theStandardWrapper.setLoader(theWebappLoader);
>    Servlet theServlet = theStandardWrapper.allocate();
>
>    //Generate the request
>    HttpRequestBase theHttpRequestBase = new HttpRequestBase();
>    String theRequest = createRequest();
>    ByteArrayInputStream theInputStream = new
> ByteArrayInputStream(theRequest.getBytes());
>
>    theHttpRequestBase.setContentType("text/plain");
>    theHttpRequestBase.setContentLength(theRequest.length());
>
>    theHttpRequestBase.setStream(theInputStream);
>
>    //Generate the response
>    HttpResponseBase theHttpResponseBase = new HttpResponseBase();
>    ByteArrayOutputStream theOutputStream = new ByteArrayOutputStream();
>
>    // Call service method
>    theServlet.service(theHttpRequestBase, theHttpResponseBase);
>
>   }catch (Exception e)
>    {
>     e.printStackTrace();
>    }
>   }
> ---------------------------------------------
> but I do not know how make it with jsp.
>
> > If you have Tomcat 4.0 up and go ,  put the  jsp (myjsp.jsp) in :
> > CATALINA_HOME
> >     webapps/ROOT/myjsp.jsp
> >
> > In your browser type :
> > http://localhost:port/myjsp.jsp
> >
> > you can try this  JSP:
> >
> > <!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'
> > 'http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd'>
> > <html>
> >  <head>
> >   <meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'>
> >   <title>JSP test</title>
> >  </head>
> >  <body>
> >   <p>
> >    HTML hello world
> >   </p>
> >   <%
> >   out.println("<h1>JSP hello world</h1>");
> >   %>
> >  </body>
> > </html>
> >
> >
> > Juan Carlos Fernández Galante wrote:
> >
> > > Hi,
> > >
> > > I want to execute a jsp from, but I don´t know whats are the steps.
> > >
> > > --
> > > To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> > > For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> >
> >
> > --
> > To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> >
> >
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>

--
Vennlig hilsen
Tor Magne Hougen
------------------------------------------------------------
BT - Datatjenester ANS
Teigenveien 18b, 3113 TØNSBERG
Telefon : 33324841, Mobil : 95211885, Fax : 95574920
------------------------------------------------------------



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: How can I execute a jsp from Catalina?

Posted by Juan Carlos Fernández Galante <ju...@upcnet.es>.
Thanks, for your help, but I want to make a Web Server, and I want to make
use of Catalina and Jasper Api.

I had achieved execute a servlet with the next code:
---------------------------------------------
 public Prueba1()
  {
  //Set the servlet Name and the servlet Class
  StandardWrapper theStandardWrapper = new StandardWrapper();
  theStandardWrapper.setServletName("servlet.OCSPServlet");
  theStandardWrapper.setServletClass("servlet.OCSPServlet");

  try
  {
   //Sets the loader
   WebappLoader theWebappLoader = new WebappLoader();
   theStandardWrapper.setLoader(theWebappLoader);
   Servlet theServlet = theStandardWrapper.allocate();

   //Generate the request
   HttpRequestBase theHttpRequestBase = new HttpRequestBase();
   String theRequest = createRequest();
   ByteArrayInputStream theInputStream = new
ByteArrayInputStream(theRequest.getBytes());

   theHttpRequestBase.setContentType("text/plain");
   theHttpRequestBase.setContentLength(theRequest.length());

   theHttpRequestBase.setStream(theInputStream);

   //Generate the response
   HttpResponseBase theHttpResponseBase = new HttpResponseBase();
   ByteArrayOutputStream theOutputStream = new ByteArrayOutputStream();


   // Call service method
   theServlet.service(theHttpRequestBase, theHttpResponseBase);


  }catch (Exception e)
   {
    e.printStackTrace();
   }
  }
---------------------------------------------
but I do not know how make it with jsp.



> If you have Tomcat 4.0 up and go ,  put the  jsp (myjsp.jsp) in :
> CATALINA_HOME
>     webapps/ROOT/myjsp.jsp
>
> In your browser type :
> http://localhost:port/myjsp.jsp
>
> you can try this  JSP:
>
> <!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'
> 'http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd'>
> <html>
>  <head>
>   <meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'>
>   <title>JSP test</title>
>  </head>
>  <body>
>   <p>
>    HTML hello world
>   </p>
>   <%
>   out.println("<h1>JSP hello world</h1>");
>   %>
>  </body>
> </html>
>
>
> Juan Carlos Fernández Galante wrote:
>
> > Hi,
> >
> > I want to execute a jsp from, but I don´t know whats are the steps.
> >
> > --
> > To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> > For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: How can I execute a jsp from Catalina?

Posted by Tor Magne Hougen <95...@mobilpost.com>.
If you have Tomcat 4.0 up and go ,  put the  jsp (myjsp.jsp) in :
CATALINA_HOME
    webapps/ROOT/myjsp.jsp

In your browser type :
http://localhost:port/myjsp.jsp

you can try this  JSP:

<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'
'http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd'>
<html>
 <head>
  <meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'>
  <title>JSP test</title>
 </head>
 <body>
  <p>
   HTML hello world
  </p>
  <%
  out.println("<h1>JSP hello world</h1>");
  %>
 </body>
</html>


Juan Carlos Fernández Galante wrote:

> Hi,
>
> I want to execute a jsp from, but I don´t know whats are the steps.
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>