(from NEWER) I cannot run my JSP that references my bean.
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Krystof_Malak
Posted On:   Monday, January 13, 2003 08:54 AM

Using JavaBeans with JSP Hi, I use Tomcat 4.0.3 I use JDK1.3.1_04 I got a bean: StringBean.java package MyPackage; public class StringBean { private String message = "No message specified"; public String getMesage() { return(message); } public void setMessage(String message) { this.message = message; } } I got a JSP StringBean.jsp: HREF="JSP-Styles.css" TYPE="text/css"> Initial value (getProperty):    More>>
Using JavaBeans with JSP

Hi,

I use Tomcat 4.0.3

I use JDK1.3.1_04


I got a bean: StringBean.java


			
package MyPackage;

public class StringBean {
private String message = "No message specified";

public String getMesage() {
return(message);
}
public void setMessage(String message) {
this.message = message;
}
}


I got a JSP StringBean.jsp:


			





HREF="JSP-Styles.css"
TYPE="text/css">








  1. Initial value (getProperty):

    property="message" />


  2. Initial value(JSP expression):
    <%= stringBean.getMessage() %>

  3. property="message"
    value="Best string bean: Fortex" />

    Value after setting property with setProperty:

    property="message" />

  4. <% stringBean.setMessage("My favourite: Kentucky Wonder"); %>
    Value after setting property with scriptlet:
    <%= stringBean.getMessage() %>





I execute http://localhost:8080/MyJSP/StringBean.jsp. Then I get an error:


			
HTTP STATUS 5000
...
java.lang.ClassNotFoundException: MyPackage.StringBean
...


I set my CLASPATH in the following way:


			
.;C:Program FilesApache Tomcat 4.0commonlibservlet.jar;
C:MyJSPclasses;


Thus, MyPackageStringBean.class is located in C:MyJSPclasses;


I cannot find in Tomcat folders JSP.jar file. Do I need it? What I am missing actually?


Can you help?


Krystof

   <<Less

Re: (from NEWER) I cannot run my JSP that references my bean.

Posted By:   Blake_Minghelli  
Posted On:   Monday, January 13, 2003 04:56 PM

When you deploy your class files to the web server, they should be in your server's WEB-INFclasses directory. So your class should be copied into the directory:
WEB-INFclassesMyPackage
About | Sitemap | Contact