• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Tomcat and Bean placement

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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

 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 22781
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic