• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java Servlets and JSP pages

 
Carsten Rasmussen
Ranch Hand
Posts: 65
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 65
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9496
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
Carsten Rasmussen
Ranch Hand
Posts: 65
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 65
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3908
9
Chrome Fedora Hibernate
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Carsten Rasmussen
Ranch Hand
Posts: 65
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9496
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 65
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13045
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 65
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic