aspose file tools*
The moose likes JSP and the fly likes JSP/Java Bean problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "JSP/Java Bean problem" Watch "JSP/Java Bean problem" New topic
Author

JSP/Java Bean problem

Mukund Srinivas
Greenhorn

Joined: Oct 11, 2000
Posts: 6
Hi,
Currently I am using a JavaBean declared in
my JSP as:
<jsp:useBean id="detailDataBean" scope="request" class="com.xyz.beans.LQFPackaging_DataBean" />
In My Controller servlet where I am forwarding to this page I am using
LQFPrime_DataBean pdbean =
new LQFPrime_DataBean();
request.setAttribute("detailDataBean", pdbean);
The bean has default values in its constructor but on loading the JSP page there is an error thrown :
ServletInstan X Uncaught service() exception thrown by servlet {0}: {1}
"JSP 1.1 Processor"
org.apache.jasper.JasperException: Unable to compile class for JSP
Any suggestions please??
Thanks,
Mukund
Dave Vick
Ranch Hand

Joined: May 10, 2001
Posts: 3244
smukund
Welcome to the Java Ranch, we hope you�ll enjoy visiting as a regular however,
your name is not in keeping with our naming policy here at the ranch. Please change your display name to an appropriate name as shown in the policy.
Thanks again and we hope to see you around the ranch!!

Do you get a line number for the exception? If the JSP is done before the servlet then the servlet probably has nothing to do with it unless you're getting the error when you forward the request. We need more info and maybe to see some code...
If you've already created the bean in the JSP with request scope then you should be able to access it in your servlet by just getting the instance of the bean from the Request attributes.


Dave
Mukund Srinivas
Greenhorn

Joined: Oct 11, 2000
Posts: 6
Hi Dave,
The bean is set as part of the request in the Servlet before forwarding to the JSP.
LQFPrime_DataBean pdbean = new LQFPrime_DataBean();
request.setAttribute("detailDataBean", pdbean);
In the bean the default constructor is:
public LQFPrime_DataBean() {
super();
}
But however in the JSP the first line which is
<jsp:useBean id="detailDataBean" scope="request" class="com.xyz.beans.LQFPrime_DataBean" />
where the JSP crashes and throws:
ServletInstan X Uncaught service() exception thrown by servlet {0}: {1}
"JSP 1.1 Processor"
org.apache.jasper.JasperException: Unable to compile class for JSP "/beans/lqfmodule/jsp/lqf_details_packaging.jsp" error: An error has occurred in the compiler; please file a bug report (http://java.sun.com/cgi-bin/bugreport.cgi).
1 error
The stack trace does not point to a line number in specific.
Hope this helps..
Mukund
Dave Vick
Ranch Hand

Joined: May 10, 2001
Posts: 3244
Mukund
The line looks fine to me. Try commenting out that line and getting the bean from the request object with getAttribute( ) - just to make sure that that works. If that works then douible and triple check all of the spelling and punctuation in the line that gives the error. I had an extra space in a tag once that took me a couple of hours and a lot of frustration to find. If everything is ok then try to do what it said and submit a bug report.
Hope you figure it out
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSP/Java Bean problem
 
Similar Threads
usebean and catching constructor exception
Servlets using beans' methods
Exception in Bean creation
How to Import a JAVA File in JSP
MVC Design