Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Where in Tomcat3.1 should i put .jsp files, .java files(Beans files)  RSS feed

Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all
I'm trying to call a bean from jsp file and i'm getting this error 500)
Class jsp.StringBean not found.
here is my bean file:
public class StringBean
private String message="No message specified ";
public String getMessage()

public void setMessage(String message)

also here is my jsp file:
<table border=5 align="CENTER">
<TR><TH class="TITLE">
using javabaens
<jsp:useBean id="stringBean" class="StringBean" />
<LI> initial value (getproperty):
<I><jsp:getProperty name="stringBean" property="message" /></I>

<LI> initial value (jsp expression):
<I><%=stringBean.getMessage() %></I>

<LI> <jsp:setProperty name="stringBean" property="message" value="best string bean:fortex" />

value after setting property with setProperty "
<I><jsp:getProperty name="stringBean" property="message" /></I>
<LI><% stringBean.setMessage("my favorite:kentucky wonder "); %>
value after setting property with scripltlet:
<I><%=stringBean.getMessage() %></I>


i put it under:
install_directory/webapp/examples/jsp directory.
i will appreciate your help
i put it in :
William Brogden
Author and all-around good cowpoke
Posts: 13078
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JSP pages are served just like HTML pages so they go in that directory.
Beans you have to compile - the class files go in the WEB-INF/classes directory that belongs to the particular web application - or - if you want all applications to see them, they go in the tomcat/lib directory
If your JSP is in the examples directory, I think your Bean class files have to be in examples/WEB-INF/classes
All of this directory stuff is defined by the Applet 2.2 API documentation - although it is a bunch to wade through.
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!