Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Tomcat and Bean placement

 
Ron Lavery
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

 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65228
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • 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!



 
Rob Spoor
Sheriff
Pie
Posts: 20669
65
Chrome Eclipse IDE Java 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic