H:outputText styleclass

Hi All,
I need to give three different style classes to an outputText depending on its value
<h:outputText value="#{bean.rating}" />If the value of rating is Fantabulous - Then Green Font color
If the value of rating is Excellent - Then Yellow Font color
If the value of rating is Good - Then Red Font color
How can i achive this by using a single outputText.
Thanks & Regards,
Darshan Shroff
[email protected]
Edited by: Darshan.Shroff on Jul 7, 2009 10:52 PM

For this you will need to specify your styleclass name in bean depending on rating value. something likeif(rating.equals("Fabulous"))
     applyStyle = "greenStyle"; //name of green style class specified in CSS
if(rating.equals("Excellent"))
     applyStyle = "redStyle"; //name of red style class in specified CSS
if(rating.equals("Good"))
     applyStyle = "yellowStyle"; //name of yellow style class in specified CSS and your output text will contain <h:outputText value="#{bean.rating}" styleClass="#{bean.applyStyle}"/>

Similar Messages

  • Justify the text in a 'outputText' component

    How can I justify the text in a 'outputText' component ?
    All properties work, except the 'text-align' property
    <h:outputText styleClass="texto" value="#{menusBean.texto}" escape="false"/>
    I use this in a css file.
    .texto {
    font-family: Verdana, Arial, Helvetica, sans-serif;
    padding: 3px;
    font-size: 11px;
    color: #333333;
    font-weight: normal;
    text-align: justify;
    Thanks,
    Sérgio Morais

    If you are not concerned about using renderkits other than the HTML renderkit then you can wrap the outputText tag with an HTML div tag. However, if you want to leverage other renderkits then I would advise wrapping your ouputText tag with a panel such as the PanelHorizontal.

  • How to put outputText inside javascript?

    Hi guys,
    My javascript code is like below initially:
                       var field = document.getElementById(theText).innerHTML;
                       if(field=='Add'){
                            document.getElementById(theText).innerHTML= 'Ignore';
                       if(field=='Ignore'){
                            document.getElementById(theText).innerHTML= 'Add';
                       }     and when I changed to
                       var field = document.getElementById(theText).innerHTML;
                       if(field=='Add'){
                            document.getElementById(theText).innerHTML= '<h:outputText styleClass="boldWord" id="oTxtIgnoreAddAddress" value="#{text['text.ignore']}"/>';
                       if(field=='Ignore'){
                            document.getElementById(theText).innerHTML= '<h:outputText styleClass="boldWord" id="oTxtIgnoreAddAddress" value="#{text['text.add']}"/>';
                       }     the script do nothing ! Please help, thanks ! need help desperately here !
    regards,
    Mark

    i changed to:
                       var field = document.getElementById(theText).innerHTML;
                       if(field=='Add'){
                            document.getElementById(theText).innerHTML= '<h:outputText styleClass="boldWord" value="#{text['text.ignore']}"/>';
                       if(field=='Ignore'){
                            document.getElementById(theText).innerHTML= '<h:outputText styleClass="boldWord" value="#{text['text.add']}"/>';
                       }     still doesn't work. Initailyy when the page loaded, the word is 'ignore'. I clicked on it then become 'Add'. Click on it again still gave me 'Add' !
    pls help ! Thanks !
    regards,
    Mark

  • Scope of CSS styleClass in h:form, h:panelGrid

    This may be more of a HTML/CSS question, but still relevant to JSF app design/impl. Basically, I would like to know whether container's styleClass is inherited by nested components. For example:
    <h:form styleClass="formClass">
    <h:panelGrid styleClass="panelGridClass" columns="2">
    <h:outputText styleClass="output1Class"/>
    <h:outputText styleClass="output2Class"/>
    </h:panelGrid>
    </h:form>
    If I specify font style/color in "formClass" and I am content that all text inside the form will look the same, can I omit styleClass statements in nested components - two outputText's and panelGrid?
    In general, what is the scope of styleClass declarations?
    thanks
    -nikita

    Now the full answer....
    An Html/Css Forum is a better place to ask this question.
    I made some tests and the style is inherited by the nested components.
    I think the scope of the styleClass is until another style overrides the previous one.

  • How can i use one datatable inside the other?

    Hi all,
    i need help ... i have this page that shows information from a relational table... for example a mapped table "Countries" that has a java.util.Set inside named "Cities" and i would like 2 know how can i do this using jsf...
    The display would be like this:
    Brasil
    Rio de Janeiro
    Sao Paulo
    USA
    New York
    Washington
    New Orleans
    And Goes on... So i guess it would be a dataTable inside the other, right? but i dunno how to do it...
    Thanks for any info. cya

    this is somehow a messy example. But just focus on the var attribute of outer datatable and how value attribute of inner datatable is referencing it.
    <h:dataTable id="table1" value="#{pc_City_state.listofstates.states}" var="varstates" styleClass="dataTable">
                   <h:column id="column1">
                        <f:facet name="header">
                             <h:outputText styleClass="outputText" value="StateName" id="text2"></h:outputText>
                        </f:facet>
                        <h:outputText id="text3" value="#{varstates.stateName}" styleClass="outputText">
                        </h:outputText>
                   </h:column>
                   <h:column id="column3">
    <f:facet name="header">
    </f:facet>
              <h:dataTable id="table2" value="#{varstates.cities}" var="varcities" styleClass="dataTable">
                                       <f:facet name="footer">
                                       </f:facet>
                                       <h:column id="column4">
              <f:facet name="header">
              <h:outputText styleClass="outputText" value="CityName" id="text6"></h:outputText>
              </f:facet>
              <h:outputText id="text7" value="#{varcities.cityName}" styleClass="outputText">
              </h:outputText></h:column>
              </h:dataTable>
    </h:column>
    </h:dataTable>

  • Reading Values from a Datatable to a backing bean

    I have a Datatable which has 3 columns.
    First Column is a Account Number and the Second Column gives the address of the Account Number.
    The Inputs 1 to 5 Account Number on the Previous Page. Depending on number of Accounts Input by the user - the datatable shows those many rows with address. Now the third column has 4 Input Text fields for New Address.
    Because the 3rd column is also generated dynamically how can I use the New Address entered by the user in my backing bean.
    The JSF Code is:
    <h:form id="frmManualDataEntryUpdateAddress">
        <tr:panelHeader styleClass="titleText" text="Update Address"/>
        <h:dataTable rows="25" rowClasses="oddRow,evenRow"
                     styleClass="columnSpace font_size" value="#{summaryList}"
                     var="summary">
            <h:column>
                <f:facet name="header">
                    <h:outputText styleClass="titleText" value="Keyline"/>
                </f:facet>
                <h:outputText rendered="#{summary.keyline != null}"
                              value="#{summary.keyline}"/>
            </h:column>
            <h:column>
                <f:facet name="header">
                    <h:outputText styleClass="titleText" value="Address"/>
                </f:facet>
                <h:outputText rendered="#{summary.lienHolderName != null}"
                              value="#{summary.lienHolderName}"/>
                <h:outputText rendered="#{summary.lienHolderAddressLine1 != null}"
                              value="#{summary.lienHolderAddressLine1}">
                    <f:verbatim>
                        <br/>
                    </f:verbatim>
                </h:outputText>
                <h:outputText rendered="#{summary.lienHolderAddressLine2 != null}"
                              value="#{summary.lienHolderAddressLine2}">
                    <f:verbatim>
                        <br/>
                    </f:verbatim>
                </h:outputText>
                <h:outputText rendered="#{summary.lienHolderCity != null}"
                              value="#{summary.lienHolderCity}">
                    <f:verbatim>
                        <br/>
                    </f:verbatim>
                </h:outputText>
                <h:outputText rendered="#{summary.lienHolderState != null}"
                              value=" #{summary.lienHolderState}"/>
                <h:outputText rendered="#{summary.lienHolderZip4 != null}"
                              value=" #{summary.lienHolderZip4}"/>
            </h:column>
            <h:column>
                <f:facet name="header">
                    <h:outputText styleClass="titleText" value="New Address"/>
                </f:facet>
                <tr:panelFormLayout>
                    <tr:panelLabelAndMessage label="Address Line 1"
                                             for="addressLine1">
                        <tr:panelHorizontalLayout>
                            <tr:inputText id="addressLine1" maximumLength="60"
                                          value="#{summary.acsEntry.acsAddressLine1}"></tr:inputText>
                        </tr:panelHorizontalLayout>
                    </tr:panelLabelAndMessage>
                    <tr:panelLabelAndMessage label="City" for="city">
                        <tr:panelHorizontalLayout>
                            <tr:inputText id="city" maximumLength="28"
                                          value="#{summary.acsEntry.acsCity}"></tr:inputText>
                        </tr:panelHorizontalLayout>
                    </tr:panelLabelAndMessage>
                    <tr:panelLabelAndMessage label="State" for="state">
                        <tr:panelHorizontalLayout>
                            <tr:inputText id="state" maximumLength="2"
                                          value="#{summary.acsEntry.acsState}"></tr:inputText>
                        </tr:panelHorizontalLayout>
                    </tr:panelLabelAndMessage>
                    <tr:panelLabelAndMessage label="Zip" for="zip">
                        <tr:panelHorizontalLayout>
                            <tr:inputText id="zip" maximumLength="60"
                                          value="#{summary.acsEntry.acsZip4}"></tr:inputText>
                        </tr:panelHorizontalLayout>
                    </tr:panelLabelAndMessage>
                </tr:panelFormLayout>
            </h:column>
        </h:dataTable>
    </h:form>

    I have a Datatable which has 3 columns.
    First Column is a Account Number and the Second Column gives the address of the Account Number.
    The Inputs 1 to 5 Account Number on the Previous Page. Depending on number of Accounts Input by the user - the datatable shows those many rows with address. Now the third column has 4 Input Text fields for New Address.
    Because the 3rd column is also generated dynamically how can I use the New Address entered by the user in my backing bean.
    The JSF Code is:
    <h:form id="frmManualDataEntryUpdateAddress">
        <tr:panelHeader styleClass="titleText" text="Update Address"/>
        <h:dataTable rows="25" rowClasses="oddRow,evenRow"
                     styleClass="columnSpace font_size" value="#{summaryList}"
                     var="summary">
            <h:column>
                <f:facet name="header">
                    <h:outputText styleClass="titleText" value="Keyline"/>
                </f:facet>
                <h:outputText rendered="#{summary.keyline != null}"
                              value="#{summary.keyline}"/>
            </h:column>
            <h:column>
                <f:facet name="header">
                    <h:outputText styleClass="titleText" value="Address"/>
                </f:facet>
                <h:outputText rendered="#{summary.lienHolderName != null}"
                              value="#{summary.lienHolderName}"/>
                <h:outputText rendered="#{summary.lienHolderAddressLine1 != null}"
                              value="#{summary.lienHolderAddressLine1}">
                    <f:verbatim>
                        <br/>
                    </f:verbatim>
                </h:outputText>
                <h:outputText rendered="#{summary.lienHolderAddressLine2 != null}"
                              value="#{summary.lienHolderAddressLine2}">
                    <f:verbatim>
                        <br/>
                    </f:verbatim>
                </h:outputText>
                <h:outputText rendered="#{summary.lienHolderCity != null}"
                              value="#{summary.lienHolderCity}">
                    <f:verbatim>
                        <br/>
                    </f:verbatim>
                </h:outputText>
                <h:outputText rendered="#{summary.lienHolderState != null}"
                              value=" #{summary.lienHolderState}"/>
                <h:outputText rendered="#{summary.lienHolderZip4 != null}"
                              value=" #{summary.lienHolderZip4}"/>
            </h:column>
            <h:column>
                <f:facet name="header">
                    <h:outputText styleClass="titleText" value="New Address"/>
                </f:facet>
                <tr:panelFormLayout>
                    <tr:panelLabelAndMessage label="Address Line 1"
                                             for="addressLine1">
                        <tr:panelHorizontalLayout>
                            <tr:inputText id="addressLine1" maximumLength="60"
                                          value="#{summary.acsEntry.acsAddressLine1}"></tr:inputText>
                        </tr:panelHorizontalLayout>
                    </tr:panelLabelAndMessage>
                    <tr:panelLabelAndMessage label="City" for="city">
                        <tr:panelHorizontalLayout>
                            <tr:inputText id="city" maximumLength="28"
                                          value="#{summary.acsEntry.acsCity}"></tr:inputText>
                        </tr:panelHorizontalLayout>
                    </tr:panelLabelAndMessage>
                    <tr:panelLabelAndMessage label="State" for="state">
                        <tr:panelHorizontalLayout>
                            <tr:inputText id="state" maximumLength="2"
                                          value="#{summary.acsEntry.acsState}"></tr:inputText>
                        </tr:panelHorizontalLayout>
                    </tr:panelLabelAndMessage>
                    <tr:panelLabelAndMessage label="Zip" for="zip">
                        <tr:panelHorizontalLayout>
                            <tr:inputText id="zip" maximumLength="60"
                                          value="#{summary.acsEntry.acsZip4}"></tr:inputText>
                        </tr:panelHorizontalLayout>
                    </tr:panelLabelAndMessage>
                </tr:panelFormLayout>
            </h:column>
        </h:dataTable>
    </h:form>

  • How to get all attributes of a component

    Hi all,
    In a component I'm trying to get attributes of some primefaces components, but somehow I cannot retrieve them all.
    Here's a little bit of a table:
              <p:dataTable styleClass="ptable100" title="${msg.contractlist_title}" id="contractlistTable" var="contract" value="#{contractList.contracts}" width="100%" height="200px"
                        emptyMessage="#{msg.all_lists_no_records_found}" paginator="#{contractList.rowSize > 10}" rows="10" rowsPerPageTemplate="5,10,20,50,100"
                        paginatorTemplate="{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink}  #{msg.all_lists_numberOfRowsDisplayed_label}{RowsPerPageDropdown}">
                   <p:column id="column_id" resizable="true" sortBy="#{contract.id}" style="white-space:normal">
                      <f:facet name="header"><h:outputText styleClass="headerText" value="#{msg.contractlist_contract_id}" /></f:facet>
                         <h:outputLink value="#{path.dynamicUrl}contract/detail.xhtml" onclick="Richfaces.showModalPanel('busy_nav');">
                             <h:outputText value="#{contract.id}"/>
                             <f:param name="contractid" value="#{contract.id}" />
                         </h:outputLink>
                  </p:column>Then, I try to get the attributes like this (where table is the UIData component):
              String title = "";
              System.out.println("table.getAttribs.keys= " + table.getAttributes().keySet());
              System.out.println("table.getAttribs.vals= " + table.getAttributes().values());
              if (table.getAttributes().containsKey("title")) {
                   title = String.valueOf(table.getAttributes().get("title"));
              }The function getAttributes() is implemented on UIComponentBase so I believe it's independent of the component.
    This prints the following:
    table.getAttribs.keys= [com.sun.facelets.MARK_ID]
    table.getAttribs.vals= [5756abfa]When I do the same for the columns, all attributes I get is MARK_ID, style and styleClass.
    Obviously I'd like to get all attributes, in this case the "title" on the p:dataTable.
    Any thoughts why this isn't working and how I could do that?
    Thank you,
    Steven

    Hi all,
    In a component I'm trying to get attributes of some primefaces components, but somehow I cannot retrieve them all.
    Here's a little bit of a table:
              <p:dataTable styleClass="ptable100" title="${msg.contractlist_title}" id="contractlistTable" var="contract" value="#{contractList.contracts}" width="100%" height="200px"
                        emptyMessage="#{msg.all_lists_no_records_found}" paginator="#{contractList.rowSize > 10}" rows="10" rowsPerPageTemplate="5,10,20,50,100"
                        paginatorTemplate="{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink}  #{msg.all_lists_numberOfRowsDisplayed_label}{RowsPerPageDropdown}">
                   <p:column id="column_id" resizable="true" sortBy="#{contract.id}" style="white-space:normal">
                      <f:facet name="header"><h:outputText styleClass="headerText" value="#{msg.contractlist_contract_id}" /></f:facet>
                         <h:outputLink value="#{path.dynamicUrl}contract/detail.xhtml" onclick="Richfaces.showModalPanel('busy_nav');">
                             <h:outputText value="#{contract.id}"/>
                             <f:param name="contractid" value="#{contract.id}" />
                         </h:outputLink>
                  </p:column>Then, I try to get the attributes like this (where table is the UIData component):
              String title = "";
              System.out.println("table.getAttribs.keys= " + table.getAttributes().keySet());
              System.out.println("table.getAttribs.vals= " + table.getAttributes().values());
              if (table.getAttributes().containsKey("title")) {
                   title = String.valueOf(table.getAttributes().get("title"));
              }The function getAttributes() is implemented on UIComponentBase so I believe it's independent of the component.
    This prints the following:
    table.getAttribs.keys= [com.sun.facelets.MARK_ID]
    table.getAttribs.vals= [5756abfa]When I do the same for the columns, all attributes I get is MARK_ID, style and styleClass.
    Obviously I'd like to get all attributes, in this case the "title" on the p:dataTable.
    Any thoughts why this isn't working and how I could do that?
    Thank you,
    Steven

  • Problem with selectOneMenu in Datatable

    Hi
    I have the following datatable that binds correctly to a set of Game objects.
    I need to have a dropdown with the numbers 1 to 10 as items which is bound to each dataItem's newRating field.
    However there is some problem with the dropdown that i can't figure out. The datatable stops rendering when it hits the first dropdown.
    At the moment,
    The new rating field in the Game class is of type SelectItem with the appropriate get and set methods.
    Could anyone please point out what I'm doing wrong
    Thanks.
    Here is the relevant part in Home.jsp:
                                              <h:dataTable binding="#{Home.newGamesTable}" id="newGamesTable" value="#{Home.newGames}" var="dataItem">
                                                                <h:column>
                                                                    <f:facet name="header">
                                                                        <h:outputText value=""/>
                                                                    </f:facet>
                                                                    <h:panelGroup layout="block" styleClass="new_game_main">
                                                                        <h:outputText styleClass="new_game_title" value="#{dataItem.title}"/>
                                                                        <h:outputText escape="false" styleClass="new_game_label" value="Date added: "/>
                                                                        <h:outputText styleClass="new_game_data" value="#{dataItem.dateString}"/>
                                                                        <h:outputText escape="false" styleClass="new_game_label" value="Average Rating:"/>
                                                                        <h:outputText styleClass="new_game_data" value="#{dataItem.rating}"/>
                                                                        <h:outputText styleClass="new_game_label" value="Uploaded by:"/>
                                                                        <h:outputText styleClass="new_game_data" value="#{dataItem.userName}"/>
                                                                        <h:commandLink styleClass="new_game_label" value="Play Now!"/>
                                                                        <h:selectOneMenu styleClass="new_game_rating" value="#{dataItem.newRating}">
                                                                            <f:selectItems value="#{ratingItems}" />
                                                                        </h:selectOneMenu>
                                                                        <h:commandLink action="#{Home.rateNewGame}" styleClass="message_link" value="Rate"/>
                                                                    </h:panelGroup>
                                                                </h:column>
                                                            </h:dataTable>and Home.java
    private List<SelectItem> ratingItems = null;
         public List<SelectItem> getRatingItems()
             if (ratingItems == null)
                 ratingItems = new ArrayList<SelectItem>();
                 for (int i = 1; i <= 10; i++)
                     SelectItem item = new SelectItem();
                     item.setValue(Integer.valueOf(i));                        
                     ratingItems.add(item);
             return ratingItems;
         public void setRatingItems(List<SelectItem> items)
             ratingItems = items;        
        private List<Game> newGames = null;
        private boolean hasNewGames;
        public List<Game> getNewGames()
            if (newGames ==null)
                newGames = DataFactory.getNewGames();           
            hasNewGames = !newGames.isEmpty();
            return newGames;
        }

    What do you mean by stops rendering? Can you paste the relevant portion of the output (from view source in the browser).

  • How can I get dataTable to display values from the java layer?

    When I use the dataTAble in my JSP page it will only display values from my java layer if the facets tag has it's name set to "header". Why is this happening?
    If I set it to "header" and I look at the page source it actually has created the correct number of rows but it doesn't put the values between the <td> tags? It see's the length of my list but it doesn't pick the values out of the list.
    <h:dataTable var="data" value="#{NameBean.test}" border="1">
    <h:column>
    <f:facet name="header">
    <h:outputText value="Name"/>
    </f:facet>
    </h:column>
    <h:column>
    <f:facet name="header">
    <!-- <h:outputFormat styleClass="outputFormat" id="format1" value="#{NameBean.test}"></h:outputFormat>-->
    <h:outputText styleClass="outputText" value="#{NameBean.test}" style="" rendered="true" escape="false"/>
    </f:facet>
    </h:column>
    </h:dataTable>
    public List gettest()
              List li = new LinkedList();
              Object Developers[] = {"M@n00j", "sdsadas"};
              for( int i = 0; i < Developers.length; i++ )
                   li.add(Developers);
              return li;
    Thanks in advance to anyone that can help.
    -ls6v

    I've been able to get it working with some of those changes along with changes in the JSP. I think it's a setting or two in the JSP that'll allow the program to run correctly.
    I have a list and it's returned like what you suggested. A day or two ago I tried to move the outputtext outside of the facet tag but nothing would print, I know believe that's related to the following setting in the JSP:
    rows="0" in the <h:dataTAble tag
    Unfortunately the dataTAble isn't displaying the values correctly. It prints all of the values (Strings) in the list on each row and it make a new row for the number of items in the list.......... ???
    Here's what it's printing to the screen (the table):
    ===================
    == [asdasd], [sddfdfd] ==
    ===================
    ===================
    == [asdasd], [sddfdfd]==
    ===================
    what it should print:
    ============
    == [asdasd] ==
    ============
    ============
    == [sddfdfd] ==
    ============
    My code:
    public List gettest()
              List li = new ArrayList();
              li.add("asdasd");
              li.add("affffd");
              return li;
              }JSP
    <h:dataTable border="1" columnClasses="list-column-left"
        headerClass="list-header"
        rowClasses="list-row-odd"
        id="table"
        rows="0"
        value="#{NameBean.test}"
        var="data">
    <h:column>
    <f:facet name="header">
    <h:outputText value="test"/>
    </f:facet>
    <h:outputText value="#{NameBean.test}" style="" rendered="true" escape="false"/>
    </h:column>
    </h:dataTable>

  • How to use HtmlDataTable in JSF

    Hi,
    I am going to use HtmlDataTable in a bean. The scenario like this: User submit a symbol (a String) then get stock history information corresponding to this symbol. I put the stock history information in an Arraylist, every element of this Arraylist is a java bean, which contains historical information for this stock according to the time.
    The java bean:
    public class StockHistory {
         private String symbol;
         private String date;
         private long dayVolume;
         private double openPrice;
         private double closePrice;
         private double dayHighPrice;
         private double dayLowPrice;
         public String getSymbol()
              return symbol;
         public void setSymbol(String Symbol)
              this.symbol = Symbol;
         public String getDate()
              return date;
         public void setDate(String date)
              this.date = date;
         public long getDayVolume()
              return dayVolume;
         public void setDayVolume(long dayVolume)
              this.dayVolume = dayVolume;
         public double getOpenPrice()
              return openPrice;
         public void setOpenPrice(double openPrice)
              this.openPrice = openPrice;
         public double getClosePrice()
              return closePrice;
         public void setClosePrice(double closePrice)
              this.closePrice = closePrice;
         public double getDayHighPrice()
              return dayHighPrice;
         public void setDayHighPrice(double dayHighPrice)
              this.dayHighPrice = dayHighPrice;
         public double getDayLowPrice()
              return dayLowPrice;
         public void setDayLowPrice(double dayLowPrice)
              this.dayLowPrice = dayLowPrice;
    }The Arraylist:
    ArrayList data = new ArrayList( 100 );
    Collection threadSafeList = Collections.synchronizedCollection( data );
    StockHistory stock = new StockHistory();
    stock.setSymbol("IBM");
    stock.setDate("01/01/2000");
    stock.setDayVolume(100000);
    stock.setOpenPrice(76.08);
    stock.setClosePrice(78.08);
    stock.setDayLowPrice(75.05);
    stock.setDayHighPrice(79.93);
    data.add(stock);
    stock.setSymbol("IBM");
    stock.setDate("01/01/2002");
    stock.setDayVolume(100300);
    stock.setOpenPrice(86.08);
    stock.setClosePrice(88.08);
    stock.setDayLowPrice(85.05);
    stock.setDayHighPrice(89.93);
    data.add(stock););
    I set HTMLDataTable lke:
    // DataTable
    historyDataTable = new HtmlDataTable();
    // Column1
    UIColumn columnComponent  = new UIColumn();
    List childrenList = historyDataTable.getChildren();
    childrenList.add(columnComponent);
    // Header information 1
    HtmlOutputText headerComponent = new HtmlOutputText();
    headerComponent.setValue("symbol");
    columnComponent.setHeader(headerComponent);
    // Column 2
    columnComponent  = new UIColumn();
    childrenList.add(columnComponent);
    // Header information 2
    headerComponent = new HtmlOutputText();
    headerComponent.setValue("date");
    columnComponent.setHeader(headerComponent);
    // Column3
    columnComponent  = new UIColumn();
    childrenList.add(columnComponent);
    // Header information 3
    headerComponent = new HtmlOutputText();
    headerComponent.setValue("dayVolume");
    columnComponent.setHeader(headerComponent);
    // Column 4
    columnComponent  = new UIColumn();
    childrenList.add(columnComponent);
    // Header information 4
    headerComponent = new HtmlOutputText();
    headerComponent.setValue("openPrice");
    columnComponent.setHeader(headerComponent);        
    // Column5
    columnComponent  = new UIColumn();
    childrenList.add(columnComponent);
    // Header information 5
    headerComponent = new HtmlOutputText();
    headerComponent.setValue("closePrice");
    columnComponent.setHeader(headerComponent);
    // Column 6
    columnComponent  = new UIColumn();
    childrenList.add(columnComponent);
    // Header information 6
    headerComponent = new HtmlOutputText();
    headerComponent.setValue("dayHighPrice");
    columnComponent.setHeader(headerComponent);
    // Column 7
    columnComponent  = new UIColumn();
    childrenList.add(columnComponent);
    // Header information 7
    headerComponent = new HtmlOutputText();
    headerComponent.setValue("dayLowPrice");
    columnComponent.setHeader(headerComponent);
    //get data
    ArrayList list=history(symbol);
    list=(ArrayList) columnComponent.getChildren();
    for(int i=1; i<=list.size(); i++)
         HtmlOutputText rowComponent = new HtmlOutputText();
         rowComponent.setValue("Row"+i);
         rowComponent.setId("Row"+i);
         list.add(rowComponent);
    // DataModel
    ListDataModel listDataModel = new ListDataModel();
    listDataModel.setWrappedData(list);The JSP code to display this table
    <h:dataTable id="Historytable" value="#{stockHistoryBean.historyDataTable}" var="varstockHistory" styleClass="dataTable" headerClass="headerClass" footerClass="footerClass" rowClasses="rowClass1" columnClasses="columnClass1" border="0" cellpadding="2" cellspacing="0" binding="#{stockHistoryBean.historyDataTable}">
    <h:column id="column1" >
    <f:facet name="header">
    <h:outputText styleClass="outputText" value="DATE" id="col1text1"></h:outputText>
    </f:facet>
    <h:outputText id="col1text2" value="#{varstockHistory.symbol}" styleClass="outputText" >
    <f:convertDateTime/>
    </h:outputText>
    </h:column>
                   <h:column id="column2" >
                        <f:facet name="header">
                        <h:outputText styleClass="outputText" value="DATE" id="col2text1"></h:outputText>
                        </f:facet>
                        <h:outputText id="col2text2" value="#{varstockHistory.date}" styleClass="outputText" >
                        <f:convertDateTime/>
                        </h:outputText>
                   </h:column>
                   <h:column id="column3" >
                        <f:facet name="header">
                        <h:outputText styleClass="outputText" value="Dayvolume" id="col3text1"></h:outputText>
                        </f:facet>
                        <h:outputText id="col3text2" value="#{varstockHistory.dayVolume}" styleClass="outputText" >
                        <f:convertNumber/>
                        </h:outputText></h:column>
                        <h:column id="column4" >
                        <f:facet name="header">
                        <h:outputText styleClass="outputText" value="Openprice" id="col4text1"></h:outputText>
                        </f:facet>
                        <h:outputText id="col4text2" value="#{varstockHistory.openPrice}" styleClass="outputText" >
                        <f:convertNumber/>
                        </h:outputText>
                   </h:column>
                   <h:column id="column5" >
                        <f:facet name="header">
                        <h:outputText styleClass="outputText" value="Closeprice" id="col5text1"></h:outputText>
                        </f:facet>
                        <h:outputText id="col5text2" value="#{varstockHistory.closePrice}" styleClass="outputText" >
                        <f:convertNumber/>
                        </h:outputText>
                   </h:column>
                   <h:column id="column6" >
                        <f:facet name="header">
                        <h:outputText styleClass="outputText" value="Dayhighprice" id="col6text1"></h:outputText>
                        </f:facet>
                        <h:outputText id="col6text2" value="#{varstockHistory.dayHighPrice}" styleClass="outputText" >
                        <f:convertNumber/>
                        </h:outputText>
                   </h:column>
                   <h:column id="column7" >
                        <f:facet name="header">
                        <h:outputText styleClass="outputText" value="Daylowprice" id="col7text1"></h:outputText>
                        </f:facet>
                        <h:outputText id="col7text2" value="#{varstockHistory.dayLowPrice}" styleClass="outputText" >
                        <f:convertNumber/>
                        </h:outputText>
                   </h:column>
         </h:dataTable>The problem is when I tried to run, there is this page is not display. But if I remove the HTMLDataTable part from both bean class and JSP, then it works correctly. So much be something wrong with using HTMLDataTable.
    Really appreciate your help

    You should write your own JSF component that generates html frame as you need or
    download already written custom component that generates html frame.

  • How to prevent concurrent Logon from same User ID

    I have my project setup in the following way :
    The User enters the UserName / Password in an html file and when authenticated is directed to the welcome.jsp which is a jsf jsp in the 'restricted' folder.
    Code for html file:
    <form  name="loginFrm" method="post" action="j_security_check">
          <p>Log in to access restricted zone.</p>
          <table>
           <tr>
            <td>User name</td>
            <td>
             <input id="j_username" type="text" name="j_username"/>
            </td>
           </tr>
           <tr>
            <td>Password</td>
            <td>
             <input type="password" name="j_password"/>
            </td>
           </tr>
           <tr>
            <td> </td>
            <td>
             <input type="submit" value="Login" onclick="document.body.style.cursor='wait';"/>
            </td>
           </tr>
          </table>
         </form>I have a backing bean for security which checks whether the user logged is is authorized for certain operation on the web pages.
    The backing bean code is:
      public boolean isTracker()
        ExternalContext ectx =
          FacesContext.getCurrentInstance().getExternalContext();
        boolean tracker = false;
        tracker = ectx.isUserInRole("TRACKER");
        return tracker;
      }The in the jsp if I want to display a field depending on the role, I do :
    <tr:outputText styleClass="showWarning"
                                     rendered="#{security.tracker}"
                                     value="#{messages[\'mandatory.field.message\']}"/>Also I use tiles for my project. One requirement is to print the name of the user logged in on every page. Thats done by adding the following code to layout.jsp
    <f:facet name="infoUser">
            <tr:outputText styleClass="loginInfo"
                           value="#{facesContext.externalContext.userPrincipal.name} is logged in"/>
          </f:facet>My question is how can I implement a solution that not more than one person can log into the site with the same UserName simultaneously.

    Thanks BalusC,
    Can you provide me with some sample code, or is it available on your site ?
    I have added the code to the security backing bean :
    public class SecurityInfoBackingBean
      extends AbstractBackingBean
      private static Set<User> loggedInUsers = new HashSet<User>();
      public boolean isUserLoggedIn(User user) {
       return loggedInUsers.contains(user);
    }How can I use the above code the correct way ?

  • Accessing variable of a datatable from Java Code

    Hello,
    I am trying to present a list of objects with a jsf datatable. However, each object needs to be rendered differently, so, I am including another JSP fragment, depending on the datatype.
    JSP code follows:
    <h:dataTable value="#{pc_ConsultaCliente.dadosCliente.historicoCliente}" var="varhistoricoCliente" styleClass="dataTable" >
    <h:column>
    <f:facet name="header">
    <h:outputText styleClass="outputText" value="HistoricoCliente"/>
    </f:facet>
    <%
    String toinclude="";
    try {
    toinclude=FragmentsHandler.getFragmentForBinding(
    javax.faces.context.FacesContext.getCurrentInstance(),
    "#{varhistoricoCliente}" ,
    Contacto.class);
    } catch (Exception ex) { throw new RuntimeException(ex); }
    %>
    <h:panelGroup>
         <jsp:include page="<%= toinclude %>"/>
    </h:panelGroup>
    </h:column></h:dataTable>
    The problem is, when I try to access the varhistoricoCliente from the FragmentsHandler class, I simply can't reach it (I keep on getting null):
    In it, I use (I get fc as a Faces Context from the JSP):
    public static String getFragmentForBinding(FacesContext fc, String valueBinding, Class defaultClass) throws IOException {
    Object o=fc.getApplication().createValueBinding(valueBinding).getValue(fc), defaultClass);
    //After this, o just gets null
    Is this this right? How can I access the var from the datatable component?
    Many thanks!

    I'm no JSF expert but I'm not sure your approach can work at all.
    I would simplify everything by entering a different tag for each different type of object, and enabling the right one with the "rendered" attribute.
    Something like:
    <table>
       <column>
         <tag1 rendered="#{myResult.isType1}">...
         <tag2 rendered="#{myResult.isType2}">...
       ...

  • To select all the checkbox using valuechangelistner

    Hi ,
    I have a jsp where the check boxes are populated dynamically.
    i have one more check box to select all the check boxes. (like Select all)
    i have written a method in a bean and i have bound that as value changelistner. when i check values in console the check box value is true but the same is not reflected in UI and also when i click delete button the value of the checkbox will be false..
    The value change listner methid is "toggleCheck"
    Please do needfull in this regard..
    here is my code....
    Bean code :
    package com.dyna;
    import java.util.ArrayList;
    import java.util.List;
    import javax.faces.component.UIData;
    import javax.faces.component.UISelectBoolean;
    import javax.faces.event.ValueChangeEvent;
    * @author Bharathk
    * TODO To change the template for this generated type comment go to
    * Window - Preferences - Java - Code Style - Code Templates
    public class Output {
         static ArrayList list = new ArrayList();
         private UIData table;
         private UISelectBoolean sb=null     ;
         private UISelectBoolean sbAll=null;
         static int count = 0;
         * @return Returns the list.
         public ArrayList getList() {
              return list;
         * @param list The list to set.
         public void setList(ArrayList list) {
              Output.list = list;
         * @return Returns the sb.
         public UISelectBoolean getSb() {
              return sb;
         * @param sb The sb to set.
         public void setSb(UISelectBoolean sb) {
              this.sb = sb;
         * @return Returns the sbAll.
         public UISelectBoolean getSbAll() {
              return sbAll;
         * @param sbAll The sbAll to set.
         public void setSbAll(UISelectBoolean sbAll) {
              this.sbAll = sbAll;
         * @return Returns the table.
         public UIData getTable() {
              return table;
         * @param table The table to set.
         public void setTable(UIData table) {
              this.table = table;
    public List add(Input obj) {
    Input in = new Input();
    in.setId(obj.getId());
    in.setName(obj.getName());
    list.add(in);      
    return list;
    public List add(Input obj, int index) {
    Input in = (Input)list.get(index);
    in.setId(obj.getId());
    in.setName(obj.getName());
    list.set(index, in);      
    return list;
    public void deleteobj(Output obj){
         int Rc = table.getRowCount();     
         System.out.println("THIS IS IN DELETE");
         for (int i=0; i<Rc; i++) {
              table.setRowIndex(i);
              System.out.println("FROM DELETE------" +obj.sb.isSelected());
              if(obj.sb.isSelected()) {
                   System.out.println("FROM DELETE");
                   list.remove(i);
    public void toggleCheck(ValueChangeEvent event){
         int rc = table.getRowCount();
         System.out.println("THIS IS IN TOGGLE");
         if (sbAll.isSelected()){
         System.out.println("THIS IS IN TOGGLE--IN IF");
                   for (int i = 0; i< rc;i++) {
                   table.setRowIndex(i);
    // table.setRows(rc);                     
    sb.setSelected(true);
                        System.out.println("THIS IS IN TOGGLE--CHECK--- "+this.sb.isSelected());
         else {
              System.out.println("THIS IS IN TOGGLE--In ELSE");
              for (int i = 0; i< rc;i++) {
                        table.setRowIndex(i);
                        sb.setSelected(false);
         /*for (int i = 0; i< rc;i++) {
              table.setRowIndex(i);
              System.out.println("THIS IS IN TOGGLE--CHECK--- "+this.sb.isSelected());
    // FacesContext.getCurrentInstance( ).renderResponse( );
    "Here is my jsp code........."
    <%@taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
    <%@taglib uri="http://java.sun.com/portlet" prefix="portlet"%>
    <%@taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
    <%@taglib uri="http://www.ibm.com/jsf/html_extended" prefix="hx"%>
    <%@page language="java" contentType="text/html; charset=ISO-8859-1"
         pageEncoding="ISO-8859-1" session="false"%>
    <portlet:defineObjects />
    <LINK rel="stylesheet" type="text/css"
         href='<%= renderResponse.encodeURL(renderRequest.getContextPath() + "/theme/stylesheet.css") %>'
         title="Style">
    <f:view>
         <hx:scriptCollector id="scriptCollector1">
              <%-- jsf:pagecode language="java" location="/JavaSource/pagecode/Sample.java" --%><%-- /jsf:pagecode --%>
              <P>Place content here.</P>
              <h:form styleClass="form" id="form1">
                   <TABLE>
                        <TBODY>
                             <TR>
                                  <TD align="left">Id:</TD>
                                  <TD style="width:5px"> </TD>
                                  <TD><h:inputText id="text1" value="#{inp.id}"
                                       styleClass="inputText">
                                  </h:inputText></TD>
                             </TR>
                             <TR>
                                  <TD align="left">Name:</TD>
                                  <TD style="width:5px"> </TD>
                                  <TD><h:inputText id="text2" value="#{inp.name}"
                                       styleClass="inputText">
                                  </h:inputText></TD>
                             </TR>
                        </TBODY>
                   </TABLE>
                   <h:messages styleClass="messages" id="messages1"></h:messages>
                   <BR>
                   <hx:commandExButton id="button1" styleClass="commandExButton"
                        type="submit" value="Submit" action="#{pc_Sample.doButton1Action}">
                   </hx:commandExButton>
                   <h:selectBooleanCheckbox styleClass="selectBooleanCheckbox"
                                                 id="checkbox1" binding="#{op.sbAll}"
    valueChangeListner="#{pc_Sample.op.toggleCheck}" onCleck="this.form.submit();"></h:selectBooleanCheckbox>
                   <BR>
                   <hx:commandExButton type="submit" value="Delete"
                        styleClass="commandExButton" id="button2" action="#{pc_Sample.doButton2Action}"></hx:commandExButton>
                   <BR>
                   <BR>
              <h:dataTable id="table1" value="#{op.list}" binding="#{op.table}" var="varlist" styleClass="dataTable" headerClass="headerClass"
                   footerClass="footerClass" rowClasses="rowClass1"
                   columnClasses="columnClass1" border="0" cellpadding="2"
                   cellspacing="0">
                   <h:column id="column4">
                   <f:facet name="header">
                             <h:outputText styleClass="outputText" value="Select" id="text13"></h:outputText>
                        </f:facet>
                                            <h:selectBooleanCheckbox styleClass="selectBooleanCheckbox"
                                                 id="checkbox12" binding="#{op.sb}" ></h:selectBooleanCheckbox>
                                       </h:column>
                   <h:column id="column3">
                                            <f:facet name="header">
                                                 <h:outputText styleClass="outputText" value="SlNo" id="text10"></h:outputText>
                                            </f:facet>
                                            <h:commandLink styleClass="commandLink" id="link1" action="#{pc_Sample.doLink1Action}">
                                            <h:outputText id="text20"
                                                 value="#{op.table.rowIndex+1}"
                                                 styleClass="outputText">
                                            </h:outputText>
                                  <f:param name="Id" value="#{varlist.id}"></f:param>
                                  <f:param name="Name" value="#{varlist.name}"></f:param>
                             </h:commandLink>
                                       </h:column>
                   <h:column id="column1">
                        <f:facet name="header">
                             <h:outputText styleClass="outputText" value="Id" id="text31"></h:outputText>
                        </f:facet>
                        <h:outputText id="text4" value="#{varlist.id}"
                             styleClass="outputText">
                        </h:outputText>
                   </h:column>
                   <h:column id="column2">
                        <f:facet name="header">
                             <h:outputText styleClass="outputText" value="Name" id="text5"></h:outputText>
                        </f:facet>
                        <h:outputText id="text6" value="#{varlist.name}"
                             styleClass="outputText">
                        </h:outputText>
                   </h:column>
              </h:dataTable>
         </h:form>
         </hx:scriptCollector>
    </f:view>

    http://forums.ni.com/ni/board/message?board.id=60&message.id=8565&query.id=128811#M8565

  • How to print a JSP page ?

    HI,
    I need to implement a printing functionality on a JSP page.
    So I have a JSP page and there wud be a button on top of it.There is one table containing around 20 columns. So I jusst want to print that table out and nothng else from page.
    So when user clicks on Print button , whcih will open a new window and show the contents to be printed.Once user click Print bbutton on this second newly opened window it shud print.
    Can any one provide pointer to any link or help to implement this?
    Thanks in advance..
    javaardentfan

    You can do it using javascript, see the following JSP code and follow it.
    put the code in DIV tags that you do not wat to see in the final print
    previewRpt() javascript method does all the work..
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <%-- jsf:pagecode language="java" location="/JavaSource/pagecode/jsp/reports/OrderEditDetailsPopup.java" --%><%-- /jsf:pagecode --%>
    <%@taglib uri="http://java.sun.com/jstl/core" prefix="c"%>
    <%@taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
    <%@taglib uri="http://www.ibm.com/jsf/html_extended" prefix="hx"%>
    <HTML>
    <HEAD>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
    <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
         pageEncoding="ISO-8859-1"%>
    <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <META name="GENERATOR" content="IBM Software Development Platform">
    <META http-equiv="Content-Style-Type" content="text/css">
    <LINK href="../../theme/Master.css" rel="stylesheet" type="text/css">
    <LINK rel="stylesheet" href="../../theme/EOPS.css" type="text/css">
    <LINK REL="stylesheet" TYPE="text/css" HREF="../../theme/menus.css" />
    <TITLE>Option Order Edit Details</TITLE>
    <LINK rel="stylesheet" type="text/css" href="../../theme/stylesheet.css"
         title="Style">
    <script language="javascript">
    function previewRpt() {
         document.getElementById("buttonsArea").style.display="none";
         document.getElementById("buttonArea").style.display="none";
         if (document.all) {
              var OLECMDID = 7;
              /* OLECMDID values:
              * 6 - print * 7 - print preview * 1 - open window * 4 - Save As
              var PROMPT = 1; // 2 DONTPROMPTUSER
              var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
              document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
              WebBrowser1.ExecWB(OLECMDID, PROMPT);
              WebBrowser1.outerHTML = "";     
              window.PrintArea.innerHTML = "<div class='formlabel'>Please Click the X on the window to close!</div>"
              window.close();
         } else {
              window.print();
    </script>
    <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
    </HEAD>
    <f:view>
         <BODY onload="javascript:scrollTop=0"><hx:scriptCollector id="scriptCollector1">
              <div style="visibility:hidden">
                   <hx:commandExButton type="button" value="Close"
                   styleClass="custbutton1" id="button2">
              </hx:commandExButton>
              </div>
              <div id="buttonsArea">
                   <table cellpadding="0" cellspacing="0" border="0" width="100%">
                   <tr>
                   <td></td>
                   <td align="right">
                        <input type="image" src="../../images/printRest.gif" title="Print This report"
                                  onclick="previewRpt()"/>
                   </td>
                   </tr>
                   </table>
              </div>
              <TABLE width="100%">
                   <TR><TD align="center"> <h3>Order Edit Detail Report</h3></TD></TR>
                   <TR><TD align="center"> Order Id # <c:out value="${ORDER_HEADER_ID}"></c:out> Details</TD></TR>
              </TABLE>
         <BR>
              <TABLE class="grooved" border="1" cellpadding="0" cellspacing="0">
                   <TR><TD class="formlabel">Account</TD><TD><c:out value="${PART1.ACCOUNT}"> </c:out></TD></TR>
                   <TR><TD class="formlabel">Order Status</TD><TD><c:out value="${PART1.ORDER_STATUS}"></c:out> </TD></TR>
                   <TR><TD class="formlabel">Order Number</TD><TD><c:out value="${PART1.ORDER_NO}"></c:out> </TD></TR>
                   <TR><TD class="formlabel">Sales Rep #</TD><TD><c:out value="${PART1.SALES_REP_NO}"></c:out> </TD></TR>
                   <TR><TD class="formlabel">Order Date</TD><TD><c:out value="${PART1.ORDER_DATE}"></c:out> </TD></TR>
                   <TR><TD class="formlabel">PO</TD><TD><c:out value="${PART1.PO}"></c:out> </TD></TR>
                   <TR><TD class="formlabel">School or Institution Name</TD><TD><c:out value="${PART1.SCHOOL_NAME}"></c:out> </TD></TR>
                   <TR><TD class="formlabel">District or Parent Institution Name</TD><TD><c:out value="${PART1.DISTRICT_NAME}"></c:out> </TD></TR>
                   <TR><TD class="formlabel">Account Name</TD><TD><c:out value="${PART1.ACCOUNT_NAME}"></c:out> </TD></TR>
                   <TR><TD class="formlabel">Attention</TD><TD><c:out value="${PART1.ATTENTION}"></c:out> </TD></TR>
                   <TR><TD class="formlabel">Miscellaneous</TD><TD><c:out value="${PART1.MISC}"></c:out> </TD></TR>
                   <TR><TD class="formlabel">Street Address</TD><TD><c:out value="${PART1.STREET}"></c:out> </TD></TR>
                   <TR><TD class="formlabel">City</TD><TD><c:out value="${PART1.CITY}"></c:out> </TD></TR>
                   <TR><TD class="formlabel">State</TD><TD><c:out value="${PART1.STATE}"></c:out> </TD></TR>
                   <TR><TD class="formlabel">Zip</TD><TD><c:out value="${PART1.ZIP}"></c:out> </TD></TR>
                   <TR><TD class="formlabel">Contact Phone</TD><TD><c:out value="${PART1.CONTACT_PH}"></c:out> </TD></TR>
                   <TR><TD class="formlabel">Contact Fax</TD><TD><c:out value="${PART1.CONTACT_FAX}"></c:out> </TD></TR>
                   <TR><TD class="formlabel">Pack By</TD><TD><c:out value="${PART1.PACK_BY}"></c:out> </TD></TR>
                   <TR><TD class="formlabel">Ship On Date</TD><TD><c:out value="${PART1.SHIP_ON_DATE}"></c:out> </TD></TR>
                   <TR><TD class="formlabel">Order Ship Via</TD><TD><c:out value="${PART1.ORDER_SHIP_VIA}"></c:out> </TD></TR>
                   <TR><TD class="formlabel">Customer Default Ship Via</TD><TD><c:out value="${PART1.CUSTOMER_DEFAULT_SHIP_VIA}"></c:out> </TD></TR>
                   <TR><TD class="formlabel">Warehouse</TD><TD><c:out value="${PART1.WAREHOUSE}"></c:out> </TD></TR>
              </TABLE>
              <BR>
              <c:if test="${PART2_FOUND eq 'YES'}">
              <h:form styleClass="form" id="form1"><h:dataTable border="1" cellpadding="2" cellspacing="0" columnClasses="columnClass1" headerClass="headerClass" footerClass="footerClass" rowClasses="rowClass1" styleClass="dataTable" id="table1" value="#{PART2}" var="rpt" rows="40">
                   <h:column id="column1">
                        <f:facet name="header">
                             <h:outputText id="text1" styleClass="outputText" value="Product Title"></h:outputText>
                        </f:facet>
                        <h:outputText styleClass="outputText" id="text11" value="#{rpt.PRODUCT_TITLE}"></h:outputText>
                   </h:column>
                   <h:column id="column2">
                        <f:facet name="header">
                             <h:outputText styleClass="outputText" value="Product Code" id="text2"></h:outputText>
                        </f:facet>
                        <h:outputText styleClass="outputText" id="text12" value="#{rpt.PRODUCT_CODE}"></h:outputText>
                   </h:column>
                   <h:column id="column3">
                        <f:facet name="header">
                             <h:outputText styleClass="outputText" value="Order QTY" id="text3"></h:outputText>
                        </f:facet>
                        <h:outputText styleClass="outputText" id="text13" value="#{rpt.ORDER_QTY}"></h:outputText>
                   </h:column>
                   <h:column id="column4">
                        <f:facet name="header">
                             <h:outputText styleClass="outputText" value="Customer Service QTY" id="text4"></h:outputText>
                        </f:facet>
                        <h:outputText styleClass="outputText" id="text14" value="#{rpt.CUSTOMER_SERVICE_QTY}"></h:outputText>
                   </h:column>
                   <h:column id="column5">
                        <f:facet name="header">
                             <h:outputText styleClass="outputText" value="Sales Admin QTY" id="text5"></h:outputText>
                        </f:facet>
                        <h:outputText styleClass="outputText" id="text15" value="#{rpt.SALES_ADMIN_QTY}"></h:outputText>
                   </h:column>
                   <h:column id="column7">
                        <f:facet name="header">
                             <h:outputText styleClass="outputText" value="Product Price" id="text7"></h:outputText>
                        </f:facet>
                        <h:outputText styleClass="outputText" id="text17" value="#{rpt.PRODUCT_PRICE}"></h:outputText>
                   </h:column>
                   <h:column id="column8">
                        <f:facet name="header">
                             <h:outputText styleClass="outputText" value="Extended Cost" id="text8"></h:outputText>
                        </f:facet>
                        <h:outputText styleClass="outputText" id="text18" value="#{rpt.EXTENDED_COST}"></h:outputText>
                   </h:column>
                   <h:column id="column9">
                        <f:facet name="header">
                             <h:outputText styleClass="outputText" value="Gratis" id="text9"></h:outputText>
                        </f:facet>
                        <h:outputText styleClass="outputText" id="text19" value="#{rpt.GRATIS}"></h:outputText>
                   </h:column>
                   <h:column id="column10">
                        <f:facet name="header">
                             <h:outputText styleClass="outputText" value="Series" id="text10"></h:outputText>
                        </f:facet>
                        <h:outputText styleClass="outputText" id="text20" value="#{rpt.SERIES}"></h:outputText>
                   </h:column>
                        <f:facet name="footer">
                             <hx:panelBox styleClass="panelBox" id="box1">
                                       <hx:pagerDeluxe styleClass="pagerDeluxe" id="deluxe1" />
                                  </hx:panelBox>
                        </f:facet>
                   </h:dataTable></h:form>
              </c:if>
              <br>
              <div id="buttonArea">     
              <center><hx:commandExButton type="button" value="Close"
                   onclick="window.close();" styleClass="custbutton1" id="button1">
              </hx:commandExButton></center>
              </div>
              <BR>
         </hx:scriptCollector></BODY>
    </f:view>
    <HEAD>
    <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
    </HEAD>
    </HTML>

  • CommandLink and navigation

    Hi, I built a dataTable and put two columns each one with one commandLink with action param. The action methods were not the same and each returned a string. The navigation simply did not executed what I was hoping sometimes openning the first, or the second page configured in the faces-config.
    I changed to commandButton and everything worked fine as expected.

    Hi,
    Here we go.
    The jsf page had
    <h:dataTable width="650" border="0" cellpadding="0" cellspacing="2"
    rowClasses="list-row-odd,list-row-even"
    id="table"
    value="#{sapFormBean.listAP}"
    var="sap">
    <h:column>
    <f:facet name="header">
    <h:outputText value=""/>
    </f:facet>
    <h:commandLink id="imprimeAP"
    action="#{sapFormBean.submitImprimeAPAction}"
    alt="Imprime esta AP">
    <h:graphicImage id="copy" url="bullets/print.gif"/>
    </h:commandLink>
    </h:column>
    <h:column>
    <f:facet name="header">
    <h:outputText value=""/>
    </f:facet>
    <h:commandLink id="copiaAP"
    action="#{sapFormBean.submitCopiaAPAction}"
    alt="Gera nova AP a partir desta" >
    <h:graphicImage id="copy" url="bullets/copy.gif"/>
    </h:commandLink>
    </h:column>
    <h:column>
    <f:facet name="header">
    <h:outputText styleClass="celTitulo" value="C�DIGO"/>
    </f:facet>
    <h:outputText id="codigo" value="#{sap.sap_codigo}"/>
    </h:column>
    </h:dataTable>
    I configured the actions to return the strings "imprimir" and "copiar". In the faces-config I put
    <navigation-rule>
         <from-view-id>/lista_default.jsp</from-view-id>
         <navigation-case>
              <from-outcome>imprimir</from-outcome>
              <to-view-id>/imprimir.jsf</to-view-id>
         </navigation-case>
         <navigation-case>
              <from-outcome>copiar</from-outcome>
              <to-view-id>/formulario.jsf</to-view-id>
         </navigation-case>
    </navigation-rule>
    I changed then the commandLink to
    <h:commandButton id="imprimeAP"
    action="#{sapFormBean.submitImprimeAPAction}"
    image="bullets/imprimir.gif"
    alt="Imprime esta AP"/>
    <h:commandButton id="copiaAP"
    action="#{sapFormBean.submitCopiaAPAction}"
    image="bullets/copiar.gif"
    alt="Gera nova AP a partir desta" />
    Thanks...

Maybe you are looking for

  • How do I delete someone's icloud account from my ipad?

    This person set up my new ipad with his apple ID instead of letting me create my own, I somehow got rid of it but now I've updated to IOS 8 and for some reason his icloud account is still on my ipad, I can't sign out and use my ID because I have to t

  • Ipod Not recognized 3rd generation

    Ok so yesterday i had an ipod nano that wa snew and i had already had itunes downloaded on the computer. I found out that itunes could not recognize the drive and i had to reformat and update my ipod to get it to recognize. Well it worked. The proble

  • Is it possible to add a hyperlink to a comment?

    I'd like to be able to click on a hyperlink in the comments box. I have some GPS data from my trips and would like to link it to google maps. Thanks Mac mini   Mac OS X (10.4.7)  

  • Slow loading of photo pages ~~ reason why ~~

    I've been looking around some of the threads on this problem. And here is the horror story I have found. When you load a photo page it not only downloads the thumbnails but also the full size image as well!! So the web page loads all the thumbnails a

  • Getting lines in prints Photoshop CS6

    Hello, I am getting lines in my prints from PhotoShop CS6. My printer is the Canon MX522. Ive noticed that printing from other *dumb* programs such as Microsoft Paint the images look fine BUT with photoshop the images print ultra fast and have lines.