You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by rr...@workbrain.com on 2001/09/28 18:54:00 UTC
Unable to use a javabean in an jsp page
I am a new user to Tomcat and seem to be having a fundamental problem with
getting javabeans to work in a jsp page. I have followed documentation to a
T, but still no resolve. Anyways, here's the outline of my problem....
I created an application called "ch01" in the "webapps" directory on a
Windows 2000 platform. Here is my directory hierarchy:
...webapps/ch01
->WEB-INF
->classes
->lib
I have a jsp page in the "ch01" directory that called "test_javabean1.jsp"
that creates a javabean that is located in the classes directory called
"JavaBean1.class". When I try to view the jsp page in a browser, I
repeating get an error message stating that "class org.apache.jsp.JavaBean1
not found". I know that this jsp/javabean combination should work since it
works flawlessly on a jrun server.
The only thing I can think of is that my "ch01" application does not have a
web.xml page in the WEB-INF directory. If this is the problem, is there a
template I can use?
Also, my JavaBean1 class source code is below, is there anything I'm missing
for Tomcat server?
Any help would be much appreciated!
Hoping to stand on the shoulders of geniuses, Rob.
JavaBean1 source code............
public class JavaBean1 {
private String message = "<b>Wow! Dale is a nerd!</b>";
public JavaBean1() {
}
public void setMessage(String a) {
message = a;
}
public String getMessage() {
return message;
}
}
Re: Unable to use a javabean in an jsp page
Posted by Manu KY <ma...@yahoo.com>.
Hi ,
try these steps.
1.first of all , create a web.xml file in WEB-INF folder.
2.put the bean in a package such as org.rob
Manu
>I am a new user to Tomcat and seem to be having a fundamental problem with
>getting javabeans to work in a jsp page. I have followed documentation to a
>T, but still no resolve. Anyways, here's the outline of my problem....
>
>I created an application called "ch01" in the "webapps" directory on a
>Windows 2000 platform. Here is my directory hierarchy:
>
>...webapps/ch01
> ->WEB-INF
> ->classes
> ->lib
>
>
>
>I have a jsp page in the "ch01" directory that called "test_javabean1.jsp"
>that creates a javabean that is located in the classes directory called
>"JavaBean1.class". When I try to view the jsp page in a browser, I
>repeating get an error message stating that "class org.apache.jsp.JavaBean1
>not found". I know that this jsp/javabean combination should work since it
>works flawlessly on a jrun server.
>
>The only thing I can think of is that my "ch01" application does not have a
>web.xml page in the WEB-INF directory. If this is the problem, is there a
>template I can use?
>
>Also, my JavaBean1 class source code is below, is there anything I'm missing
>for Tomcat server?
>
>Any help would be much appreciated!
>
>Hoping to stand on the shoulders of geniuses, Rob.
>
>
>
>
>JavaBean1 source code............
>
>public class JavaBean1 {
>
> private String message = "<b>Wow! Dale is a nerd!</b>";
>
> public JavaBean1() {
> }
>
> public void setMessage(String a) {
> message = a;
> }
>
> public String getMessage() {
> return message;
> }
>}
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
Re: Unable to use a javabean in an jsp page
Posted by Jim Cheesman <jc...@msl.es>.
At 06:54 PM 28/09/01, you wrote:
Try putting the bean in a package and running it - I think that tomcat
requires this.
>I am a new user to Tomcat and seem to be having a fundamental problem with
>getting javabeans to work in a jsp page. I have followed documentation to a
>T, but still no resolve. Anyways, here's the outline of my problem....
>
>I created an application called "ch01" in the "webapps" directory on a
>Windows 2000 platform. Here is my directory hierarchy:
>
>...webapps/ch01
> ->WEB-INF
> ->classes
> ->lib
>
>
>
>I have a jsp page in the "ch01" directory that called "test_javabean1.jsp"
>that creates a javabean that is located in the classes directory called
>"JavaBean1.class". When I try to view the jsp page in a browser, I
>repeating get an error message stating that "class org.apache.jsp.JavaBean1
>not found". I know that this jsp/javabean combination should work since it
>works flawlessly on a jrun server.
>
>The only thing I can think of is that my "ch01" application does not have a
>web.xml page in the WEB-INF directory. If this is the problem, is there a
>template I can use?
>
>Also, my JavaBean1 class source code is below, is there anything I'm missing
>for Tomcat server?
>
>Any help would be much appreciated!
>
>Hoping to stand on the shoulders of geniuses, Rob.
>
>
>
>
>JavaBean1 source code............
>
>public class JavaBean1 {
>
> private String message = "<b>Wow! Dale is a nerd!</b>";
>
> public JavaBean1() {
> }
>
> public void setMessage(String a) {
> message = a;
> }
>
> public String getMessage() {
> return message;
> }
>}
--
* Jim Cheesman *
Trabajo:
jchees@msl.es - (34)(91) 724 9200 x 2360
What is a free
gift? Aren't all gifts free?