Can't figure out this JasperException
I keep getting the following error but i don't know how to fix it. Everything looks to be in order. :confused:
org.apache.jasper.JasperException: Cannot find any information on property 'firstname' in a bean of type 'com.MyCompany.Beans.OutputInfo'
Here is a part of my .jsp page
Code:
First Name:<jsp:setProperty name = "outputinfo" property = "firstname"
value = "${param.fname}"/><br>
and here is part of my bean
Code:
package com.MyCompany.Beans;
import java.io.*;
public class OutputInfo implements Serializable{
private String firstname;
public OutputInfo(){}
public void setFirstName(String firstname){
this.firstname = firstname;
}
public String getFirstName(){
return firstname;
}
Re: Can't figure out this JasperException
I haven't really played with beans or jsp in a very long time, but maybe you can only access it through the get method from the jsp page since it is private.
I assume the error is from the jsp page and not when compiling the OutputInfo class.
Also, is OutputInfo case-sensitive in the jsp page? Perhaps it's only mistyped in the post because the error message is in the correct case.
Re: Can't figure out this JasperException
Ok Say i have the following.
Code:
<jsp:setProperty name = "outputinfo" property = "firstname"
value = "${param.fname}"/><br>
What does property = "firstname" apply to? The get and set methods within the bean or the beans field with the same name? Both the beans below produce the same Jasper error. :confused:
Code:
package com.MyCompany.Beans;
import java.io.*;
public class OutputInfo implements Serializable{
private String firstname;
public OutputInfo(){}
public void setFirstName(String firstname){
this.firstname = firstname;
}
public String getFirstName(){
return firstname;
}
}
Code:
package com.MyCompany.Beans;
import java.io.*;
public class OutputInfo implements Serializable{
private String firstname;
public OutputInfo(){}
public void setfirstname(String firstname){
this.firstname = firstname;
}
public String getfirstname(){
return firstname;
}
}
Re: Can't figure out this JasperException
My main thought was I meant in the java source, you have this:
Code:
private String firstname;
So I was assuming that you should not be able to access it from the jsp (i.e. no access from outside its class) as a property.
But the get method getFirstName() is public, so maybe you can use that from jsp.
My point about case-sensitivity was that maybe this should be changed
<jsp:setProperty name = "outputinfo"
to
<jsp:setProperty name = "OutputInfo"
in the jsp page.
Are you saying you get a Jasper error when compiling the Beans? I'm assuming no, and that the error is from calling the jsp page. I'm in over my head after that. This says "You must use a <jsp:useBean> tag to declare the Bean before you use <jsp:setProperty>".
http://java.sun.com/products/jsp/tag...xref.fm13.html
Do you have that covered?
Scratch that. I'm in over my head period. This example doesn't seem to be about private/public http://www.oracle.com/technology/sam...Bean.java.html
The only other usefull thing in my reply is that maybe you don't have the <jsp:useBean> tag. I'll have to wait till I get home to check in my books to be of any help. Sorry.
Re: Can't figure out this JasperException
Access to the private field in the bean shoud be fine since it's via the beans interface ie the get and set methods.
Im pretty sure that the name attribute within the <jsp:setProperty> tag can be any identifer that you wish. Sorta like what you choose as the id attribute in the <jsp:usebean id = "whateveryouwant" class = "outputinfo"/> tag.
The bean compiles fine. So there isn't a problem going on in the translation phase(at least as far as i can tell). It's with the request processing phase(when the JSP container invokes the JSP page implementation class).
Re: Can't figure out this JasperException
Re: Can't figure out this JasperException
Jsp is retarded.
Code:
// works
private String output = "Brandon ";
public String getOutput(){return output;}
//don't work
private String nameoutput = "Brandon ";
public String getNameOutput(){return nameoutput;}
//dont work
private String nameoutput = "Brandon";
public String getnameOutput(){return nameoutput;}
Re: Can't figure out this JasperException
If it is not too much trouble. Care to tell us what you had to do? So we can refer to it next time (if evere) it is asked.
Thanks
ØØ
Re: Can't figure out this JasperException
I thought i had it working at first but it seems i have to recompile my bean from the command line then resave the jsp page in order to see if any changes i make to the bean work or not. Jsp is starting to get annoying. :mad:
Re: Can't figure out this JasperException
It never catched my eye at all...:) Never found the use for it.
Re: Can't figure out this JasperException
And you worked the capitalization thing out? Beans are very simple. You have a bean property called "abcDefGhi", the setter is called "setAbcDefGhi" and the getter "getAbcDefGhi". I believe this capitalization is important, but it's also dead simple to remember, so there should be no problems.
The other steps are quite clear, too. Nowhere does JSP claim that it compiles beans. It only processes and compiles the JSP pages themselves.
*shrug*
I suppose it depends on the way you approach the whole thing. I wish I could get the Manager servlet working for virtual hosts.
Re: Can't figure out this JasperException
Quote:
Posted by CornedBee
And you worked the capitalization thing out?
Yeah it was just odd though. For instance i just came back to my computer. The bean was the same bean i ran before with no errors.
Code:
private String output = "Brandon Rohlfs";
public String getOutput(){return output;}
I changed the bean
Code:
private String name = "Brandon Rohlfs";
public String getNameoutput(){return nameoutput;}
everything works. Now change back to the old bean
Code:
private String output = "Brandon Rohlfs";
public String getOutput(){return output;}
org.apache.jasper.JasperException: Cannot find any information on property 'output' in a bean of type 'com.TestBean'
I think it has to do with the memory within the server. Check out number four "Turn on servlet reloading". http://www.coreservlets.com/Apache-T...0-and-4.0.html
Re: Can't figure out this JasperException
I scaned the server.xml file for <Host name="localhost" debug="0" appBase="webapps" ...> and added this line right after it <DefaultContext reloadable="true"/> Seems to have worked.