• 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
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

print database values with radio button

 
Ranch Hand
Posts: 510
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I need to show all database values in a jsp with radio button for each row.
i can retreve database value.but how to attache radio button to it when showing it in a jsp?
 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is your requirement to show all radio buttons as one set. then hee is some sample code.

<% while(rs.next()) { %>
<input type="radio" NAME="heyou" value="<%=rs.getString(1)%>"><%=rs.getString(1)%>

<%}%>

 
Samanthi perera
Ranch Hand
Posts: 510
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
in database row there are 6 colums.
user need to select two colums.
user must selecl zone and payment type.
can you give me example code for with two radio button for onerow?
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
(Minus the scriptlet, plus a DTO, change the names to be what you need, plus whitespace and indentation to show structure and enhance clarity.)
 
Ranch Hand
Posts: 312
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do not use scriptless in JSP! And that rs there makes baby Jesus cry!

Samanthi perera wrote:in database row there are 6 colums.
user need to select two colums.
user must selecl zone and payment type.
can you give me example code for with two radio button for onerow?



I don't understand your problem, what do you want to show in the browser? A table with different columns and some of them selectable? Remember that with a radio type you can only select one element of the group. Maybe you should think on using checkboxes. Explain better what you want.
 
Samanthi perera
Ranch Hand
Posts: 510
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i need to show the zone and the type of the trip.
there are many zone types.
and there are there types of trips
ex
zone type1 type2 type3
1
2
3
4

user shuold be able to select zone and the one type of any type.
how to use radio button to do this?
is there any other way than radio button.
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you're *showing* values, just display the zone.

If you need to *select* a single value, create a radio button group with the appropriate labels and values.
 
Samanthi perera
Ranch Hand
Posts: 510
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
no it is not a single value.I need to select zone and type both.so there should be two radio button atleast.

zone type1 type2 type3
@ 1 @ @ @
@ 2 @ @ @
.......................................
 
Albareto McKenzie
Ranch Hand
Posts: 312
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What I understand is that you have different zones and different ways of paying and you can select one of the zones and trip type, is that correct?

Ex:

zone1 | zone2 | zone3 | ... | zoneN
trip1| trip2 | trip3 | ... | tripN

so user can select to go to zone3 and trip1, or zone2 and tripN.

If I am correct then you should have two radiobutton groups.
I think you should explain better what you need, also what you get from database, etc... is very difficult to figure out what you need with so few information.
 
Samanthi perera
Ranch Hand
Posts: 510
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you are correct.there are many zones and many types of paying ways.
can you give me exmple how to solve.
 
Albareto McKenzie
Ranch Hand
Posts: 312
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No, I cannot because I have no idea what you are getting from your database and how you receive it in your JSP, but I can guess that the desired generated html should be something like this (with more beautiful styles):



Then how to build it depends on the data you have.
 
Samanthi perera
Ranch Hand
Posts: 510
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
no .
zone , type1 , type2 ,type3

i need to select zone and one of any type.
so how the radio button codes gone?
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you really not extrapolate from what's above to get the appropriate collection of radio buttons?
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic