Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Machine Learning with R: Expert techniques for predictive modeling this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

Tomcat and Bean placement

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm doing my first JSP/bean app.

My application is under a new folder called "Hello" which is under the "webapps" folder. I've gotten JSP to work with this. But now I've created a bean, and need to put it somewhere.

I've tried all kinds of places and can't get it to work. Also, does this have anything to do with my CLASSPATH environmental variable?

Other info: Tomcat 7; bean is in a package called "user".

Any help here would be greatly appreciated. thanks

 
Marshal
Posts: 67289
170
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Ron Lavery wrote:My application is under a new folder called "Hello" which is under the "webapps" folder. I've gotten JSP to work with this. But now I've created a bean, and need to put it somewhere.


The Hello folder is known as the "context root" in this case. That's an important term to remember.

I've tried all kinds of places and can't get it to work. Also, does this have anything to do with my CLASSPATH environmental variable?


Not in the least. Any environment variable is ignored at run-time by Tomcat. It's only relevant when building from the command line.

Other info: Tomcat 7; bean is in a package called "user".


In that case, the class file must be placed at WEB-INF/classes/user/, where WEB-INF is placed in the context root.
 
Ron Lavery
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, I do have that setup and it's still not working.

More info:

Here's my bean code:


Here's my calling JSP:



Here's my directory structure, and I put the UserData.class in here:

C:\Tomcat7\webapps\Hello\WEB-INF\classes\user



And here's the error message:



Thanks again for any help!



 
Sheriff
Posts: 21805
104
Eclipse IDE Spring VI Editor Chrome Java Ubuntu Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ron, welcome to the Ranch!
It's better to UseCodeTags instead of quote tags as code tags maintain indentation and add syntax highlighting; I've replaced them for three of your blocks.
 
Ron Lavery
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Rob Spoor wrote:Ron, welcome to the Ranch!
It's better to UseCodeTags instead of quote tags as code tags maintain indentation and add syntax highlighting; I've replaced them for three of your blocks.



Thanks, got it.

Also, FWIW, I've now got the bean thing working. I could not find anything wrong with my code - - so I did the basic stop/start Tomcat - - and now it works.
 
I will open the floodgates of his own worst nightmare! All in a tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!