Win a copy of Practice Tests for OCP Java 17 Certification Exam (1Z0-829) this week in the OCPJP 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:
  • Tim Cooke
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Scott Selikoff
Bartenders:
  • Piet Souris
  • Jj Roberts
  • fred rosenberger

JSP-Bean question

 
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi guys,
In a JSP page I have to collect the same data type belonging to a variable number of persons. I can place the components (first name, last name, etc) in a "for" statement to display x times but I don't know how to collect them in a bean.
Can anybody point me in the right direction?
Thank you in advance.
Regards,
Adrian
 
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
every thing in its place.
create a class like this:

and use this bean in your class - have an array of them.
then your loop will look something like this:

so your loop is short and your data is in its bean.
[ March 16, 2002: Message edited by: greg philpott ]
 
Adrian Muscalu
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not sure th above solution will suit me... I was looking for something like "press the SUBMIT button and all the data in the jsp page to fill firstName[], lastName[], etc" in the bean. It works just fine for textboxes; if I have multiple textboxes with the same name on a page and the correspondent method in the bean to receive an array instead of a simple String, all it's done automatically. With one exception. The radio objects. This is because if multiple radio objects have the same name, only one value will be submitted. I couldn't find a solution for the radio objects.
I would appreciate any help in this direction, I've already spent too much time for this problem.
Best regards,
Adrian
[ March 18, 2002: Message edited by: Adrian Muscalu ]
 
pie. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic