Hi i have the foloowing jsp and bean files. when i use <jsp:useBean id="mybean" class="beans.StringBean" /> it works fine,because my bean it is in beans directory under classes directory(Tomcat3.1). but when i use <%@ page import="beans.*" %> <jsp:useBean id="myBean" class="StringBean" /> i got an error message that says casnnot load stringBean class. Here are both files package beans; public class StringBean { private String message="No message specified "; public void setMessage(String message) { this.message=message; } public String getMessage() { return this.message; } } //============================ jsp file : <jsp:useBean id="MyBean" class="beans.StringBean" /> <jsp:setProperty name="MyBean" property="message" value="hello world" /> <b><jsp:getProperty name="MyBean" property="message" /></b>
Randall Twede
Ranch Hand
Joined: Oct 21, 2000
Posts: 3901
posted
0
This may be way offbase, but make sure there are no upper/lower case typo's in your code like there were in your post.
casnnot load stringBean class
I never took notes in college. That's how I got a 4.0 the first 2 years, and a 3.5 the second two years.
Frank Carver
Sheriff
Joined: Jan 07, 1999
Posts: 6913
posted
0
"darine", The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at http://www.javaranch.com/name.jsp . We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please choose a new name which meets the requirements. Thanks.
Just like JAVA, JSP is case sentitive. According to the code, it should have two different instance of "beans.StringBean". One is "mybean", another one is "myBean". Maybe even you import the package, jsp still require you to use the full class name includes the whole package for the "class=?".