|
-
Jan 8th, 2005, 06:02 PM
#1
Thread Starter
Dazed Member
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. 
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;
}
Last edited by Dilenger4; Mar 17th, 2005 at 04:30 PM.
Reason: Resolved
-
Jan 14th, 2005, 01:55 PM
#2
Addicted Member
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.
Last edited by Phenix; Jan 14th, 2005 at 02:01 PM.
Reason: Added case-sensitive comment
Circa 1995
Engineer - I think we should put our website address on our paper catalogs.
Vice President - Don't get too excited about this internet thing.
I am sorry, but the Oracle was mistaken. You cannot help us.
-Matrix video game
I'm doing a (free) operating system (just a hobby, won't be big and professional like gnu) for 386(486) AT clones. ... and it probably never will support anything other than AT-harddisks, as that's all I have :-(.
-Linus
Question. Do you know that the character "?" means I'm asking a question? Question. Do you know that spoken inflection also provides the same cue? So please don't say, "Question" before you ask your question. Believe me I'll know.
That said, I would have said this first if it had to precede what I'm telling you now. Having said that, what I'm telling you now is the same thing I just said about the annoying phrases "That said" and "Having said that".
Are you threatening me, Master Jedi?
-Chancellor Palpatine
-
Jan 14th, 2005, 03:20 PM
#3
Thread Starter
Dazed Member
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. 
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;
}
}
-
Jan 14th, 2005, 05:12 PM
#4
Addicted Member
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.
Last edited by Phenix; Jan 14th, 2005 at 05:29 PM.
Reason: Added Scratch that comment
Circa 1995
Engineer - I think we should put our website address on our paper catalogs.
Vice President - Don't get too excited about this internet thing.
I am sorry, but the Oracle was mistaken. You cannot help us.
-Matrix video game
I'm doing a (free) operating system (just a hobby, won't be big and professional like gnu) for 386(486) AT clones. ... and it probably never will support anything other than AT-harddisks, as that's all I have :-(.
-Linus
Question. Do you know that the character "?" means I'm asking a question? Question. Do you know that spoken inflection also provides the same cue? So please don't say, "Question" before you ask your question. Believe me I'll know.
That said, I would have said this first if it had to precede what I'm telling you now. Having said that, what I'm telling you now is the same thing I just said about the annoying phrases "That said" and "Having said that".
Are you threatening me, Master Jedi?
-Chancellor Palpatine
-
Jan 14th, 2005, 05:32 PM
#5
Thread Starter
Dazed Member
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).
-
Mar 15th, 2005, 11:10 PM
#6
Thread Starter
Dazed Member
Re: Can't figure out this JasperException
-
Mar 16th, 2005, 11:35 AM
#7
Thread Starter
Dazed Member
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;}
Last edited by Dilenger4; Mar 16th, 2005 at 12:05 PM.
-
Mar 16th, 2005, 12:05 PM
#8
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
ØØ
-
Mar 16th, 2005, 12:08 PM
#9
Thread Starter
Dazed Member
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.
-
Mar 16th, 2005, 12:11 PM
#10
Re: Can't figure out this JasperException
It never catched my eye at all... Never found the use for it.
-
Mar 16th, 2005, 05:36 PM
#11
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.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Mar 16th, 2005, 06:17 PM
#12
Thread Starter
Dazed Member
Re: Can't figure out this JasperException
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
-
Mar 16th, 2005, 06:46 PM
#13
Thread Starter
Dazed Member
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|