how auto populate jsf edit forms

F

festo

Hi guys,

how do I get a form to auto populate in jsf/jsp when the user clicks
the edit button.
That is if there is a radio button that had been previously checked, to
have it correctly checked, if a drop down item was selected , to have
that item selected?
Please help

PapaJo
 
C

conlan

festo said:
Hi guys,

how do I get a form to auto populate in jsf/jsp when the user clicks
the edit button.
That is if there is a radio button that had been previously checked, to
have it correctly checked, if a drop down item was selected , to have
that item selected?
Please help

In the bean, have something along these lines:
-------------------------------------------------------------------------------------------
public boolean isMyRadioChecked()
{
return myRadioChecked;
}

public void setParam(String value)
{
myRadioChecked = true;
// your code here
}

private boolean myRadioChecked;
-------------------------------------------------------------------------------------------
then in your page, have:

<input type="radio" name="param" value="value" ${bean.myRadioChecked ?
"checked" : ""}>

so when myRadioChecked == true, your radio button code will turn out
like this:

<input type="radio" name="param" value="value" checked>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top