Win a copy of React Cookbook: Recipes for Mastering the React Framework this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Rob Spoor
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Holloway
  • Piet Souris
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Frits Walraven
  • Himai Minh

Accessing bean data within a scriptlet

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Sheriff
Posts: 67583
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
JSP or JSF?
 
Jason Wright
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 67583
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moved to the JSF forum.
 
If you were a tree, what sort of tree would you be? This tiny ad is a poop beast.
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic