H:outputText value="#{bean.something}"

Hello togehter!
I want to get all the outputtexts from a bean. (I want to offer to change the language.)
The problem is for my header.jsp and footer.jsp it doesn't work.
It just shows nothing.
I have the same code (h:outputText value="#{bean.something}") in my normal pages and ther it works.
The problem is I think that in my header.jsp and footer.jsp I don't have a f:view.
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="c"%>
<c:facet name="footer">
<table border="0" cellpadding="0" cellspacing="4" align="center">
                    <tr>
                         <td>
               <h:panelGroup id="footer">
                    <h:outputText value="#{message.footer}"/>
               </h:panelGroup>
          </td>
                    </tr>
               </table>
</c:facet>
That is my footer,jsp
and I include it like tha:
<%@ include file="footer.jsp" %>
So my question is how can I make it work.
I just want to have one header and one footer for all my pages and I want to get the outputtexts from a bean.
Thanks a lot.

When you include pages, you should wrap the included page in f:subview.
The catch is that anything inside an f:subview must be straight JSF. i.e. no <table>, <TR>, or <TD> commands.
Here's a thread with more info on subviews:
http://forum.java.sun.com/thread.jspa?threadID=715984
Metropolitan is giving you good advice about f:facet and h:panelgroup. Your usage of both of these is incorrect and unnecessary. You should remove the occurrences of these in your file.
CowKing

Similar Messages

  • How to change a h:outputText value in the current form on key pressed event

    Hello Suners,
    Greetings! I'm developing my first JSF web application and i'm trying to figure a way out to change outputText value when key pressed on another inputText so that when the user is typing his name for example he can see the letters showing respectively in the outputText.
    I managed to do it onchange but the user must focus out of the inputText to see his name in the outputText which is not right and the form must submit onchange event which is annoying.
    <h:inputText value="#{login.username}" title="name" id="name" required="true" onchange="this.form.submit()" >
                                <f:validateLength maximum="10" minimum="1"/>
                                <f:validator validatorId="myValidator"/>
                                <f:valueChangeListener type="classes.MyListener"/>
    </h:inputText>Is there any listener i can associate with the "onkeypress" attribute? Can anyone help me to do that with JSF?
    King Regards,

    hi, with JSF 2 you got the ajax tag, just tried it and it works fine :)
    <h:inputText id="myinput" value="#{back.name}">
        <f:ajax execute="@this" event="keyup" render="outtext"/>
    </h:inputText>
    <h:outputText id="outtext" value="#{back.name}"/>or before JSF 2
    <h:outputScript name="jsf.js" library="javax.faces" target="head"/>
    <h:inputText id="myinput" value="#{back.name}" onkeyup="jsf.ajax.request(this, event, {render: 'outtext'}); return false;"/>
    <h:outputText id="outtext" value="#{back.name}"/>The name property is a simple String in the bean.
    Hope this helps
    Edited by: hereps on Aug 21, 2010 7:18 AM

  • Filter af:outputText  value with some parameters before loading component

    I use jdeveloper 10.1.3 with web adf components.
    I want to show outputText component with some custom Object (item),
    <af:outputText value="#{bindings.item}">
    but before showing this component on the page , during runtime, this item object must be filtered with some parameters and then returned some string ( convert item object to string with parameters during runtime, before loading this outputText component).
    How can I do this?
    Maybe it needs some back beans or I am thinking to create custom component like outputText ,but how to do ?
    what is optimal disizion?
    can someone help me or someone can send some documentation?

    Hi,
    When u will bind Output Text with some method in Backing bean u will get a set(),get() methods along with a CoreOutputText variable, u can initialized the variable , and if u want to check any condition then before setting the value then check the condition in the constructor of the backing bean and then change the CoreOutputText value accordingly,which will set the corresponding value,in the UI
    Thanks

  • Value="${bean.param}" doesn't work on tomcat 5, WHY ?

    Hello,
    I have a web application with jsf 1.1. My application has to play some flash movies. Here is my playMovie.jsp :
    <h:form id="form"  onkeydown="return sendInfo(event);">
           <h:commandButton id="redirect" action="#{marketTest.whichSessionAction}" style="visibility:hidden;"/>
           <h:outputLabel id="videoName" value="#{marketTest.videoName}" style="visibility:hidden;"/>
           <f:verbatim>
              <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
                      codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0"
                      width="800" height="600" id="market" align="middle">
                  <param name="allowFullScreen" value="false" />
                  <param name="movie" value="${marketTest.videoName}" />
                  <param name="menu" value="false" />
                  <param name="quality" value="high" />
                  <param name="bgcolor" value="#000000" />
                  <param name="loop" value="false" />
                  <embed src="${marketTest.videoName}" menu="false" quality="high" bgcolor="#000000" width="800" height="600" name="market" align="middle"
                         loop="false" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"/>
             </object>
             <br/>
           </f:verbatim>
            <h:outputText value="#{marketTest.userPosText}"/>
         </h:form>I test it on my computer where I have tomcat 6 and it works very well, but when I put the application on the server where is installed tomcat 5, I have no movies and when I looked at the source page I saw that ${marketTest.videoName} wasn't translated to the real movie name.
    Does someone know what can I do ?
    Thanks in advance.

    EL in template text only works on Servlet 2.4 / JSP 2.0 and newer. So you need at least Tomcat 5.5. Tomcat 5.0 is Servlet 2.3 / JSP 1.2 and Tomcat 6.0 is Servlet 2.5 / JSP 2.1.
    To fix this, use JSTL c:out tag. This problem is by the way not related to JSF.

  • Can we set h:outputText value= "(some javascript function value)"/

    Hi
    Can we set <h:outputText value= "(some javascript function value)"/>
    In a scenario like when user changes the item in dropdown box. label name as to change for the next text box.
    -----JSP page------
    h:outputText value="*" styleClass="mandatoryField" />
    <h:outputText value="Matching Criteria:" />
    <h:selectOneMenu id="MatchingCriteria" styleClass="dropDownMenu" value="#{OffsetTradingRuleBean.matchingCriteria}"immediate="true" onchange="unitChange()">
    <f:selectItems value="#{OffsetTradingRuleBean.matchingCriteriaMap}"/>
    </h:selectOneMenu>
    <h:outputText value=""></h:outputText>
    <h:outputText value=""></h:outputText>      
    <h:outputText id="DeminimisLabel" value="" ></h:outputText>
    <h:inputText id="DeMinimisUnit" styleClass="text" value="#{OffsetTradingRuleBean.deMinimisUnit}" maxlength="15" onchange="detectChange()" >
    <f:validator validatorId="DefaultValidator"/>          
    </h:inputText>
    <h:outputText value=""></h:outputText>
    -----Java Script-----
    function unitChange(){
         if(document.getElementById("frm:MatchingCriteria").value!="1"){
         alert('inside unitchange--'+document.getElementById("frm:MatchingCriteria").value)
              document.getElementById("frm:DeminimisLabel").value="Deminimis Dollars";
         if(document.getElementById("frm:MatchingCriteria").value!="0"){
              document.getElementById("frm:DeminimisLabel").value="Deminimis Shares";
    thanks in advance
    Rambhapuri

    balu
    actually i want to swap label name using javascript. first i will call onchange event from matching criteria dropdown box . then it will fire unitChange() function.
    then i am putting value Deminimis dollor or deminimis shares accroiding to the value which is there in dropdown.
    this value as to come in <h:outputText id="deminimisLabel" value=" should come value from java script" />
    and it should act dynamically ,. like when ever user changes the dropdown item . the corresponding name should change in lable name.
    thanks
    rambhapuri

  • Mixing static and dynamic content in a single outputText value causes NPEs

    Hi,
    I am having a problem and I'm wondering if it is a result of my error or if this is a bug.
    I am mixing dynamic and static content in the value attribute of tags (e.g., outputText). On initial page load, everything works fine. However, if the same view is reloaded (e.g., after a failed validation) I get an NPE from JSF:
    [#|2006-10-24T08:49:03.756-0500|SEVERE|sun-appserver-pe8.2|javax.enterprise.system.container.web|_ThreadID=12;|StandardWrapperValve[Faces Servlet]: Servlet.service() for servlet Faces Servlet threw exception
    java.lang.NullPointerException
            at com.sun.faces.el.MixedELValueParser.getNextToken(MixedELValueParser.java:140)
            at com.sun.faces.el.MixedELValueParser.parse(MixedELValueParser.java:123)
            at com.sun.faces.el.MixedELValueBinding.getValue(MixedELValueBinding.java:60)
            at javax.faces.component.UIOutput.getValue(UIOutput.java:147)
            at com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getValue(HtmlBasicInputRenderer.java:82)
            at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.getCurrentValue(HtmlBasicRenderer.java:201)
            at com.sun.faces.renderkit.html_basic.LabelRenderer.encodeBegin(LabelRenderer.java:128)
            at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:683)
            at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:443)
            at com.sun.faces.renderkit.html_basic.GridRenderer.encodeChildren(GridRenderer.java:233)
            at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:701)
            at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:445)
            at com.sun.faces.renderkit.html_basic.GroupRenderer.encodeChildren(GroupRenderer.java:130)
            at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:701)
            at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:445)
            at com.sun.faces.renderkit.html_basic.GridRenderer.encodeChildren(GridRenderer.java:233)
            at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:701)
            at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:445)
            at com.sun.faces.renderkit.html_basic.GroupRenderer.encodeChildren(GroupRenderer.java:130)
            at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:701)
            at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:445)
            at com.sun.faces.renderkit.html_basic.GridRenderer.encodeChildren(GridRenderer.java:233)
            at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:701)
            at javax.faces.webapp.UIComponentTag.encodeChildren(UIComponentTag.java:609)
            at javax.faces.webapp.UIComponentTag.doEndTag(UIComponentTag.java:546)
            at com.sun.faces.taglib.html_basic.PanelGridTag.doEndTag(PanelGridTag.java:460)
            at org.apache.jsp.registration_jsp._jspx_meth_h_panelGrid_0(registration_jsp.java:324)
            at org.apache.jsp.registration_jsp._jspx_meth_h_form_0(registration_jsp.java:223)
            at org.apache.jsp.registration_jsp._jspx_meth_f_view_0(registration_jsp.java:157)
            at org.apache.jsp.registration_jsp._jspService(registration_jsp.java:118)
            at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:105)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:860)
            at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:336)
            at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:297)
            at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:247)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:860)
            at sun.reflect.GeneratedMethodAccessor188.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:585)
            at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:249)
            at java.security.AccessController.doPrivileged(Native Method)
            at javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
            at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:282)
            at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:165)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:257)
            at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:55)
            at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:161)
            at java.security.AccessController.doPrivileged(Native Method)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
            at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:723)
            at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:482)
            at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:417)
            at org.apache.catalina.core.ApplicationDispatcher.access$000(ApplicationDispatcher.java:80)
            at org.apache.catalina.core.ApplicationDispatcher$PrivilegedForward.run(ApplicationDispatcher.java:95)
            at java.security.AccessController.doPrivileged(Native Method)
            at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:313)
            at com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:326)
            at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:132)
            at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
            at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:248)
            at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
            at javax.faces.webapp.FacesServlet.service(FacesServlet.java:194)
            at sun.reflect.GeneratedMethodAccessor202.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:585)
            at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:249)
            at java.security.AccessController.doPrivileged(Native Method)
            at javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
            at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:282)
            at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:165)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:257)
            at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:55)
            at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:161)
            at java.security.AccessController.doPrivileged(Native Method)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
            at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:263)
            at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
            at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:225)
            at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:173)
            at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
            at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
            at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
            at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:132)
            at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
            at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:933)
            at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:189)
            at com.sun.enterprise.web.connector.grizzly.ProcessorTask.doProcess(ProcessorTask.java:604)
            at com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:475)
            at com.sun.enterprise.web.connector.grizzly.ReadTask.executeProcessorTask(ReadTask.java:371)
            at com.sun.enterprise.web.connector.grizzly.ReadTask.doTask(ReadTask.java:264)
            at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:281)
            at com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:83)My code looks like this:
    <h:outputText escape="false"
              value='<link href="#{myBean.styleSheet}" rel="stylesheet" type="text/css"  />' />If I replace this with a much more convoluted set of tags, it works:
    <h:outputText escape="false"
              value='<link href="' /><h:outputText escape="false" value="#{myBean.styleSheet}"
              /><h:outputText escape="false" value='" rel="stylesheet" type="text/css" />' />So is the problem that I am mixing dynamic and static content with a single value? If so, why does it work on the first view, and not after?
    If it matters, I'm using the reference implementation version 1.1 (as included with NetBeans 5.5RC2) on SuSE 10.0 w/ JDK 1.5_09.
    Thanks,
    Bill

    Yes, that's how I originally had it, but then changed it to the outputText approach since a single tag could do what I wanted, as long as I was allowed to mix static and dynamic content within a single value.
    I think this is a bug in JSF 1.1, since if what I am doing is illegal, it should throw an exception on the first page view, not work on first view and throw an exception on subsequent views. I'm guessing that this has something to do with the fact that on first page view it only runs the restore view and render response JSF phases, while on subsequent requests all of the phases will be run, and it's in one of those other phases that the exception is thrown.
    For now, multiple tags is the work-around, I guess.
    Thanks,
    Bill

  • How to create a form value bean.

    Hi to all,
    In my page I have one lov. It gives Address and Addressid. I want to show the address details (only ) to User. I dnt want to show the addressid. But I passed the addressid to database.
    Set the Addressid in form value and set the Address in msgtextbean. Pass the Addressid to database. Is it possible?
    I want to know how to create formvalue bean dynamically. Anyone knows plz let me know..
    Thanks in Advance
    Regards
    Senthur

    Hi Senthur,
    Why you want to create it dynamically? You can create it at design time itself.
    For your requirement create on formvalue item, create another LOV mapping that provide and set there item name from LOV region and return item.
    Regards,
    Reetesh Sharma

  • How to set the value of something in a component from the main application?

    Hi,
    Maybe I've been working on this too long, but I can't figure
    out how to set the value of the text property of a text input field
    in a component from my main application in an mx:Script block. I
    have a component called Login in the components folder, and I need
    to set the text value of empNum. In my mxml declaration at that the
    top, I've declared these components as xmlns:c="components.*" So
    logically, the property I'm trying to set is c.Login.empNum.text. I
    can't figure out the correct syntax to get this to work, and I've
    tried everything I can think of. Does anyone have any suggestions?
    I'm thinking this should be an easy one, and I'm just missing
    something.
    Thanks!
    Holli

    Did you try giving it an id ?
    <c:MyLogin id="loginScreen" /c>
    So later you can do loginScreen .empNum.text = "my text"
    Laurent,

  • SharePoint Calc Column - How to Find and Replace ANY & ALL Values with Something Else

    Haven't found a solution on this even though it seems like it should be cut and dry.
    I have a column containing characters "-" (e.g., XXX123-123-fjhrh-sdafsdfsd). I want to find every "-" and replace it with "@". Seems easy but so far haven't found a solution. My calc column always seems to stop at the first
    occurence of "-" and only replace that one. Seems every forumula wants you to tell SharePoint where to start (position). You can't simply tell SharePoint, Find this "-" ALL OCCURENCES and replace with this "@" ALL OCCURENCES.
    I don't have the option of saying start at this position because my data is not the same in every cell/field (e.g., number of characters).
    Closest I've gotten is this:
    =REPLACE([IN THIS COLUMN],FIND("-",[IN THIS COLUMN]),LEN("-","@")
    RESULTS:
    XXX@123-XXX-123

    Hi JJSHAREP,
    The formula only works when there are only three "-" in the column value, and the formula will fail if there are more than or less than three "-" in the column value.
    I recommend to use Jquery code to replace the characters in the column called IN THIS COLUMN in the UI:
    <script src="http://code.jquery.com/jquery-1.10.2.min.js" type="text/javascript"></script>
    <script type="text/javascript">
    $(function () {
    var Index=0;
    $(".ms-listviewtable tr th").each(function(i){
    if($(this).find("div").attr("name")=="IN_x0020_THIS_x0020_COLUMN"){
    Index=i;
    $(".ms-listviewtable tr").each(function(i){
    if(i>0){
    var value=$(this).find("td").eq(Index).text();
    var value1=value.replace(/\-/g, '@');
    $(this).find("td").eq(titleIndex).text(value1);
    </script>
    Best regards.
    Thanks
    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]

  • Is there a way to find out the server is pending for a reboot by SCCM? any reg value or something to find it?

    There are some servers which are tagged as No restart servers(which cannot be rebooted regularly) due to some critical apps are running on them.
    Is there any reg value or some thing where we can find the server is pending for a reboot from SCCM? currently the SCCM services are stopped on them to prevent any unwanted reboot. 
    But if can find this info it will be very helpful
    ----Please vote if this is helpful----- -----Knowledge is Power-------- Ajo Abraham [MCP] [MCTS]

    You can also create collection for reboot pending machines based on its lastenforcementmessageID.
    SELECT SMS_R_SYSTEM.ResourceID, SMS_R_SYSTEM.ResourceType, SMS_R_SYSTEM.Name,
    SMS_R_SYSTEM.SMSUniqueIdentifier, SMS_R_SYSTEM.ResourceDomainORWorkgroup,
    SMS_R_SYSTEM.Client FROM sms_r_system inner join SMS_UpdateComplianceStatus
    ON SMS_UpdateComplianceStatus.machineid=sms_r_system.resourceid
    WHERE SMS_UpdateComplianceStatus.LastEnforcementMessageID = 9
    Eswar Koneti | Configmgr blog:
    www.eskonr.com | Linkedin: Eswar Koneti
    | Twitter: Eskonr

  • Collection valued bean property problem

    Hi.
    If I have this property:
    private List<String> myList;Should I annotate it with @OneToMany etc.. ?
    I mean, this is a String.... not custom Entity.

    Can someone help anyway ?

  • How do I use a bean to determine which message bundle value to use?

    Is there a way to use a bean to determine which message from my message bundle I use? I want to be able to call my bean in JSF/JSP page, have the bean return a String, and use that String to pick a message from my message bundle properties file. Now I can do this:
    <h:outputText value="#{bundle.messageA}" />or this:
    <h:outputText value="#{bean.messageName}" />where I have a method on the bean like this:
    public String getMessageName(){
         if(someTest == true){
              return "messageA";
         } else {
              return "messageB";
    }I want to combine the two so my bean determines which message I pick. I want to do this because I want to keep all the text a user sees in the message bundle file. However, based on the state of the bean, I want to display different messages.
    Thanks in advance,

    Ah this way. So you want that much of nasty if statements in the bean instead? ;)
    Then make use of the fact that you also can access Map values using the brace notation. E.g.
    <h:outputText value="#{bundle[bean.messageKey]}"/>Where getMessageKey() returns the message key, e.g. 'messageA' or 'messageB' and so on.

  • 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}"/>

  • How to Get the Value in h:inputText to JavaScript?

    I have to use JSF to pop up a window from the parent window. In the popup window, I have to pass the value that is entered in a <h:inputText> back to a text field in the parent window.
    In order to make sure that I know the way to communicate between the parent window and the popup window, I have tried coding it in HTML. And I have done it successfully.
    Then, I try to convert the HTML code to JSF. I have searched the internet and I have tried different specifications myself. I am stuck. This is the line that I have been struggling with:
    window.opener.document.forms[0].form["dataManagement:textField"].value = document.forms[0].form["externalFile:inputField"].value;If textField is in HTML parent window <input name=textField .... /> and the inputField is in HTML popup window <input name=inputField .... />, the JavaScript can recognize (No problem! the datum is passed.):
    window.opener.document.forms[0].textField.value = document.forms[0].inputField.value;Now, the dataManagement is the "id" attribute in my JSF parent <h:form> tag. The externalFile is the "id" attribute in my JSF popup <h:form> tag.
    The textField is in the JSF parent window as both the "id" attribute and a "property" name (i.e. value="#{dataManagementBean.textField}" )in the <h:inputText> tag.
    The inputField is in the JSF popup window as both the "id" attribute and a "property" name (i.e. value="#{accessExternalFileBean.inputField}" ) in the <h:inputText> tag.
    No matter how I experiment with different specifications, I cannot get the textField and inputField in the JavaScript. I got that "it is null or not an object" JavaScript error. Please advise if you have done it successfully.

    You could bind your h:inputText to a UIInput on the managed bean. Then when you are outputting your text for your javascript you could generate the clientId by placing a <h:outputText value="#{bean.textField.clientId}"/> into the javascript. And for getting the correct field you might use:
    document.forms[0].elements['<h:outputText value="#{bean.textField.clientId}"/>'].valueI have not used it for popups, but I have used it for setting other values and it seems to work well.
    Hope this helps.
    Tom

  • One reason why commandLink doesn't work in dataTable

    Ok, so I think I've got an explanation why commandLink doesn't work in dataTable when the model bean is request scoped. Maybe somebody can tell me if I'm wrong.
    I have a model bean that generates table rows based on some input criteria (request parameters).
    So, we validate the inputs, apply them to the bean and render the page. Once the inputs have been applied to the bean, a request for table rows returns rows, no problem.
    However, we put a commandLink in each row, so we can expand the details. Maybe we even get smart and repeat the input row-generating criteria as a hidden field in the page.
    Unfortunately, when the user hits the commandLink, the list page simply refreshes, maybe even w/out table rows. The user doesn't get the details page as expected.
    Why not?
    Because: in the DECODE phase (even before validation and before "immediate" values have had their valueChangeListeners called), we ask the model bean for the table rows, so we can decode the commandLinks. Unfortunately, in "decode" phase, the request-scoped model bean has not had its row-generating criteria updated (that happens in the "update model" normally, or at the END of the decode phase if we got cute by (1) setting the "immediate" attribute on the row-generating criteria to "true" AND (2) set a valueChangeListener to allow us to update the model bean early. The END of the decode phase isn't good enough -- in the middle of that phase, when we're attempting to deocde commandLinks, the model bean has no citeria, so there's no row data. No row data means no iteration over commandLinks to decode them and queue ActionEvents. So, we march through the rest of the phases, process no events, and return to the screen of origin (the list screen) with no errors.
    So, what's the solution?
    One solution is to make the model bean session-scoped. Fine, maybe we can store a tiny bit of data in it (the search criteria), so it's not such a memory drag to have it live in the session forever. How do we get that data in? A managed property in faces-config.xml with value #{param.PARENT_KEY} won't work because it's assigning request-scoped data to a session-scoped holder. JBoss balks, and rightly so. Do we write code in the model bean that pulls the request parameter out of thin air? (FacesContext.getExternalContext()....) I don't really like to code the name of a specific http request parameter into the bean, I think it's the job of the JSP or faces-config.xml to achieve that binding (request parameter to model propery). Plus, I'd be sad to introduce a dependency on Faces in what was previously just a bean.
    Is there a better way?
    In my particular situation, we're grafting some Faces pages onto an already-existing non-Faces application. I don't get the luxury of presenting the user an input field and binding it to a bean. All I've got to work with is a request parameter.
    Hmm, I guess I just answered my own question. if all I've got to work with is a request parameter, some ugliness is inevitable, I guess.
    I guess the best fix is to cheat and have the bean constructor look for a request parameter. If it finds it, it initializes the criteria field (which, in my case, is the key of an object that has a bunch of associated objects (the rows data), but could be more-general d/b search criteria).
    (I looked at the "repeater" example code in the RI, but it basically statically-generates its data and then uses 100% Faces (of course) to manage the paging (where "page number" is essentially the "criteria").
    Comments? Did I miss something obvious?
    John.

    ...or I could just break down and do the thing I was hoping to avoid (outputLink instead of commandLink):
    <h:outputLink value="/faces/Detail.jsp">
      <f:param name="PARENT_KEY" value="#{bean.parentKey}"/>
      <h:outputText value="#{bean.label}"/>
    </h:outputLink>It's still a "hardcoded" parameter name, but at least the binding is in the JSP and faces-config.xml, not the bean Java code.

Maybe you are looking for

  • Won't sleep when I close the lid - HELP!

    A while ago, my iBook G4 1GHz was knocked off of a table. The display was smashed and the whole display assembly was destroyed. I bought a new (used) display assembly and installed it. Worked fine, but when I closed the lid, the iBook woudn't sleep.

  • Teststand call cvi instrument driver

    I'm new to working with instrument drivers in TestStand. I'm trying to use TestStand to call a CVI instrument driver dll (for Agilent N5767 power supply), and then perform a specific function (init, set voltage, set current, etc.) All of the instrume

  • ME31K :  BAPI_AGREEMENT_MAINTAIN

    Hi i am trying to create the contract using BAPI  :  BAPI_AGREEMENT_MAINTAIN . BUT i am getting an error : "Please enter material number or account assignment category" i am passing the following  parameters   wa_contract_header-vendor = '300005' .  

  • Txt to waveform chart

    Hi! Just a very simple question: I have a txt file with the following structure: 2012.03.13 19:13    6.93E-05 2012.03.13 19:14    6.29E-05 2012.03.13 19:15    5.66E-05 2012.03.13 19:16    5.21E-05 So tab delimited time stamps and values. I would like

  • APPLE ID LOGIN PROBLEMS

    I have a valid Apple Id (I can log into Apple Id website/change details/change password etc), but I can't use the Id to sign in to iTunes on my PC or to download Apps from my iPhone. I get 'Could not sign in - an unknown error has occurred' on the iP