Results 1 to 13 of 13

Thread: Can't figure out this JasperException

  1. #1

    Thread Starter
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418

    Resolved 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; 
     }

  2. #2
    Addicted Member Phenix's Avatar
    Join Date
    Sep 2002
    Location
    Near A Cube
    Posts
    228

    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

  3. #3

    Thread Starter
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418

    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; 
     }
    }

  4. #4
    Addicted Member Phenix's Avatar
    Join Date
    Sep 2002
    Location
    Near A Cube
    Posts
    228

    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

  5. #5

    Thread Starter
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418

    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).

  6. #6

  7. #7

    Thread Starter
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418

    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;}

  8. #8
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190

    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
    ØØ

  9. #9

    Thread Starter
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418

    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.

  10. #10
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190

    Re: Can't figure out this JasperException

    It never catched my eye at all... Never found the use for it.

  11. #11
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    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.

  12. #12

    Thread Starter
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418

    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

  13. #13

    Thread Starter
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418

    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
  •  



Click Here to Expand Forum to Full Width