Go Back   CodingForums.com > :: Server side development > Java and JSP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-26-2008, 04:15 PM   PM User | #1
damo.gets
New Coder

 
Join Date: Aug 2008
Location: Bismarck, ND, USA
Posts: 17
Thanks: 1
Thanked 0 Times in 0 Posts
damo.gets is an unknown quantity at this point
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
damo.gets is offline   Reply With Quote
Old 12-29-2008, 06:09 PM   PM User | #2
damo.gets
New Coder

 
Join Date: Aug 2008
Location: Bismarck, ND, USA
Posts: 17
Thanks: 1
Thanked 0 Times in 0 Posts
damo.gets is an unknown quantity at this point
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
--++==***==++--
damo.gets is offline   Reply With Quote
Reply

Bookmarks

Tags
array, bean, passing, setproperty, usebean

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:59 AM.


Advertisement
Log in to turn off these ads.