File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes jsp:useBean doubt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "jsp:useBean doubt" Watch "jsp:useBean doubt" New topic
Author

jsp:useBean doubt

vijay kumarg
Ranch Hand

Joined: Dec 14, 2006
Posts: 105
Hi All,

In a java class XMLAdd I have 3 variables document, outDoc, outDocNode of type org.jdom.Document and one variable of type java.io.File.

In a jsp showall.jsp I declared this class as a java bean using jsp:useBean tag.
But there exists a error at useBean declaration as the work directory showing error.
and in jsp:setProperty i am setting all the properties of the bean.
So is it mandatory that I need to provide setters and getters for all the 4 variables ?

Below are the snippets for the class, jsp.


setters and getters are defined for xmlFile and outDoc only.

showall.jsp:



when I see the work directory the generated servlet code is stopped at the useBean declaration of XMLAdd class.

the generated servlet code :



so is that the error is due to that there are no getters and setters for document and outDocNode variables ?

Thanks,

[ February 26, 2007: Message edited by: vijay kumarg ]
[ February 26, 2007: Message edited by: vijay kumarg ]
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Yes, useBean follows the JavaBean conventions and looks for setter methods in order to populate your bean's fields.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
 
Consider Paul's rocket mass heater.
 
subject: jsp:useBean doubt
 
Similar Threads
<jsp:setProperty>
Error in JSP
Peculiar problem with js and css file
why error NullPointerException?
jsp:setProperty question