This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Java in General and the fly likes Tomcat settings Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Tomcat settings" Watch "Tomcat settings" New topic
Author

Tomcat settings

Vladimir Kositsky
Ranch Hand

Joined: Nov 03, 2000
Posts: 116
Hi!
I'd like to try using JSP + bean with some logic for implementation. It is simple example so probably Tomcat is good enough.
I created ProJavaServer directory and placed .jsp file, created
ProJavaServer\WEB-INF\classes directory and placed compiled bean there.
In %TOMCAT_HOME%/conf/server.xml i added:
docBase="c:\WORK/ProJavaServer">
I run successfully examples that not included beans, so path and other settings probably set properly.
To exclude typo i downloaded example from coreservlets.com
And it does not work.
C:\tomcat\work\localhost_8080%2Fexamples\_0002fjsp_0002fStringBean_0002ejspStringBean_jsp_0.java:105: Class jsp.StringBean not found.
out.print(JspRuntimeLibrary.toString((((StringBean)pageContext.findAttribute("stringBean")).getMessage())));
I look for advice how to place my files to make it work.
Thanks in advance

Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
I think the problem is not that it can't find your bean, but that you haven't "import"ed it into your JSP. If you look at the error message it is looking for a class jsp.StringBean.
Just as with any other Java class, a JSP only looks in its own package (jsp) and any packages or classes listed in import statements for classes mentioned by name.
Is your StringBean class in a package? if so you need to import the full classname or the whole package it belongs to. Is your StringBean in the "default" package? if so you need to explicitly import it by name.

Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Tomcat settings
 
Similar Threads
Setting up directory structure for Bean Component in JSP
JSP+bean
JSP + bean on Tomcat
JSP can't find bean classes
import package problem???