How to output some JSF codes depend on the value of a managed bean

like this:
<?
if (managedbean.propertyA == "1"){
?>
<h:commandButton action="#{managedbean.update}" value="update"/>
<?
}else {
?>
<h:commandButton action="#{managedbean.delete}" value="delete"/>
<?
?>
I know how to get the instance of a managed bean from jsp,
but i think It is not a good idea that writing scriptlets to get the instance, then writing code like above .
Is there a simple/reasonable way to implement this?
Thanks.
David

Try this:
<h:commandButton action="#{managedbean.update}" value="update" rendered="#{managedbean.propertyA == \"1\"}"/>
<h:commandButton action="#{managedbean.delete}" value="delete" rendered="#{managedbean.propertyA != \"1\"}"/>

Similar Messages

  • How do i prepopulate a listbox depending on the value of a textfield

    I am getting an custmerid value in a textfield depending on the selected customer name after getting this value i need to pass this customer id to a rowset query for populating the customer address listbox with that customers addresses only (he has multiple address ) iam doing so by doing setobject(1,custid) on that particular rowset.
    How ever on deploying iam getting invalid parameter binding exception.
    what do i do ? how do i get that customers addresses ?when does the creator look for the parameter bindings in the rowset.or trather when does it execute that particular rowset.?

    Hi,
    Check the following tutorial:
    http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/listbox_components.html

  • How do I populate form fields depending on the value of a list box?

    Hi,
    Can anybody help me out here?
    I'm creating a form where I'm needing to populate a number of fields (first name & last name) based on the value of a list box (values are 1,2,3,4,5,6) ie: if 3 is selected 3 sets of the first name and last name fields populate on the page for the user to fill out.
    At this stage it is just a prototype site and there is no database running behind it.
    Thanks
    Hayden

    This can only be solved if you have javascript coding skills.  Without knowing more about what you want to do and why, I can only show you a skeleton of how your code should look, but consider this form select field -
    <select onchange="populateForm()">
    When a value is selected from that list, the "onchange" event will fire, and will call the javascript function called populateForm().  You need to define a function by that name somewhere on the page -
    <script type="text/javascript">
    //<![CDATA[
    function populateForm(value) {
         if value >0 { document.getElementById("fieldID").style.display='block' }
         if value >1 { .... }
         etc.
    //]]>
    </script>
    The page itself would need to have ALL the fields already in the form, but with those that are to be revealed set to a style of display:none.
    Obviously, this is a skinny skeleton.  Each test in the function would reveal a new field on the page by changing its display style from "none" (which is how they should be set in the code) to "block".  You would need a separate function for each type of field that might need to be chosen.
    If this is well over your head, then I'm afraid you will be out of luck for this particular approach....

  • How to get iterator values from a managed bean ?

    Due to a bug in selectOneChoice i'm not able to get the label list i want to display directly from an iterator when the value binding is a managed bean.
    To solve the problem i would like to create a managed bean that contains that list and use it as the selectItems to display.
    I would like that the values in that managed bean loaded from the a data control iterator.
    My question is :
    1) is it possible to access the iterator values from a managed bean, i mean without any reference to a page definition
    2) how to do ? is it documented somewhere ? any example ?
    Thank you

    I got it also with this code:
    package view.managedBeans;
    import classification.bean.ClassificationDocument;
    import classification.castor.ClassificationLanguage;
    import java.io.FileNotFoundException;
    import java.util.ArrayList;
    import java.util.HashMap;
    import java.util.Hashtable;
    import java.util.List;
    import java.util.Locale;
    import javax.faces.context.FacesContext;
    import javax.faces.el.ValueBinding;
    import javax.faces.model.SelectItem;
    import oracle.adf.model.generic.DCGenericDataControl;
    import org.exolab.castor.xml.MarshalException;
    import org.exolab.castor.xml.ValidationException;
    public class ClassificationLanguageList {
    private java.util.List<SelectItem> supportedLanguages = new ArrayList();
    public ClassificationLanguageList() throws FileNotFoundException,
    MarshalException,
    ValidationException {
    FacesContext ctx = FacesContext.getCurrentInstance();
    ValueBinding vb = ctx.getApplication().createValueBinding("#{data.ClassificationDocumentDataControl}");
    DCGenericDataControl classificationDocumentDataControl = (DCGenericDataControl)vb.getValue(ctx);
    ClassificationDocument classificationDocument = (ClassificationDocument)classificationDocumentDataControl.getDataProvider();
    ClassificationLanguage[] classificationLanguage = classificationDocument.getClassification().getClassificationLanguageList().getClassificationLanguage();
    for (int counter = 1; counter < classificationLanguage.length; counter++) {
    SelectItem language = new SelectItem();
    language.setValue(classificationLanguage[counter].getClassificationLanguageCode());
    language.setLabel(classificationLanguage[counter].getClassificationLanguageLabel());
    supportedLanguages.add(language);
    public void setSupportedLanguages(java.util.List<SelectItem> supportedLanguages) {
    this.supportedLanguages = supportedLanguages;
    public java.util.List<SelectItem> getSupportedLanguages() {
    return supportedLanguages;
    }

  • Disabling button depending on the Value of a field in a standard page

    Hi,
    How can I disable a button depending on the value selected in a particular field of the same page? Is it possible to do so in a Oracle standard page? Please guide me in resolving this requirement.
    Thanks,
    Swagatika

    Swagatika,
    You can attach PPR event to the textinput field and use method
    pageContext.ForwardImmediatelyToCurrentPage().As process request method will be called again,here you can use method setDisabled(boolean) in OAsubmitButtonBean, to enable or disable your button!
    --Mukul                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Who knows how to output some text once labview detects something I want using pattern matching(V​ision assistant)​?

    who knows how to output some text once labview detects something I want using pattern matching(Vision assistant)?
    The text is something like"Yes, this is a coin"
    Thanks!

    I attached a SubVI which I used to place an overlay next to a Pattern, found by a Pattern Match before:
    As you can see, you simply pass the image reference and the Array of Matches to the VI along with the String you want to have as an overlay next to the Match.
    I also modified your VI a bit, but didn't test it. I created an Array of clusters, each elment containing the template path along with the respective text.
    Please note that this is just a hint!
    Christian
    Attachments:
    suggestion.vi ‏146 KB
    Overlay_Txt.vi ‏24 KB

  • How do i fix error code 6A00 on the LCD screen of my Canon PIXMA MP810

    how do i fix error code 6A00 on the LCD screen of my Canon PIXMA MP810 

    Hello drews,
    To try and resolve the 6A00 error, we will want to ensure that no paper jams or obstructions exist in the printer.  To do this, please follow the steps below:
    ASF / Paper Output Slot
    Turn off the printer.
    Remove paper from the ASF.
    Gently pull the jammed paper out.
    If paper is visible from the ASF, use both hands to pull the paper out slowly.
    If paper is visible from the paper output slot, use both hands to pull the paper out slowly.
    If the paper tears and a piece of that remains inside the printer, open the scanning unit (printer cover) and remove the paper from inside the printer.
    Note : Be careful not to touch the components inside the printer.
    Turn on the printer and confirm that the Alarm light is off.
    (If the jammed paper remains in the printer, the paper may be automatically ejected.)
    Load paper back into the ASF.
    Press <OK> to clear the message and continue printing. If you are printing from an application software, follow the instructions displayed on your computer.
    Top
    Paper jams inside the printer
    Turn off the printer and disconnect the power cord and USB cable.
    Remove the jammed paper slowly using the following procedure.
    Open the rear cover to check if the paper is jammed.
    Pull out the cassette and check if the paper is jammed inside the cassette area.
    Stand the printer with the rear side down, holding the document cover.
    Press the tabs together and pull the green cover toward you.
    Check if the paper is jammed.
    (If you were not doing Duplex printing, you do not have to follow this procedure.)
    Close the green cover and place the printer back to a normal position.
    Reconnect the power cord and power on the printer. Confirm the Alarm light is off.
    Load paper back into the ASF or cassette.
    Press <OK> to clear the message and continue printing. If you are printing from an application software, follow the instructions displayed on your computer.
    Top
    Clearing credit card-sized paper jammed inside the printer
    Credit card-sized and 4" x 6" sized paper must be loaded properly. If this media is not loaded properly, it will feed into the printer and will not exit. Credit card-sized paper should only be loaded in the ASF and in portrait orientation. 4" x 6" sized paper can be loaded in the ASF or cassette. But must be loaded portrait orientation.
    If credit card-sized paper was loaded in landscape orientation in the ASF and did not eject (exit), please follow this procedure.
    Turn off the printer.
    Load the same paper type that is jammed inside the printer in portrait orientation.
    Power on the printer.
    The paper stock in the ASF will automatically feed the jammed paper from the printer.
    To resume printing, load the paper in portrait orientation.
    If 4" x 6" sized paper was loaded in landscape orientation in the cassette and did not eject (exit), please follow this procedure.
    Turn off the printer.
    Open the rear cover.
    Fold in four a piece of letter-sized plain paper.
    Push in the folded paper until it hits the jammed paper.
    If the jammed paper is visible from inside the printer area, pull it out and proceed to step 7.
    If the jammed paper cannot be pulled out, push in the folder paper from the rear so the jammed paper is in between the feed rollers.
    Pull out the folded paper and close the rear cover.
    Power on the printer and confirm that the Alarm light is off.  The jammed paper should automatically eject.
    To resume printing, load the paper in portrait orientation.
    If you still experience the same error after performing the steps above, please turn off the printer, unplug the power cord from the back and leave it out for at least 10 minutes, then plug it back in and turn it back on.  If the error persists, unfortunately, the printer will require servicing to resolve the issue.  Please click on the Contact Us link below to obtain your servicing options.
    This didn't answer your question or issue? Find more help at Contact Us.
    Did this answer your question? Please click the Accept as Solution button so that others may find the answer as well.

  • An RB CODE depending on the House Bank

    Hi All,
    In "Company code Global data" / "additional data", I can set  "RB Code".
    I need to set two different RB CODES for each Company code, depending on the House Bank.
    Is it possible?
    Thanks

    For maintaining codes you can user other fields. Because these all are informative purpose

  • Shading part of a JTable Cell dependent upon the value of the cell

    Hi
    Was hoping some one woudl be able to provide some help with this. I'm trying to create a renderer that will "shade" part of a JTable cell's background depending upon the value in the cell as a percentage (E.g. if the cell contains 0.25 then a quarter of the cell background will be shaded)
    What I've got so far is a renderer which will draw a rectangle whose width is the relevant percentage of the cell's width. (i.e. the width of the column) based on something similar I found in the forum but the part I'm struggling with is getting it to draw this rectangle in any cell other than the first cell. I've tried using .getCellRect(...) to get the x and y position of the cell to draw the rectangle but I still can't make it work.
    The code for my renderer as it stands is:
    import java.awt.Component;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import javax.swing.JLabel;
    import javax.swing.JTable;
    import javax.swing.table.TableCellRenderer;
    public class PercentageRepresentationRenderer extends JLabel implements TableCellRenderer{
         double percentageValue;
         double rectWidth;
         double rectHeight;
         JTable table;
         int row;
         int column;
         int x;
         int y;
         public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
              if (value instanceof Number)
                   this.table = table;
                   this.row = row;
                   this.column = column;
                   Number numValue = (Number)value;
                   percentageValue = numValue.doubleValue();
                   rectHeight = table.getRowHeight(row);
                   rectWidth = percentageValue * table.getColumnModel().getColumn(column).getWidth();
              return this;
         public void paintComponent(Graphics g) {
            x = table.getCellRect(row, column, false).x;
            y = table.getCellRect(row, column, false).y;
              setOpaque(false);
            Graphics2D g2d = (Graphics2D)g;
            g2d.fillRect(x,y, new Double(rectWidth).intValue(), new Double(rectHeight).intValue());
            super.paintComponent(g);
    }and the following code produces a runnable example:
    import javax.swing.JFrame;
    import javax.swing.JScrollPane;
    import javax.swing.JTable;
    import javax.swing.table.DefaultTableModel;
    public class PercentageTestTable extends JFrame {
         public PercentageTestTable()
              Object[] columnNames = new Object[]{"A","B"};
              Object[][] tableData = new Object[][]{{0.25,0.5},{0.75,1.0}};
              DefaultTableModel testModel = new DefaultTableModel(tableData,columnNames);
              JTable test = new JTable(testModel);
              test.setDefaultRenderer(Object.class, new PercentageRepresentationRenderer());
              JScrollPane scroll = new JScrollPane();
              scroll.getViewport().add(test);
              add(scroll);
         public static void main(String[] args)
              PercentageTestTable testTable = new PercentageTestTable();
              testTable.pack();
              testTable.setVisible(true);
              testTable.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }If anyone could help or point me in the right direction, I'd appreciate it.
    Ruanae

    This is an example I published some while ago -
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.table.*;
    public class Fred120 extends JPanel
        static final Object[][] tableData =
            {1, new Double(10.0)},
            {2, new Double(20.0)},
            {3, new Double(50.0)},
            {4, new Double(10.0)},
            {5, new Double(95.0)},
            {6, new Double(60.0)},
        static final Object[] headers =
            "One",
            "Two",
        public Fred120() throws Exception
            super(new BorderLayout());
            final DefaultTableModel model = new DefaultTableModel(tableData, headers);
            final JTable table = new JTable(model);
            table.getColumnModel().getColumn(1).setCellRenderer( new LocalCellRenderer(120.0));
            add(table);
            add(table.getTableHeader(), BorderLayout.NORTH);
        public class LocalCellRenderer extends DefaultTableCellRenderer
            private double v = 0.0;
            private double maxV;
            private final JPanel renderer = new JPanel(new GridLayout(1,0))
                public void paintComponent(Graphics g)
                    super.paintComponent(g);
                    g.setColor(Color.CYAN);
                    int w = (int)(getWidth() * v / maxV + 0.5);
                    int h = getHeight();
                    g.fillRect(0, 0, w, h);
                    g.drawRect(0, 0, w, h);
            private LocalCellRenderer(double maxV)
                this.maxV = maxV;
                renderer.add(this);
                renderer.setOpaque(true);
                renderer.setBackground(Color.YELLOW);
                renderer.setBorder(null);
                setOpaque(false);
                setHorizontalAlignment(JLabel.CENTER);
            public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int col)
                final JLabel label = (JLabel) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, col);
                if (value instanceof Double)
                    v = ((Double)value).doubleValue();
                return renderer;
        public static void main(String[] args) throws Exception
            final JFrame frame = new JFrame("Fred120");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setContentPane(new Fred120());
            frame.pack();
            frame.setLocationRelativeTo(null);
            frame.setVisible(true);
    }

  • ColumnChart color depending on the value of the column

    Hi,
    I'va been trying for 2 days to change the colors of columnseries in a columnchart and it is actually awful. I've tried to do it inline without custom itemRenderer but I quickly understood that it is impossible. I then looked on the internet, and found that it was maybe possible by creating a custom itemRenderer class, extending ProgrammticSkin and implementing IdataRenderer.
    I have tried but am not at all able to retrieve the value of the column inside the itemRenderer. Even more, the so called _chartItem is always null and never never carries anything from anyparent.
    I'm a bit exhausted of trying and getting this value, so if you have some idea, i'll be very grateful.
    Here is the code for my itemRenderer class:
    import flash.display.Graphics;
        import flash.geom.Rectangle;
        import mx.charts.ChartItem;
        import mx.charts.chartClasses.GraphicsUtilities;
        import mx.charts.series.items.ColumnSeriesItem;
        import mx.controls.Alert;
        import mx.core.IDataRenderer;
        import mx.graphics.IFill;
        import mx.graphics.IStroke;
        import mx.skins.ProgrammaticSkin;
        public class ColorRenderer extends ProgrammaticSkin implements IDataRenderer
            public function ColorRenderer():void
                super();
            private var _chartItem:ChartItem;
            public function get data():Object
                return _chartItem;
            public function set data(value:Object):void {
                _chartItem = value as ColumnSeriesItem;
                invalidateDisplayList();
            private static const fills:Array = [0xFF0000,0x00FF00,0x0000FF,
                0x00FFFF,0xFF00FF,0xFFFF00,
                0xAAFFAA,0xFFAAAA,0xAAAAFF];
            override protected function
                updateDisplayList(unscaledWidth:Number,unscaledHeight:Number):void {
                super.updateDisplayList(unscaledWidth, unscaledHeight);
                var g:Graphics = graphics;
                g.clear(); 
                g.beginFill(fills[(_chartItem == null)? 0:_chartItem.element.y]);
                Alert.show(_chartItem.index.toString());
                g.drawRect(0, 0, unscaledWidth, unscaledHeight);
                g.endFill();
        } // Close class.
    } // Close package.
    Thank you

    It worked, thanks
    Date: Wed, 21 Apr 2010 09:03:14 -0600
    From: [email protected]
    To: [email protected]
    Subject: Flex ColumnChart color depending on the value of the column
    Have you looked at doing per-item fills?
    http://help.adobe.com/en_US/Flex/4.0/UsingSDK/WS2db454920e96a9e51e63e3d11c0bf69084-7c3f.ht ml
    This feature lets you define a function that customizes chart item fills based on their values.
    >

  • Variant network depending on the value of the characteristics.

    Hi,
    I want to create a project from a sales order for a configurable material. The problem is that the network should be slightly different depending on the value of the characteristics used in the configurable material. For example, it could happen that one operation should not be executed, or that this operation should take longer because of the characteristics.
    How should I proceed?
    Thanks in advance.
    Regards,
    Luis.

    Thanks for your answers, but I needed a more specific answer. Anyway, in the end I found the solution:
    - I had to create a configuration profile for the standard network (CU41), and then I had to assign the same class as the one assigned to the configuration profile of the configurable material.
    - Then, I run t-code CN02, and I had to select one operation and then I clicked "Extras --> Object Dependencies --> Editor". And finally, I just chose the dependency type and filled it with its corresponding code.
    Still, I have a problem:
    - Is it possible to set the value of the Normal Duration (or any other parameter of the operation) depending on the value of one characteristic?
    For example: The value of my characteristic A is 2, so I want to set Normal Duration = 10*(Value_of_A) = 20 for the first operation of the standard network. Is it possible in standard SAP???
    Thanks!

  • Calculate a measure depending on the value of other dimension

    HI,
    I would like to know if it’s possible to calculate a measure depending on the value of other dimension. I want to calculate this measure in the Business Model and Mapping. I show you how I am trying to do it:
    http://img338.imageshack.us/img338/2496/imagenjp.png
    But when I try to make an aggregation of this measure then I get an error of consistency.
    I think a good example to make you to understand me is the function TODATE which calculates an aggregation depending on one time dimension. I would like to do the same thing but regarding to the value of other dimension.
    Can someone help me? Thanks a lot.

    Hi,
    Do you have that dimension table as a "Sources" in that BMM folder? if yes, then you can use the "Data Type" option and click on "show all logical sources". Then click on your fact table using which you want to do the calculation and then use this formula. After that you can have the aggregation.
    It should work.
    Thanks,
    Rohit

  • Formula to populate one Person or Group column depending on the value of another Person Group column

    I am looking for a way to popluate the Account information of a Person based on another column where there name in another column.  I have Two Columns   "Name" which is a Person or Group information type and User Account which
    is also a Person or Group Information type.  When an Invidividuals name is entered into the Name column, I what the User Account column to prepolulate.

    Hi,
    For your issue, you can automatically populate User Information depending on the value of another Person or Group column by connectting with User Information List or  connectting with User Profile Web Service:
    http://www.wonderlaura.com/Lists/Posts/Post.aspx?ID=172
    http://blogs.technet.com/b/anneste/archive/2011/11/02/how-to-create-an-infopath-form-to-auto-populate-data-in-sharepoint-2010.aspx
    Best Regards,
    Eric
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • Change the Status depending on the value selected in Sales stage

    I want to change the status in opportunity, depending upon what is entered in sales stage.
    I tried to find an appropriate BADI for the same purpose, but couldn't figure out any.
    I was thinking of changing the method do_prepare_output and including the code to get the value of sales stage and set the status. Is this feasible?

    Alternatively, you can enhance the SET method of the sales status and add the logic for status update as well.
    Regards, Kathirvel

  • How can I set the value to a session bean from backing bean

    Hi Experts,
    How can I set the value to a session bean from backing bean where I have created getter and setter
    methods for that variable.
    Basically I am using ADFUtils class where I am able to get the value from session bean
    using following expression
    String claimType =
    (String)ADFUtil.invokeEL("#{ClaimValueObj.getClaimType}");
    Thanks
    Gayaz

    Gayaz,
    Wrong Post !!
    Post in JDeveloper and ADF
    Thanks
    --Anil                                                                                                                                                                                                                               

Maybe you are looking for

  • Any calendar app with landscape week view?

    Before I waste more hours searching, I thought I'd ask here: Is there ANY basically reliable stand-alone calendar app for the Touch that will do a landscape-oriented week-view? Or any clue that in the next six months someone at Apple will sit down fo

  • TS3297 itunes wont connect to the internet even though its already connected...?

    Itunes continues to "load" and "connect" but then finally informs me that Itunes cannot connect due to lack of Internet Connection, even though there is nothing wrong with the connection. Now what?

  • How to set JAVA_HOME in REDHAT 9.0 Linux?

    I was trying to set JAVA_HOME in profile file, but unable to decide where to put the java_home path. Can anyone guide me? J2sdk and JRE are in /USR/JAVA

  • OEM 12c  Agent does not show down status.

    Hi, I'm testing EM 12c. I added host target to oem and then kill agent process on host. When open agent page (Setup-Agent-Testingagent) see error. Communication between the Oracle Management Service host to the Agent host is unavailable. Any function

  • Unable to start Storage Manager Engine on OES2SP3

    Hi, I just installed Storage Manager on a OES2SP3 x64 server and after what seems to be a correct installation, the Engine doesn't start. Does anyone if is there any undocumented dependency or something I should know to be able to start it? I've been