Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Struts and the fly likes autoselect the radio button if the list has only 1 item Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "autoselect the radio button if the list has only 1 item" Watch "autoselect the radio button if the list has only 1 item" New topic
Author

autoselect the radio button if the list has only 1 item

sourabh chhabra
Greenhorn

Joined: Mar 22, 2012
Posts: 3
i want know how to auto select the htmlption (radio button field) tag inside the logic:iterate tag if the property being iterated has size 1
Vicky Vijay
Ranch Hand

Joined: Apr 23, 2008
Posts: 125
Hi sourabh,

Can you explain the problem statement clearly !?

Do you need Drop down or Radio Button ?

Why logic:iterate ?

What you really intend to achieve ?


Provide Complete Information, so that you can fetch the solution quicker
sourabh chhabra
Greenhorn

Joined: Mar 22, 2012
Posts: 3
hi vicky

i have a search page which displays me the result in a tabular structure. The first column of the table is radio button which when selected activates the next button on the page.

the table is populated inside a logic iterate tag which iterates on a list of object which contains the information which is to be displayed.

I want that if the list on which the logic iterate tag iterates has just 1 element in it, the radio button displayed in the first column for that record should be auto selected.

the code snipped on jsp is

 
It is sorta covered in the JavaRanch Style Guide.
 
subject: autoselect the radio button if the list has only 1 item