<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1106" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Hello All,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>My questions are simple:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>How does one go about incorporating simple java
classes into OpenCMS jsp pages. Where does one place them?</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>I have recently been exploring OPENCMS.
I run the standard Windows XP Pro. installation - Tomcat, MySql etc, OpenCMS
5.0. I have developed all of the exercises from the JSP tutorial in a
folder "jswstuff". I wanted to try using a very simple class file as a bean for
some session data. The class looks like the following:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial><PRE><TT><FONT size=2>public class MyUserData {</FONT></TT></PRE><PRE><TT><FONT size=2> String username;
String email;
int age;
</FONT></TT></PRE><PRE><TT><FONT size=2> public MyUserData() {}</FONT></TT></PRE><PRE><TT><FONT size=2>
public void setUsername( String value )
{
username = value;
}
public void setEmail( String value )
{
email = value;
}
public void setAge( int value )
{
age = value;
}
public String getUsername() { return username; }
public String getEmail() { return email; }
public int getAge() { return age; }</FONT></TT></PRE><PRE><TT><FONT size=2>}</FONT></TT></PRE></FONT></DIV>
<DIV><FONT face=Arial size=2>The code that uses this is simple. An
html form is used to enter the name, email and age information which is
passed to the following, called SaveUser.jsp</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2><%@ page import = "MyUserData" %><BR><%@
page session="true" %><BR><%@ taglib prefix="cms" uri="<A
href="http://www.opencms.org/taglib/cms">http://www.opencms.org/taglib/cms</A>"
%><BR><jsp:useBean id="myuser" class="MyUserData"
scope="session"/></FONT></DIV>
<DIV> </DIV><FONT face=Arial size=2>
<DIV><BR><jsp:setProperty name="myuser" property="*"/> </DIV>
<DIV> </DIV>
<DIV><BR><cms:include property="template" element="head"
/><BR><h3><A
HREF="NextPage.jsp">Continue</A></h3><BR><cms:include
property="template" element="foot" /></DIV>
<DIV> </DIV>
<DIV></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>My problem is I don't know where to place the class
file for UserData. I tried the following:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>1. Place the class file in the same folder
"/jswstuff as a binary file.</FONT></DIV>
<DIV><FONT face=Arial size=2>2. Place a jar file containing the class in
the \webapps\opencms\WEB-INF\lib, restart tomcat and hope for the
best.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Well of course, none of this worked. I got
the following message when I requested the jsp that used the bean. I
reckon that what I am doing is contrary to the standard usage rules. I
have been playing with this all day. I would be grateful for any
suggestions.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>javax.servlet.ServletException: Resource loader
error in file '/jswstuff/SaveName.jsp'</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>Root cause:<BR>org.apache.jasper.JasperException:
Unable to compile class for JSP</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>An error occurred at line: -1 in the jsp file:
null</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>Generated servlet error:<BR>
[javac] Since fork is true, ignoring compiler setting.<BR>
[javac] Compiling 1 source file<BR> [javac] Since fork is
true, ignoring compiler setting.<BR> [javac] symbol :
class MyUserData <BR> [javac] location: class
org.apache.jsp.SaveName_jsp_jsp<BR>
[javac] MyUserData myuser =
null;<BR> [javac</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>John Stanford White<BR>917-576-6264
(cell)<BR>212-794-1551 (home)<BR><A
href="mailto:jswhite@ieee.org">jswhite@ieee.org</A></FONT></DIV></BODY></HTML>