Web Hosting Forum | Lunarpages


*
Welcome, Guest. Please login or register.
Did you miss your activation email?



Login with username, password and session length
May 23, 2012, 10:41:47 PM

Pages: [1]   Go Down
  Print  
Author Topic: Simplest config example? (hello world)  (Read 568 times)
mindkayak
Newbie
*
Offline Offline

Posts: 1


« on: September 25, 2002, 02:58:00 AM »

I have a new account and support@lunarpages.com has enabled jsp/servlets for it. I have JSP and servlets working on my local copy of Resin, but have not had success on my new domain with either of these tests:
http://mindkayak.com/testjsp.jsp
http://mindkayak.com/servlet/HelloClientServlet
(or several others in app sub-directories)

I had hoped the system resin.conf would be enough for simple examples -- since that didn't work I have tried many variations on resin.xml and some for web.xml, but no luck.

Could someone post the simplest possible config file/structure (e.g. resin.xml) that will support a "hello world" servlet or JSP page?

The default directory structure I started with is:
/public_html
/public_html/WEB-INF
/public_html/WEB-INF/tmp
/public_html/webapps

Assuming I put "testjsp.jsp" in "/public_html", and "HelloClientServlet.java" in "/public_html/WEB-INF/classes", what resin.xml or web.xml do I need?

Thanks!
Logged
Kelvin
Jabba the Hutt
*****
Offline Offline

Posts: 737



« Reply #1 on: September 25, 2002, 03:56:00 AM »

Hi mk,

   from what I can tell by looking at your site, the Jsp/Servlet support isn't active at the moment - you can tell this because it's possible to list your WEB-INF folder:

http://www.mindkayak.com/WEB-INF/

compared to:

http://www.transpear.net/WEB-INF/

you'll notice that the transpear.net displays "403 Forbidden - Resin 2.1.2", while yours displays at the bottom "Apache/1.3.26...". So you can see that the request isn't being passed onto Resin.

You'll need to email support (again!); but be gentle with them, they've been working very hard today.

To answer the rest of your question:

You don't need the Resin.xml at all,  the one you really need is the web.xml - this basically allows you to configure you web-app and give servlets a "mapping" so that you can access them with something like:

http://mindkayak.com/myTestServlet

rather than having to use the "/servlet/" in the url,  web.xml for this would look something like:


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
<web-app>
<servlet>
   <servlet-name>myTestServlet</servlet-name>
   <servlet-class>myTestServlet</servlet-class>
</servlet>

<servlet-mapping>
  <servlet-name>myTestServlet</servlet-name>
  <url-pattern>/myTestServlet</url-pattern>
</servlet-mapping>


The top part is just a declaration that tells the XML Parser what type of xml document it is dealing with.  Hopefully the rest of it is pretty much self explanatory.

Jsp's aren't dependant on the web.xml,  so you can place these anywhere and call them the sameway you would a static html page.
 
 [ September 25, 2002, 12:02 PM: Message edited by: EXiL3 ]
Logged

Kelvin

"Failure is not an option. It comes bundled with the software."
kianwatt
Pong! (the videogame) Master
*****
Offline Offline

Posts: 22


WWW
« Reply #2 on: September 27, 2002, 07:11:00 AM »

Your qn is rather primitive.

First you goota ensure resin is parsing your jsp files. Do a simple hello world jsp page

<%="Hello World"%>

Next put all your class files or jar files into your web-inf/classes and web-inf/lib folder. No .java files plz

Then put all your jsp files in public_html/webapps folder
Logged
Pages: [1]   Go Up
  Print  
 
Jump to: