Meaningless Drivel is fun!*
The moose likes JSF and the fly likes Accessing bean data within a scriptlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Accessing bean data within a scriptlet" Watch "Accessing bean data within a scriptlet" New topic
Author

Accessing bean data within a scriptlet

Jason Wright
Greenhorn

Joined: Jul 08, 2009
Posts: 2
Hi,

I'm somewhat new to JSP, and I have a problem that I don't know how to solve.

I have two pages, Page1 and Page2. On Page1, the user inputs some data into text fields and hits a submit button. The Page1 binding attribute for the button processes this data, submits an SQL query and returns two things, an array and a number. The array corresponds to options for a set of checkboxes on page 2. The number is just the size of the array. There needs to be a text field next to every check box, so the size of the array is also the number of text fields that need to be generated.

The check boxes work fine since I can set the array from Page1 as the binding for the checkbox component. However, to dynamically generate the multiple textboxes I assume I need to set up a for loop in a scriptlet. This scriptlet needs to reference the number of text fields to be generated - how do you get that data from the Page1 bean?? Things I've tried that don't work:

- using <jsf:getProperty> inside a scriptlet
- using request.getParameter, though I might be doing that wrong
- referencing fields or methods in the Page2 bean

There has to be some way to do this. Please help!

EDIT: Using NetBeans 6, and I'd be happy to post code if anyone needs to look.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60804
    
  65

JSP or JSF?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Jason Wright
Greenhorn

Joined: Jul 08, 2009
Posts: 2
It's a JSP file, it just uses the Woodstock Visual Web JSF components. I meant to say I tried <jsp:getProperty>. Please let me know if my understanding of JSP/JSF is messed up...
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60804
    
  65

Moved to the JSF forum.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Accessing bean data within a scriptlet
 
Similar Threads
request object
How to make a JSP/HTML page to stay on itself when user clicks on back button on the browser?
Creating a custom scope... (kinda long)
variable carryover
how to display a check box using html:checkbox ?