Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Aug 2008
    Location
    Bismarck, ND, USA
    Posts
    17
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Question Have any examples of a Bean setting an array and passing it to JSP?

    Okay, I've kind of got 2 requests in this post:

    1. First, does anybody have a code example of a bean setting values to an array (of pretty much any data primitive) and then passing that back for display or other utilization from a pure .jsp file? I believe that I was looking in the wrong areas previously for where my bug might lie. More reading over the Xmas break has led me to believe that I'm not currently passing the values, and/or not utilizing the Bean coding style properly when it comes to method declaration and utilization.
    2. Last, a simple question without code examples to dig through: I'm attempting to utilize a bean in which I am setting several values for processing with a <jsp:useBean ...> and <jsp:setProperty ...> ... chunk of tags within a .jsp. After this point, I use a scriptlet to call a method from within that same bean class; this is not a public ... getWhatever() or public ... setWhatever() method; I have coded it in the style of a normal java method. After getting to this point, I have attempted to access that method for processing through a <% ... %> embedded scriptlet, and through putting code that calls these other methods from within a method I called getHttpBuffer() which is supposed to return a string value after calling the processing methods. None of these methods are returning anything except for nulls. The only values that I can bring back are the ones that I have explicitly set with <jsp:setProperty> and the corresponding bean method, at least when attempting to access these properties through <jsp:getProperty> and/or a <% ... %> embedded scriptlet.


    Any pointers on where I might be screwed up here would be very much appreciated.

    Damon Getsman - ITRx
    http://www.ITRx-ND.com/
    Programmer/IT Customer Relations/Linux & Solaris Sysadmin

  • #2
    New Coder
    Join Date
    Aug 2008
    Location
    Bismarck, ND, USA
    Posts
    17
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Thumbs up resolved: array passing

    Issue was quite simple. I was following a bogus example from a book where my two arrays were defined as follows:

    Code:
    public int [] x = new int [MAX_CONSTANT1];
    public int [][] y = new int [MAX_CONSTANT2][];
    instead of having the 2-dimensional array declared with both array dimensions set.

    I knew it was something ridiculously simple.

    --++==***==++--
    -Damon A. Getsman
    http://www.zoominfo.com/people/Getsm...n_-214241.aspx
    http://www.ITRx-ND.com/
    Programmer/IT Customer Relations/Sysadmin
    --++==***==++--


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •