aspose file tools*
The moose likes Servlets and the fly likes Java Servlets and JSP pages Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Java Servlets and JSP pages" Watch "Java Servlets and JSP pages" New topic
Author

Java Servlets and JSP pages

Carsten Rasmussen
Ranch Hand

Joined: Sep 22, 2009
Posts: 65
Yearh yearh yearh i did som pathing on my vista.



And i got this compiled.

--- html.java


And now the question.
Did i compile the right way and how do i load my servlet into a JSP page.
PLEASE i have used hours in google.

Your regards: Carsten Rasmussen
Carsten Rasmussen
Ranch Hand

Joined: Sep 22, 2009
Posts: 65
I joined this forum cuz you guys seem to help eachother.
Im use to program PHP and MYSQL i know almost NOTHING about java.

[AG Edit: removed unnecessary formatting]
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9293
    
  17

You don't need to put the servlet into JSP. If you want to run this servlet, you'll have to create a web application and then deploy it on tomcat. I would recommend that you read a book to clear your concepts. For now you can consult a tutorial like this to run your servlet...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Carsten Rasmussen
Ranch Hand

Joined: Sep 22, 2009
Posts: 65
I seems to be for the old Tomcat the new dosnt got the same features so i cant figure it out.
Carsten Rasmussen
Ranch Hand

Joined: Sep 22, 2009
Posts: 65
w8 i figure it out by editing the web.xml examples/WEB-INF folder but i would like to make my own folder in ROOT directory for making it all happen.
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3825

w8 i figure it out by editing the web.xml examples/WEB-INF folder but i would like to make my own folder in ROOT directory for making it all happen.


Hi Carsten, Welcome to JavaRanch,

Please use real words when posting here (w8 instead of what). And you can have your own web applications inside webapp directory in Tomcat (or any other container). What's the issue you are having now and which version of tomcat are you trying to use?

SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
Carsten Rasmussen
Ranch Hand

Joined: Sep 22, 2009
Posts: 65
I have tried making a folder: /webapps/ROOT/index/ then created a folder WEB_INF/ using this web.xml file.


In order to launch like this http://localhost:8080/index/html but it dosnt work html.class file are located in WEB-INF/html/ folder.
Sorrry for the wait word
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9293
    
  17

URL patterns start with / and don't end with /. So instead of <url-pattern>html/</url-pattern>, use <url-pattern>/html</url-pattern>, the html.class file will go under WEB-INF/classes folder (I don't see any package declarations in the source of that class). Also I'm not sure if you can put your application inside the ROOT folder in tomcat. Move your index folder to /webapps folder i.e. /webapps/index
Carsten Rasmussen
Ranch Hand

Joined: Sep 22, 2009
Posts: 65
Strenge i think i saw it working once but only once it dosnt show the file anymore.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12769
    
    5
Years ago tomcat came with the "Invoker" servlet activated - this was supposed to make it easier for beginners to experiment with servlets by not requiring a package.

The idea proved to be a disaster as related in this Ranch FAQ.

Follow the current best practices to avoid all sorts of odd problems.

Bill
Carsten Rasmussen
Ranch Hand

Joined: Sep 22, 2009
Posts: 65
I figured it out just put html.class in index/WEB-INF/classes/ without using a folder named html/ DOH!!!
Thank you sir for all the help
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Java Servlets and JSP pages