How can I make JSF checkboxes selected by default?

Hi everyone,
I have a problem in setting default value for checkboxes. I use them in a table. tableRowGroup's sourceData property is a list data provider. In the page bean I have the following code to select rows:
private TableSelectPhaseListener tablePhaseListener = new TableSelectPhaseListener();
    public void setSelected(Object object) {
        RowKey rowKey = (RowKey)getValue("#{currentRow.tableRow}");
        if (rowKey != null) {
            tablePhaseListener.setSelected(rowKey, object);
    public Object getSelected(){
        RowKey rowKey = (RowKey)getValue("#{currentRow.tableRow}");
        return tablePhaseListener.getSelected(rowKey);
    public Object getSelectedValue() {
        RowKey rowKey = (RowKey)getValue("#{currentRow.tableRow}");
        return (rowKey != null) ? rowKey.getRowId() : null;
    public boolean getSelectedState() {
        RowKey rowKey = (RowKey)getValue("#{currentRow.tableRow}");
        return tablePhaseListener.isSelected(rowKey);
    }I received a list of objects from a service using list data provider and use checkboxes to select them. Then I get the selected checkboxes in the action method of the page bean using
RowKey[] selectedRows = getTableRowGroup1().getSelectedRowKeys(); What I want to do is to set all the checkboxes as selected by default. Normally, this is performed by assigning the same values to selected and selectedValue properties of the checkbox component. But, in my case this is not applicable since we take advantage of getSelected() and getSelectedValue() methods in the pagebean. Properties of my checkbox component are as follows:
<ui:checkbox binding="#{MyPage.checkBox1}"
                                                    id="checkBox1" selected="#{MyPage.selected}" selectedValue="#{MyPage.selectedValue}"/>I cannot assign same values to selected and selectedValue. Can anyone help me to make these checkboxes selected as it is rendered?

Hi Fanado,
In Finder, click once on an Excel document then Get Info (command i)
Choose Open with: Numbers
Then Change All... to make Numbers the app for all Excel documents.
The same for Word and Powerpoint
Regards,
Ian.

Similar Messages

  • Make html:checkbox selected by default depending upon bean value --struts

    Hi all,
    I have a doubt regarding the html:checkbox .
    I have the following code in my jsp.
    I am giving it inside logic:iterate tag and fetching the value from session scope.
    <html:checkbox property ="readchk" value ="read" indexed="true" onclick="return assignme(this.value,this.checked,'s')"/>
    How to make this checkbox selected by default.
    "readchk" (bean) is in my ActionForm, it has been been assigned either
    0 or 1 .
    I want to make the checkbox selected by default if the readchk is 1
    and the checkbox not selected if the readchk value is 0.
    Could anybody please help me out in fixing this problem.
    Thanks
    Parvathi

    If u give the value for ur check box in the action form it wld be checked!!
    regards
    Shanu

  • How can I make a row selected in JTable?

    I want to make a row selected and highlighted in JTable programmatically.
    But, I couldn't find method like setSelected(int row).
    How can I do this?

    try this ....
    private void makeRowVisible(JTable table, int row) {
         java.awt.Rectangle cellRect = table.getCellRect(row, 0, true);
         if (cellRect != null) {
              table.scrollRectToVisible(cellRect);
    }

  • How can I make "Numbers" the soft by default ?

    Hello you all,
    I want to get off Windows. How can  I open incomming Windows files ( Word, excel,Ppoint) aqutomatically by i Work software?
    thanks for your suggestions
    Fanando

    Hi Fanado,
    In Finder, click once on an Excel document then Get Info (command i)
    Choose Open with: Numbers
    Then Change All... to make Numbers the app for all Excel documents.
    The same for Word and Powerpoint
    Regards,
    Ian.

  • How can I make folder View Options the default in Snow Leopard?

    Hi everybody! Here I am, learning to Mac!
    When I do a secondary click on an open folder's background and click on +show visualization options+ (actually, +mostrar opciones de visualización+ in spanish), there's an option +set as default+ ( +ajustes por omisión+ ) which, as far as I understood, should change all the rest folder's aspect, as icon's size, font size, background image and so on... but all the rest folder's aspect keep being shown as before, just the folder where I am working changes.
    My questions are: if I am wrong with the use of that "ajustes por omisión", what is it for? And how can I personalize the aspect of all folders on my mac?
    Thanks for your help

    It's "show view options" in English. Also obtained by typing CMD+J
    Those only apply to the top-level folder. Each folder you open uses whatever you've elected to use as the defaults. Select a folder, CMD+J, set the view as you desire, click on Use as Default button. That setting will be used for all windows that you open in the future that have never been opened previously. All other windows that you opened will retain whatever view you previously selected for them.
    If you want to reset everything to one view, close all open Finder windows, launch the Terminal app (/Applications/Utilities/), copy & paste this command into the window that pops up,
    find ./ -name ".DS_Store" -depth -exec rm {} \;
    hit the return key, quit the Terminal app, restart, open a Finder window, CMD+J, set up the view options as desired, click the Use as Defaults button, and close the view options window. Now, every Finder window you open will have this view.
    Once you sort this out, see:
    Switching from Windows to Mac OS X,
    Basic Tutorials on using a Mac,
    Mac 101: Mac Essentials,
    Mac OS X keyboard shortcuts,
    Anatomy of a Mac,
    MacTips, and
    Switching to the Mac: The Missing Manual, Snow Leopard Edition.
    Additionally, *Texas Mac Man* recommends:
    Quick Assist,
    Welcome to the Switch To A Mac Guides,
    Take Control E-books, and
    A guide for switching to a Mac.

  • How can i make an external Hard drive default for iphoto

    I have maxed out my memory on my MacBook with iPhoto 09.  I have been trying to export photos to an external HD and then make the external HD my default drive for future photo downloads from my camera.  Also, I need to clean off space on the internal HD, but not sure of the safest way to do this and make sure I don't loose any photos.  Any tips to move forward?  I am a Mac novice to say the least.  
    Thanks

    Make sure the drive is formatted Mac OS Extended (Journaled)
    1. Quit iPhoto
    2. Copy the iPhoto Library from your Pictures Folder to the External Disk.
    3. Hold down the option (or alt) key while launching iPhoto. From the resulting menu select 'Choose Library' and navigate to the new location. From that point on this will be the default location of your library.
    4. Test the library and when you're sure all is well, trash the one on your internal HD to free up space.
    Regards
    TD

  • How Can I Make Several RT Selections Without Window Closing?

    This applies to countless Mac settings in numerous apps and not just the RT settings.
    When I want to change the RT settings, the moment I select one the window/menu closes and I have to click the RT button again to select the second setting and so on.
    Basically I want to keep the window/menu open until I have adjusted/selected all the parameters.
    I have put up with this type of thing happening for nearly 9 years.
    Is this the way it has to be or is there a simple fix I have ben oblivious to for all this time?

    Hi -
    IMHO, the Mac human interface has always been simple:
    Select and Do.
    If the "Do" is a menu choice, the choice is applied and the menu disappears.
    If the "Do" is a call for a Dialog box to make user choices, the menu disappears and the Dialog box opens and remains open until closed by the user.
    Examples:
    Menu Edit > Paste will paste the copy of the clipboard to your document and promptly disappear.
    Menu Edit > Paste Attributes . . . will open a Paste Attributes Dialog box, and the dialog box will need to be closed by the user.
    The way to tell if the menu item is going to perform an action or call for a Dialog Box for more user choices is if the menu item is followed by an Ellipsis ( . . . ).
    Perhaps the best way to accomplish what you want is to use Feedback to ask for an RT Dialog Box in addition to the RT menu.
    MtD

  • How can I make my iCloud email my default email on my apple ID?

    I made a icloud email with my apple id that a created with a gmail years ago. I want to make my @me email my defult one, and my secondary the gmail one, basicaly stwich the two.

    I'd like to do the same thing. I don't use my gmail address anymore and would like to only use my me.com address.
    My account website give me the option to change my primary email adress to the new one:
    "Make your Apple ID and primary email address one and the same.
    Your Apple ID will be easier to remember, and your account will be easier to access and manage.
    Change your Apple ID and primary email address to:"
    But it doesn't let me change my actual Apple ID email adress. When I try, it says:
    "You cannot create an Apple ID using a MobileMe account. If this is your email address, it is also your Apple ID."
    Except it's not a MobileMe account. It's an iCloud account.
    And what's even more weird is I can use my me.com address to sign in to my account. Actually, it'll let me use both the gmail and the me.com address to sign in on the website, in iTunes, the Mac Appstore, everything.

  • How can I make this desktop dialogue box default on a larger size?

    When I do a "save as" with a document, the dialogue box is so small I have to scroll to reach the folder I want it in.  Then I have to drag the corner to make it larger. 
    Is there a way to make this box default on a larger size so I can see more file choices?  see pic

    Hold down option as you resize the window.

  • How can I make AOL Desktop software my default e-mail when trying to connect from a a web site on Firefox?

    When I click on a link on a website meant for e-mailing--using Windows 7 I no longer have the option of sending it through my AOL Desktop software as I used to in Windows XP. Is there an option in Firefox that will allow me to use the AOL Desktop software as my default e-mail program?

    This didn't work. There is no option provided in Firefox for AOL--no add on either. And windows 7 does not let you use a browser based e-mail--even you change the registry--it will bring you to the AOL browser but won't open a "write" e-mail box and enter the name of the recipient automatically as it did in Windows XP by changing the option in internet options...someone must have a way of doing this...

  • How can I make Photoshop Cc 2014 my default. I have tried the get info route and it keeps defaulting to PS CS6

    I have tried to change the default PS to CC 1014 using "Get Info" changing it to PS CC 2014 and then "change all" And when I press continue it defaults back to PS CS6

    What OS are you using.  If Windows check your windows register key Photoshop shell sub-keys command for Open and Edit are set to CC 2014 not CC 14.2.1.

  • To make a checkbox checked by default

    hi all,
    I am using struts framework
    and I am using the below line for creating a checkbox
    <html:checkbox property="name" value="Y" /></td>
    How can I make the checkbox checked by default
    thanks

    set value="something" in ur jsp
    then in 2 ways u can set default values
    1--- by setting that value in formbean
    2--- by using setProperty() method in ur action
    if that value matchs... then corresponding controll set defualt

  • I synced two of my email accounts via gmail's POP3 thing. But now my iphone's gmail inbox shows a random selection of emails (not most recent ones that are in my inbox). How can I make my iphone inbox match what I see when I log on using a PC?

    I synced two of my email accounts via gmail's POP3 capabilities. But now my iphone's gmail inbox only shows a random selection of emails (i.e. right now it is May 31, 2013 but the emails in my inbox are a couple from Nov 12, a few from Oct 12, and then some way older than that and so on.When I log into my gmail from a computer, I see all my emails in the logical, standard order. How can I make my iphone inbox match what I see when I log on using a PC?

    If you're trying to decide between using POP and IMAP, we encourage you to use IMAP.
    Unlike POP, IMAP offers two-way communication between your web Gmail and your email client. This means when you log in to Gmail using a web browser, actions you perform on email clients and mobile devices (ex: putting mail in a 'work' folder) will instantly and automatically appear in Gmail (ex: it will already have a 'work' label on that email the next time you sign in).
    IMAP also provides a better method to access your mail from multiple devices. If you check your email at work, on your mobile phone, and again at home, IMAP ensures that new mail is accessible from any device at any given time.
    Finally, IMAP offers a more stable experience overall. Whereas POP is prone to losing messages or downloading the same messages multiple times, IMAP avoids this through two-way syncing capabilities between your mail clients and your web Gmail.
    That is from the page that you linked- does highlighted part of message ring a bell?

  • How can I make new pages software spellcheck a selection like in appleworks?

    How can I make new pages software spellcheck a selection like in appleworks?
    I just installed pages a new download from apple store.
    1. I cannot find any way to activate a spellcheck for a selection in a document.
    2. I want to elemenate a red line under a word it doesn't like the spelling of.

  • "I have to manually select pop up blocker everytime i open firefox. how can i make it permenent?'

    i have to manually select pop up blocker everytime i open new firefox window. How can i make this arrangement permenent?
    == This happened ==
    Every time Firefox opened
    == a week ago

    See http://kb.mozillazine.org/Preferences_not_saved

Maybe you are looking for