Render(true or false) on initial request

Hello all,
I have a JSF page which has a button (HtmlCommandButton) on. I want the button to be rendered/displayed depending on a value in the session. How can I do this?
I have the button binded to a HtmlCommandButton instance field member of the AddCaseForm managed bean (see below). On the initial request though I am getting a NullPointerException because in the constructor of the ManagedBean I do :
if(valueFromSession == whatever){
          offenderFindButton.setRendered(false);
      }else{
          offenderFindButton.setRendered(true);
      }BUT the offenderFindButton is actually null intially. How can I get around this?
TAG
<h:commandButton type="button" value="Find"
                                       binding="#{AddCaseForm.offenderFindButton}"
                                       immediate="false"/>
ManagedBean Field
In MangedBean the field is: private HtmlCommandButton offenderFindButton;Thanks much,
Any help would be greatly appreciated.

I wonder, why you do not like just using the
'rendered' attribute of the commandButton for this
purpose?Thanks Sergey it seemed to have worked. I did not really think of doing it that way. I thought that you could have been able to do it from within the constructor of the backing bean since the button was binded to a instance member of the backing bean class.
I am actually still curious why it did not work and why the command button instance field was not initialized by the time the constructor of the backing bean executes on the initial request. Could someone please explain if possible?
Thanks again.

Similar Messages

  • How to set render true or false in java class

    Use case:
    i have a page in which i have one inputListOfValues attributes and two LOV .initial the LOV render attribute value is false .it means it show only one attribute in run time .inputListOfValues is content two value .suppose if first value A then the first LOV have to show and is it value is B then Second LOV have to show .i bind my LOV to class .but i do not know how to set render attribute at java class.

    <af:inputListOfValues label="Branch Name"
    popupTitle="Search and Result Dialog"
    id="ilov1"
    model="#{pageFlowScope.organizationLOV.param['bindings.Organization'].listOfValuesModel}"
    converter="#{pageFlowScope.organizationLOV.param['bindings.Organization'].convert['latinDesc']}"
    valueChangeListener="#{viewScope.salaryBenefitsReportForm.branchChange}"
    binding="#{viewScope.salaryBenefitsReportForm.branchName}"
    rendered="true" visible="false"/>
    <af:inputListOfValues label="Department Name"
    popupTitle="Search and Result Dialog"
    id="ilov2"
    model="#{pageFlowScope.objectLOV.param['bindings.Department'].listOfValuesModel}"
    converter="#{pageFlowScope.objectLOV.param['bindings.Department'].convert['latinDesc']}"
    valueChangeListener="#{viewScope.salaryBenefitsReportForm.departmentChange}"
    binding="#{viewScope.salaryBenefitsReportForm.departmentName}"
    rendered="true" visible="false"/>
    this is code in jsff .
    and class code are following
    public void reportBy(ValueChangeEvent valueChangeEvent) {
    String value=(String)valueChangeEvent.getNewValue();
    System.out.println(value);
    if(value.equals("Branch")){
    branchName.setVisible(true);
    departmentName.setVisible(false);
    AdfFacesContext.getCurrentInstance().addPartialTarget(branchName);
    AdfFacesContext.getCurrentInstance().addPartialTarget(departmentName);
    if(value.equals("Department")){
    departmentName.setVisible(true);
    branchName.setVisible(false);
    AdfFacesContext.getCurrentInstance().addPartialTarget(departmentName);
    AdfFacesContext.getCurrentInstance().addPartialTarget(branchName);
    }

  • DataTable on initial request

    Hi,
    I have a DataTable component with more than 500 rows, so I have used paging, displaying 10 rows at a time. Each row displays details for an employee, such as ID, First Name, Last Name ... etc. I also have separate pages to add and edit an employee. Hence i have a main page, an edit page and an add page.
    Edit and add buttons on the main page all work fine, taking me to the edit and add pages respectively. My problem is when navigating back to the main page from either add or edit pages. For example, after editing, I want the DataTable to display the row just edited. Similarly, after adding a new employee, the data table should display the employee just added. Either case, the data table always displays the first item, at index 0.
    When navigating back to the main page, the data table (surprisingly) returns the following: -
    getFirst() = 0
    getRowIndex() = -1
    getRowCount() = 0and in no way can alter the position of the first row. neither are beforeRenderResponse() and afterRenderResponse() methods called, where I could manipulate the data table.
    Is this because this is an initial request? How can i solve the problem? For instance, can I use the FacesContext instance? If so, how?

    Hi,
    Here is what I did to diplay the just edited / added record on going back to the main page:
    I added a property to the session bean called stat of datatype boolean. The initial value I set it to false. I added another property corresponding to the primary key. After successfully modifying / adding a record I set the session bean property value of with the edited / added rows corresponding value. Also I set the boolean property to true. In the main page constructor I have an if(sessionBean1().is<booleanProperty>) block. The contents of the block for the sample application I developed are like this:
    personRowSet.setCommand("SELECT * FROM TRAVEL.PERSON WHERE JOBTITLE=?");
    dataTable1Model.setObject(1,this.getSessionBean1().getJobTitle());
    dataTable1Model.execute();
    I was able to display the rows that just got added or edited.
    Hope this helps you.
    Cheers :-)
    Creator Team

  • Initial request and reconfig question

    Hi there,
    Why does the web server issues requests to itself when it startup or reconfig is invoked?
    For the two initial request, if the NameTrans function from a plugin returns error, the error function(s) are not invoked.
    Also can a plugin register for notification of the reconfig. i.e., can the plugin know the the reconfig happened?
    Thanks
    -Seshubabu Pasam

    From what I can see it looks like Spring is on the roadmap and since BEA is now in the game they will incorporate Pageflows, Controls (Beehive), Open Standard Portal Engineering, SOA stuff, and more ease of use. ;->.
    Hopefully M7 remains true to the Anti-Vendor-Lockin pattern. It takes courage for BEA to go this way, but customers and the engineering scene will applaud to this, and I guess that this will put BEA in a good light, and those who wish to get nice and easy to manage and professional infrastructure, they will also pay for that (to make a living for M7 and BEA staff). Like I was ready to pay from NitroX Studio. I bought it, because it had this "no vendor lock in tag" on it and it was much easier to code with than with other products.
    On the other side the Open Source and the ISV scene can build applications that can run on the Service Oriented Operating System, and on any App and Portal Server. And this becomes easy.
    Everybody will win from this.

  • Applescript help with true or false script

    I'm in need of a applescript that will run two different scripts based on the outcome of an existing file.
    I have a folder called Status. Inside this folder is a simple text file called Good.rtf
    I would like a script that would run one or the other script base on the true or false output.  If file exists then:
    true will
    run script A
    false will
    run script B
    I have been searching the web for two days looking for something to help me get started on this and have not had much success.
    Please help me.   I really would appropriate any help or guidance. 
    Thanks....
    Ron

    Ron
    AppleScript calls this kind of script a "Conditional" = if this > then that
    Some templates are in MacintoshHD/Library/Scripts/Script Editor Scripts/Conditionals
    You don't need a value for "false" in binary as it is merely "not true" (else)
    if true then
        -- insert if actions here
    else
        -- insert else actions here
    end if
    If you already have your Scripts A & B working, copy>pastethem into the "insert actions here" part as appropriate
    ÇÇÇ

  • The case structure is not working well on comaring two strings using true or false string matching VI

    I need an execution of commands after the reply from the instrument matches with the string I provided for that i used true or false string match VI on which the true string the matching command and the string is the reply from the instrument. And I put the further executionable commands in frame after frame of sequence loop in the true of the case structure. Amd finally I given all the output strings to the concatenate string to get all the replies as one loop. But when I execute the program the desired result is not available. So kindly please help me to overcome this problem.  
    Attachments:
    basic serial with changes.vi ‏24 KB

    You VI makes absolutely no sense and I would recommend you start with a few simple LabVIEW tutorials before trying to tackle this.
    What is the point of the FOR loop with 1 iteration, it might as well not even be there, same difference.
    Why is there an abort primitive in the FOR loop, this mean the program will unconditionally stop abort before any downstream code will ever go into action. The program will never get past the FOR loop.
    You created a circular data dependency and LabVIEW inserted a feedback node automatically, making things even worse. (see also)
    You need to learn about dataflow, execution order, and data dependency.
    You need to learn about the various types of tunnels (plain, autoindexing, etc.)
    There is a tremendous amount of duplicate code. Large code sections are the same, differeing only by a string. You should only have one copy of that code inside a proper state machine. Have a look at the design templates and examples that ship with LabVIEW.
    LabVIEW Champion . Do more with less code and in less time .

  • Parameter Query for True or False values

    I have what seems like a painfully simple task and it has me stopped dead.  I reviewed a similar thread, and the answers there don't seem to apply. Working in Crystal 11.5 with an MS SQL database.
    I am pulling data from vwCommmittees.  There is a field in this view called IsActive.  I want to create a committee list report that will allow the user to select only the active committees or all committees.
    A SQL select statement that says where dbo.IsActive = '1' will return only the active committees.
    In Crystal reports, if I place the IsActive field on the report, it returns with "True" or "False."
    When I create a parameter for this field, I find that 1) I can't see the parameter in the report expert -- my only choices are Is any value, Is true, Is false or Formula.
    I've made several attempts to create a formula and nothing is working. It's not clear to me wheter I should be creating a static or a dynamic parameter.  When I choose boolean as the type, that doesn't seem to help.  I tried a dynamic parameter which gave me true and false values, but don't seem to work.
    Any pointers on dealing with this kind of parameter query would be greatly appreciated.
    Sincerely,
    Ridge (in New Joisey)

    Hi..
    Create a static parameter and give the default values like
    0 and 1
    In Record Selection check like..dbo.IsActive = {?parameter}
    If the above is not working for you, then create a formula
    like..
    If dbo.IsActive = '1' then
    "Active"
    Else "In Active"
    Place this formula on your report and create a static parameter with default values Active and In Active.
    In record selection filter the above.
    Thanks,
    Sastry

  • [Help plz]Can't set a boolean attribute to true or false

    Hello,
    I'm new in NWDS development. I need to develop a download functionality
    I used a FileDownload UIElement for that and I created a node context (ExcelExport) with 3 attributes :
    - ExcelFile
    - ExcelIcon
    - And ExcelEnabled (Boolean type)
    My problem is that everytime I try to set the attribute ExcelEnabled to true or false, it return me a java.lang.NullPointerException
    I'm binding this attribute with "Enabled" property of the UIElement.
    Have anyone got this error before? Thanks a lot for your help.
    Kind regards,
    Safae.

    Hello Safae,
    Have you tried to put true/false value for the enabled property? I mean without using a context attribute?
    Also try to create the attribute out of the node.
    Regards,
    ImaneA.

  • Is this TRUE or FALSE ?

    Hi all,
    Pls tell me whether this sentence is true or false.
    A transaction used by a BMT bean MUST have been started by the bean.
    In book this question is marked as false, but as far as I think it should be true.
    Pls update.
    Regards,
    Sanjeev

    As it's written I would say it's true as well.
    Bean-managed transactions are only allowed for session beans(stateful and stateless) and message-driven beans. Furthermore, if there is any client transaction context propagated on the call to the BMT bean, the container is required to suspend the client tx before calling the business method. So, BMT beans cannot inherit client transactions.
    For BMT stateless session beans and message-driven beans, there cannot be an active user transaction when the business method completes. If there is, the container is required to treat it as an error.
    The slightly more interesting case is for stateful session beans. For BMT SFSBs, it's o.k. for the transaction to still be active when the business method returns. In that case, the container suspends the tx and assoicates it with the SFSB. Whenever the SFSB is invoked again, the previously associated transaction is resumed before the business method is called. ( The same rule holds for client transactions. If there is one, it will be suspended and resumed when the business method completes. ) However, even if the container resumes a previously suspended transaction before invoking the SFSB, it can only be a transaction that was started by that bean.
    --ken

  • Can we save a True or False state in Labview?

    I'm using Labview 4.01 and I'm trying to control my testing process. In
    this case, I have 3 gas cylinders and every one of them can be turned on
    or off through the digital out lines. After one tank is empty, I can
    turn it off and turn on another one. My question is, how we can save
    this status either it's true or false so next time, we can open the
    other one instead of this empty one. After this one is turned off, I can
    show its state with an indicator, but the program can not read an
    indicator, so we still can not check the state of this tank. Any one
    have a solution for this problem?
    Thanks in advance,
    Guangde Wang

    Guangde Wang wrote:
    >
    > I'm using Labview 4.01 and I'm trying to control my testing process. In
    > this case, I have 3 gas cylinders and every one of them can be turned on
    > or off through the digital out lines. After one tank is empty, I can
    > turn it off and turn on another one. My question is, how we can save
    > this status either it's true or false so next time, we can open the
    > other one instead of this empty one. After this one is turned off, I can
    > show its state with an indicator, but the program can not read an
    > indicator, so we still can not check the state of this tank. Any one
    > have a solution for this problem?
    >
    > Thanks in advance,
    >
    > Guangde Wang
    Your version is too old. So I believe that saving data in any kind of
    configuration file will
    do the job (like .ini or .conf).
    It also depends on if you are closing application between your vi runs.
    If you don't remove the vi from memory, you have a chance to use global
    or functional global to store your state.
    In latest versions you can do it another way.
    Sergey Krasnishov
    Automated Control Systems
    National Instruments Alliance Member
    Moscow, Russia
    [email protected]
    http://acs.levsha.ru

  • DisAppointed news  Sun Solaris  forum ????????? True or False

    hello Friends ,
    I read some disappointed news on this forum
    that sun would not continue support for intel edition
    i donot know it is true of false
    Any tell me what is exact matter on
    following email :- [email protected]
    or reply this letter

    Cross-posted
    Sun Solaris 5.10 - SSH 1.1.3-Not able to connect to server with ssh -Urgent
    @O.P.
    Don't do that.
    In the future, pick the most appropriate forum and make your post.
    Cross-posting is considered to be the same as rude spamming.
    I'm not aware of any forum web-site-of-value that would encourage cross-posting in its etiquette guidelines.
    ... and as far as "Urgent" goes?
    This web site is for the end-user community to gather and discuss various topics in general conversations. Your self-imposed time pressures are irrelevant. If you need actual technical support for something, then log a support case and pay for a speedy answer.
    See the FAQ link at the top of the page.

  • Item Event - BeforeAction - true or false?

    Hi,
    Is there a basic rule for BeforeAction?
    I know you can play with BeforeAction for personal use; but it is there a basic rule like:
    et_CLICK: then it is BeforeAction == false
    I like to know for following event:
    et_CLICK
    et_COMBO_SELECT
    et_MATRIX_LINK_PRESSED
    et_MATRIX_LOAD
    et_CHOOSE_FROM_LIST
    et_MENU_CLICK
    Is there a Pattern for BeforeAction for ALL Item Events?
    Thank you,
    Rune

    Hi Rune,
    there's no real rule, because the events are different.
    but usual it is before/after displaying or before/after mouseup
    EventType | beforeaction = true | beforeaction = false
    et_CLICK | before you release the mouse button/Button is pressed | after you release the mousebutton
    et_ITEM_PRESSED | before you release the mouse button | after you release the mousebutton
    et_COMBO_SELECT | Selection has not changed | Selection has changed
    et_MATRIX_LINK_PRESSED | before you release the mouse button/Button is pressed | after you release
    et_MATRIX_LOAD | matrix is empty | matrix is loaded
    et_MENU_CLICK | Button is pressed/before release on menu item (without submenus)  | after release
    et_CHOOSE_FROM_LIST | before the Choose From List form is displayed | displayed
    any other questions ?
    greetings to montreal
    David

  • Is that True or False ?

    I recieved a message from e-mail told me that the nokia can Detect Radar on the road
    Nokia Speed Trap Detector
    The settings for radar speed traps detector.
    Your Nokia cell phone can be programmed to pick
    up radar speed traps, when programmed your cell
    phone picks up the radar and alerts you on the
    message alert tone. ( Doesn't work with Nokia
    7110! )
    1. Enter your menu
    2. Select settings
    3. Select security settings
    4. Select closed user group
    5. Select on
    6. Enter 00000
    7. Press ok
    8. Clear back to normal, within a few seconds
    your phone will display a radar sign with five
    zero's next to it. It is now activated.
    Unfortunately only Nokia phones have this
    function. Cell info display needs to be de-
    activated. Settings -> Phone Settings -> Cell
    Info display
    Each time you turn off your phone, or even each
    time you loose contact with your carrier, you'll
    have to activate it again... It is done by steps
    1 through 5, but the number (00000) will be
    already on the field as default.
    Is that True or False ?

    It is false.closed user group is an operator based service by which your phone can be made to make phone calls only to those numbers in that group id.it is service provides dependant.contact your operator.

  • Last parameter in the raise_application_error  (true or false)

    Hi everyone,
    I have a question reagrding the last parameter in the raise_application_error clause.
    The last parameter says
    true: purge error stack
    false: do not purge error stack.
    I raised an exception and captured it with both parameters.
    In the case of false(do not purge previous errors) I could see the exect error no and msg (like No data found).
    But in the case of true (purge previous errors) i got an exception, but not the exact error msg.
    Is this the difference.
    In the case of true, it should purge previous errors, why is it purging the most recent error also.
    Is there anything more to true and false. Please highlight.
    And is there a way i can see the error stack.
    I am so keen to see that.
    It always says error is placed on the stack of previous errors.
    I want to see the previous errors.
    Can I.
    Any ideas.
    meenakshi

    See:
    http://www.oracle.com/technetwork/issue-archive/2005/05-mar/o25plsql-093886.html
    DBMS_UTILITY.FORMAT_ERROR_BACKTRACE

  • Check True or False Condition

    All,
    In my Form_Load module, I use For Loop to get data from Microsoft Access database to the texbox and that works fine.  The problem I have is that there is one column with True/False condition in the access database and I would like to know how to check
    if it is set to True or False.
    In the For Loop I use something like this for the textbox:
    Textbox1.text = row.cells("columnname").value.tostring()
    How do I check the column with the True/False condition
    VS 2008
    OS: XP
    Thanks,
    LA_Bob
    

    Hello,
    Thank you for your post.
    I am afraid that the issue is out of support range of VS General Question forum which mainly discusses the usage issue of Visual Studio IDE such as
    WPF & SL designer, Visual Studio Guidance Automation Toolkit, Developer Documentation and Help System
    and Visual Studio Editor.
    I am moving your question to the moderator forum ("Where is the forum for..?"). The owner of the forum will direct you to a right forum.
    If you are doing your code using visual basic, Visual Basic forum within Visual Studio Language Forums:
    http://social.msdn.microsoft.com/Forums/vstudio/en-US/home?category=vslanguages may help you.
    Best regards,
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

Maybe you are looking for

  • Photo edits in aperture are not being updated in Photostream

    I want to edit photos in iPhoto on an iPad mini and also in Aperture and have the changes synchronised either using photostream or a direct connection. Try as I may I can't get this to happen. If I move a photo in Aperture to the photostream then it

  • Fonts not appearing in CS3 program font lists

    Certain postscript fonts (ZapfDingbats and Rubino Sans) are correctly installed in Windows 7 and available to Microsoft programs (Word and Excel) but not to Adobe programs. That is, they do not appear in any of the CS3 Design Standard applications (P

  • Unable to open jsp in JDev 10.1.3.3

    Hi everybody! I newly have a problem with opening a jsp or jspx-page in Jdeveloper 10.1.3.3. When I double-click a page the Jdev is hard working but seems to doesn't come to an end. After 20 minutes I don't like to wait anymore and close the Jdev wit

  • I just got a new windows 8 laptop and I am trying to install the version of photoshop elements I bou

    I just got a new windows 8 laptop and I am trying to install the version of photoshop elements I bought at Costco on it, and it will not accept the serial number on the package.

  • Slow motion clip upload - found solution

    Hey All. I always carrry my iphone with me, so its my go-to video camera, most of the time now. I love sharing stories with it. I've found I can upload to Youtube or Vimeo stratight out of my iPhone and adjust the 120 fps playback speed using iMovie.