Getting source code on URL

Pliz help!Im trying to call a servlet within my .jsp file on http://localserver:8080........,but im getting the source code in my servlet instead.What might be the problem?
[179 byte] By [] at [2007-11-26 18:20:06]
# 1
huh! The only way that can happen is if you put the .java file in your webdir or something :sWhat did you do to install the servlet?
gimbal2a at 2007-7-9 5:53:52 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
Well, it's possible the poster just installed a web server like Apache and didn't install any application server at all.
DrClapa at 2007-7-9 5:53:52 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
My .java file is in folder called "servlet " which as well contains javax.servlet, javax.servlet.http,javax.mail etc.This servlet folder is in my tomcat (apache)server.
DrClapa at 2007-7-9 5:53:52 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4
Then how can i install my application server.i.e Where can i get it?Maybe that must be the problem!!
DrClapa at 2007-7-9 5:53:52 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5

No, Tomcat is the application server. You have that part right. Unless you think Tomcat and Apache are the same thing, in which case you don't.

It looks like you haven't compiled your servlet class. Don't put the servlet.java file into Tomcat, put the servlet.class there. And don't have your JSP contain a link to servlet.java (or however you made the problem happen), have it contain a link to whatever servlet mapping you configured for the servlet.

DrClapa at 2007-7-9 5:53:52 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 6

Hi DrClap!

Yeah,i do have Tomcat. Within this application server,i have put all my Servlet.java,Servlet.class and web.xml but in diiferent folders within the server.

- Servlet.java,is in a folder called servlet

- Servlet.class is in weapps\ROOT\WEB-INF\classes

- web.xml is in weapps\ROOT\WEB-INF

How do u compile a .class file?I only compiled Servlet.java and it produced the Servlet.class in its completion.

In my .jsp file my form action is as follows:

<FORM ACTION="Servlet.jar" METHOD="GET">

Thanx in advance!

DrClapa at 2007-7-9 5:53:52 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 7
Oh no!!Now im getting this message :(The requested resource (tomcat//JMail/servlet/MyServlet) is not available).Where have i gone wrong now?
DrClapa at 2007-7-9 5:53:52 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 8

Please help.I've error that "the requested blah,blah/MyServlet cannot be found" II think the problem might be the location of MySerlvet.java program.

My web.xml is in \tomcat\webapps\ROOT\WEB-INF and MyServlet.class is in

\tomcat\webapps\ROOT\WEB-INF\classes.

As for MyServlet.java,i've created a folder within tomcat and called it MyMail and within it there is another folder called servlet,that's where i have dumped my .java program together with javax/servlet and javax/servlet/http folders.So MyServlet is in \tomcat\MyMail\servlet \.

As well as my login.jsp program.

Thanx in advance.....

DrClapa at 2007-7-9 5:53:52 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...