• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to run jsp in tomcat

 
sumedha rao
Ranch Hand
Posts: 115
Firefox Browser Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Ranchers, i was trying to run the jsp code on page 286 of HFSJ,but im getting an output..

the pain java code is as below(compiles!)


and jsp code..


my doubt is that while deploying the class file,should i paste the entire foo package(folder) or should i paste only the Counter.class in the tomcat folder??

the jsp file is under tomcat\webapps\testing\BasicCounter.jsp

can anyone please help me out!!
 
Ankit Garg
Sheriff
Posts: 9597
36
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sumedha, you'll need a proper directory structure to run a web application. You'll need a WEB-INF directory with web.xml deployment descriptor in it. You'll need to put your Counter.class in its proper package so it will go under WEB-INF/classes/foo/Counter.class...
 
sumedha rao
Ranch Hand
Posts: 115
Firefox Browser Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi ankit thanks for replying,bt i have a proper directory structure,i have followed the same steps as guided in hfsj.What should i write in web.xml?? there isnt anything given about web.xml for this program in the book.About the counter class,yes it is in the same order as you've mentioned.
 
Ankit Garg
Sheriff
Posts: 9597
36
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sumedha, you can find examples of web.xml over the internet like here. Since you don't have any servlets, you can remove most of the content of the web.xml. You can keep the display-name, description and welcome-file-list tags if you want...
 
sumedha rao
Ranch Hand
Posts: 115
Firefox Browser Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok fine ill try that out.Thanks for helping!!
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!