Mombu the Programming Forum

Go Back   Mombu the Programming Forum > Programming > useBeans servlets fail to find class name
User Name
Password
REGISTER NOW! Mark Forums Read




Reply
1 16th October 10:12
richardcktan
External User
 
Posts: 1
Default useBeans servlets fail to find class name



Ok, I am new to this
I have apache running with tomcat apache for java and jsp stuff.
have changed the root path of the tomcat apache to a particular plac
in my hdd so that the program file is completely away from th
development file

Ok, basically I am trying to do a useBean to call a servlet. I hav
nick this code from the web, as a tutorial to test it out. It can b
found at this address..

http://www.apl.jhu.edu/~hall/java/Se....html#Section8.

So I created to files, one called BeanTest.jsp and the code is a
follows

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.
Transitional//EN"
<HTML
<HEAD
<TITLE>Reusing JavaBeans in JSP</TITLE
<LINK REL=STYLESHEE
HREF="My-Style-Sheet.css
TYPE="text/css"
</HEAD

<BODY

<CENTER
<TABLE BORDER=5
<TR><TH CLASS="TITLE"
Reusing JavaBeans in JSP</TABLE
</CENTER
<P

<jsp:useBean id="test
class="hall.SimpleBean" /
<jsp:setProperty name="test"
property="message"
value="Hello WWW" /

<H1>Message: <I
<jsp:getProperty name="test
property="message" /
</I></H1

</BODY
</HTML

and the second one called SimpleBean.java and cod

[code:1:b46f0b58a5]package hall

public class SimpleBean
private String message = "No message specified"

public String getMessage()
return(message)


public void setMessage(String message)
this.message = message

}[/code:1:b46f0b58a5

I compile the above code it creates SimpleBean.clas
I created a new folder in the same location as the three files create
called classes. In there I created another folder called hall and i
that placed the SimpleBean.java since I have read on the net tha
this is where class files should be kept

WHen I use http://localhost/BeanText.jsp I get this error message..


prevented it from fulfilling this request


the useBean class attribute hall.SimpleBean is invalid

org.apache.jasper.compiler.DefaultErrorHandler.jsp Error(DefaultErrorHandler.java:39

org.apache.jasper.compiler.ErrorDispatcher.dispatc h(ErrorDispatcher.java:405

org.apache.jasper.compiler.ErrorDispatcher.jspErro r(ErrorDispatcher.java:146

org.apache.jasper.compiler.Generator$GenerateVisit or.visit(Generator.java:1223


org.apache.jasper.compiler.Compiler.generateJava(C ompiler.java:189


org.apache.jasper.JspCompilationContext.compile(Js pCompilationContext.java:563

org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:293

org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:314


Looking at the above, it looks like the class SimpleBean cannot b
found. I have tried lots of ways in which to solve this and nothin
is working, so I resort to this forum to help me. So if anyone know
what is wrong, can you please reply me as soon as possible
Thanks[/quote
http://www.devplug.com
  Reply With Quote


 


2 16th October 10:12
frank dietrich
External User
 
Posts: 1
Default useBeans servlets fail to find class name



Hi,


Welcome on board. ;-)

^- cut and paste error?

This one is too much, because it hasn't an open brace


May be your directory/file structure is wrong.

ROOT/
ROOT/WEB-INF
ROOT/WEB-INF/classes
ROOT/WEB-INF/classes/hall
ROOT/WEB-INF/classes/hall/SimpleBean.class ROOT/BeanTest.jsp

The SimpleBean.java can be anywhere outside of this structure.

Frank
  Reply With Quote
3 16th October 10:12
richardcktan
External User
 
Posts: 1
Default useBeans servlets fail to find class name


Yeah, I have solve the problem last week. Thanks anyway!

Spring
http://www.devplug.com
  Reply With Quote
Reply


Thread Tools
Display Modes




666