Rendered terms on jsf component

Hello
I have a problem with component rendering. I use dataTable and inside that i have a t:columns -tag.
I want that a could use a two different components on the same row like this:
column 1 | column 2
t:inputText | t:inputTextarea
if i wrote this kind of rendering terms
ValueBinding htmlInputTextRenderedVb = FacesContext.getCurrentInstance().getApplication().createValueBinding("#{!empty var.mapHash[column.header]}");
htmlInputText.setValueBinding("rendered", htmlInputTextRenderedVb);Above code work, but it's rendering both components on same column.
So my question is that how i can rendered two different component on same row? Do i have to use a two HashMap?

Found out the solution from the book 'Core JavaServer Faces' by David Geary and C HorstMann. Add the line 'return false;' i.e
showModelessDialog(relevant params);return false;
BTW don't bother buying the book JavaServer Faces
By Hans Bergsten. The above book is far better.

Similar Messages

  • JSF component inside HTML table -- not rendering properly

    I have a HTML table like the one below. In one of those columns (td) I have a JSF component. When I run the app, the JSF component (even if its a simple inputText or panelGrid or panelGroup) is not getting inside the td. Instead, it forms a seperate table after this td.
    Code I have:
    <table border="0" cellpadding="0" cellspacing="0">
    <tbody>
    <tr>
    <td>... ..MULTIPLE Td's here - Deleted for simplicity </td>
    <td class="topNav">
    Blog Directory
    </td>
    <td>
    <img src="./images/top_button_right.gif"/>
    </td>
    <td class="topNav">
    <f:panelGroup>
    <h:inputText value="Username"/>
    <h:inputSecret value="Password"/>
    </f:panelGroup>
    </td>
    </tr>
    </tbody>
    </table>
    What I expected:
    username, passwd field inside the top level HTML table.
    What comes: (as a result of running thsi JSF page )
    <table> -- Original table
    <td> </td> -- -TD that had the inputText - comes empty here
    </table>
    <table>
    <tbody>
    <tr>
    <td><input type="text" name="_id1:header:EasyHeader:_id4" value="Username" /><input type="password" name="_id1:header:EasyHeader:_id5" value="" /></td>
    </tr>
    <tr>
    <td><table>
    I am a newbie to JSF & due to the complexity of the layout & page, I m unable to get rid of the HTML tags totally.
    Thanks in advance.
    Ganesh

    Found the solution to the problem.
    wrapped the entire HTML page till the JSF component ( panelGrid) under <f:verbatim>.
    something like this
    <f:verbatim>
    <table>
    <tr> <td>...</td>
    <td>
    </f:verbatim>
    <h:panelGrid> ... </h:panelGrid>
    <f:verbatim>
    </td>
    </table>
    </f:verbatim>

  • How to add properties to a custom JSF component?

    Hello, everybody!
    I've just developed my first custom JSF component. It's a data pager and it is working pretty well. But now I want to be able to use some of it attributes in my backing beans at runtime. I mean, I want to bind it to component in the JSF page. It already has a binding attribute in the tld file, but I want to be able to accesss two values that the renderer of my custom component calculate inside it, which would relieve me from calculating these values manually in the backing beans. So, I would like to know how to make these values external to the component.
    By now this is my custom pager class:
    import javax.faces.component.UICommand;
    public class UIPaginadorDados extends UICommand
    }You can see that it has no logic because all the logic is in the renderer class:
    import javax.faces.render.Renderer;
    public class PaginadorDadosRenderer extends Renderer
        // logic here
    }As I said I want to be able to do the following in my backing beans:
    private UIPaginadorDados pager = new UIPaginadorDados();
    // and later...
    pager.getCurrentPage();
    pager.getPageCount();In the JSF page:
    // I already can do this, because I have a binding attribute
    <urca:paginadorDados binding="#{backingBean.pager}" />I suppose that I'll have to create the properties getCurrentPage() and getPageCount() in the component class, UIPaginadorDados, but I don't know how to get the values to the properties from the renderer class. I don't even know if this is how I should do it.
    So I would appreciate a lot your help about this subject.
    Thank you.
    Marcos

    Marcos_AntonioPS wrote:
    RaymondDeCampo wrote:
    I neglected to mention: do not forget to implement the methods in StateHolder to preserve the properties you added to your component.Hello, Raymond. Could you elaborate a little more on that? If you could give a short example, it would be helpful.
    MarcosNo problem. I have already found out how.
    Thank you very much, Raymond.
    Marcos

  • GetStyle() of JSF component before render

    Hey guys,
    I'm hoping this is an easy one, here goes...
    For one reason or another, I need to modify the CSS of certain components in a JSF page before it is rendered to the browser. The JSF pages are going to be laid out in Netbeans 6.0 (beta right now) using mostly Woodstock components and will have the 'style' attribute filled in for each component. However, like I said, I want to modify the CSS style value of some components prior to rendering.
    Looking through the Javadocs for Woodstock (javadocs are included with plugin) I see that many components do indeed give you access to this attribute ('style'), com.sun.webui.jsf.component.Field.getStyle() returns "CSS style(s) to be applied to the outermost HTML element when this component is rendered" for example.
    I figured this would be straight forward enough and attempted to retrieve the style using the prerender() method. Unfortunately, getStyle() returned null. After playing around with it for a while, it appears as though the components do not get these properties set (by the Netbeans attribute) until DURING the renderResponse phase. I say this because I tried setStyle() during prerender() and my changes were ignored. I then went back to Netbeans and removed my 'suggested style', now my setStyle() call during prerender() holds showing that somewhere in the renderResponse phase (after prerender()) the style is being set if one is given.
    Obviously making any changes after prerender() [like in afterRenderResponse()] will not cut it.
    To sum up:
    Even as late in the lifecycle as prerender(), the CSS style attribute of a Woodstock component is not yet set (getStyle() returns null and setStyle() ends up being overwritten). Any suggestions on how to modify the style?
    Thanks in advance (and I hope this is an applicable forum),
    Sean

    Solved:
    Once I wrapped my head around the problem I found a much more elegant solution.
    What I wanted to do was relatively position page fragments but was having trouble as the Netbeans IDE positions components within fragments absolutely. To make my page dynamic I was taking the style="position: absolute" attribute out of the <div> tag that was holding the <jsp:directive-include>. The components within the fragments were then being positioned absolutely on the resulting page, ending up strewn all over the place. This led me off on the tangent to reposition the components when the page was called (original post above).
    The weekend did me well I suppose. I came up with the bright idea to CHANGE the style attribute on the <div> tag rather than remove it. Making the <div> component "position: relative" passed its positioning down the the containing components and now my fragments are displayed correctly while being dynamically repositionable.
    Hope this helps anyone coming across the same problem.

  • Triggering a reRender of a JSF component from a Javascript function

    Hi
    I am using a javascript calendar component(JQuery +JCal) to allow the user to select a date for which they want to see events displayed for. When the user selects the date I was planning on outputting the events in a rich:dataTable or something similar.
    Is there anyway that I can trigger a reRender of the dataTable from the javascript, i.e. when someone selects a particular date I would like to trigger a reRender of the rich:dataTable.
    I know I can do it easily from another JSF component, e.g. if I had a commandLink I could set the reRender property to be the id of the dataTable. But I am wondering can I trigger the reRender of the dataTable from a Javascript function, i.e. can I submit an AJAX request
    Thanks

    If you are using the the Richfaces components then you should look at the a4j:jsFunction component, which is provided by Richfaces.
    Follow the following format using the a4j:jsFunction:
    <a4j:jsFunction name="functionName" reRender="targetCompoentId"/>So in the component that the event should be triggered...like the 'onclick' or 'onmouseover' or whatever the legal event is use the following format:
    onclick="functionName();"Richfaces renders the a4j:jsFunction as a javascript function. The a4j:jsFunction name attibute becomes the name of the javascript function; You just have to remember to add the "()" parenthesis to the end of the function name.
    You could technically call the function also inside a javascript that has page access to the javascript generated from the a4j:jsFunction component.
    Hope this helps!

  • Just extended my first jsf component. but in the right way?

    Hi all,
    After days of trial and error, i finally managed to code my own JSF component, extending existing infrastructure. Since things just suddenly fell in place during a brute force approach to make it work, i'd like to ask for opinions of seasoned JSF veterans whether this makes sense or there is a better way to do things.
    The objective was to be able to render a collection of items as a comma separated list. To this end, I took an existing data iterator UIComponent from richfaces, added a custom renderer -- again extending on richfaces, and hooked things up in 2 config files, as follows:
    CsvRenderer.java:
    import javax.faces.component.UIComponent;
    import javax.faces.context.FacesContext;
    import javax.faces.context.ResponseWriter;
    import org.ajax4jsf.component.UIDataAdaptor;
    import org.richfaces.renderkit.AbstractRowsRenderer;
    import org.richfaces.renderkit.TableHolder;
    /** Renders a richfaces UIDataList component as a comma separated list */
    public class CsvRenderer extends AbstractRowsRenderer {
         @Override
         public void encodeOneRow(FacesContext context, TableHolder holder)     throws IOException {
              UIDataAdaptor table = holder.getTable();
              ResponseWriter writer = context.getResponseWriter();
              renderChildren(context, table);
              if(holder.getRowCounter() < table.getRowCount() - 1) {
                   writer.write(", ");
         @Override
         protected Class<? extends UIComponent> getComponentClass() {
              return org.richfaces.component.UIDataList.class;
    added to faces-config.xml:
    <render-kit>
         <render-kit-id>HTML_BASIC</render-kit-id>
         <renderer>
              <component-family>org.richfaces.DataList</component-family>
              <renderer-type>ahui.CsvRenderer</renderer-type>
              <renderer-class>com.b2international.auctionhouse.jsf.ahui.CsvRenderer</renderer-class>
         </renderer>
    </render-kit>
    added to ahui.taglib.xml:
    <tag>
         <tag-name>csv</tag-name>
         <component>
              <component-type>org.richfaces.DataList</component-type>
              <renderer-type>ahui.CsvRenderer</renderer-type>
         </component>
    </tag>
    cheers,
    Greg

    Hi all,
    After days of trial and error, i finally managed to code my own JSF component, extending existing infrastructure. Since things just suddenly fell in place during a brute force approach to make it work, i'd like to ask for opinions of seasoned JSF veterans whether this makes sense or there is a better way to do things.
    The objective was to be able to render a collection of items as a comma separated list. To this end, I took an existing data iterator UIComponent from richfaces, added a custom renderer -- again extending on richfaces, and hooked things up in 2 config files, as follows:
    CsvRenderer.java:
    import javax.faces.component.UIComponent;
    import javax.faces.context.FacesContext;
    import javax.faces.context.ResponseWriter;
    import org.ajax4jsf.component.UIDataAdaptor;
    import org.richfaces.renderkit.AbstractRowsRenderer;
    import org.richfaces.renderkit.TableHolder;
    /** Renders a richfaces UIDataList component as a comma separated list */
    public class CsvRenderer extends AbstractRowsRenderer {
         @Override
         public void encodeOneRow(FacesContext context, TableHolder holder)     throws IOException {
              UIDataAdaptor table = holder.getTable();
              ResponseWriter writer = context.getResponseWriter();
              renderChildren(context, table);
              if(holder.getRowCounter() < table.getRowCount() - 1) {
                   writer.write(", ");
         @Override
         protected Class<? extends UIComponent> getComponentClass() {
              return org.richfaces.component.UIDataList.class;
    added to faces-config.xml:
    <render-kit>
         <render-kit-id>HTML_BASIC</render-kit-id>
         <renderer>
              <component-family>org.richfaces.DataList</component-family>
              <renderer-type>ahui.CsvRenderer</renderer-type>
              <renderer-class>com.b2international.auctionhouse.jsf.ahui.CsvRenderer</renderer-class>
         </renderer>
    </render-kit>
    added to ahui.taglib.xml:
    <tag>
         <tag-name>csv</tag-name>
         <component>
              <component-type>org.richfaces.DataList</component-type>
              <renderer-type>ahui.CsvRenderer</renderer-type>
         </component>
    </tag>
    cheers,
    Greg

  • Writing own jsf component

    Hello,
    I'm writing my own JSF components.
    I got a problem with a component of type: javax.faces.Command.
    My component works well in Creator and after being deployed excepts that in the page navigation tab, when I drag a link from my component to another page, Creator defines a new action ("casex" for instance) but DO NOT affect this action to my component at the JSP level (i.e. the attribute "action "is not set on my component).
    I have to do it myself for the navigation to work.
    I think I miss something during component generation. Any idea ?
    Tnxs for any help !
    -- F

    Hello Edwin,
    Thanks for your answer ! In the mean time I rebuilt
    my components on the blueprint basis from
    bpcatalog/ui according to your blog and everything
    works fine !
    Now I have a new problem/question:
    Is there a way to access the application's message
    bundles (for localization) during the rendering of a
    custom component ?
    I have a custom component that should access -
    through the rendering process (encodeBegin) - the
    application localization's bundle in which it is
    running to localize a message .
    I tried the following:
    encodeBegin(FacesContext f, UIComponent x) throws
    IOException
    /...Start of rendering process ../
    String
    tooltip=ResourceBundle.getBundle(FacesContext.getCurre
    ntInstance().getApplication().getMessageBundle(),
    FacesContext.getCurrentInstance().getExternalContext()
    .getRequestLocale()).getString(<key>);
    /..Rendering process continues ./}
    That does not work... (always returning an empty
    string)
    Thanks for any help !
    -- Fab
    There should be a way to do what you want, but it's not my area of expertise and I would need to do some debugging.
    -Edwin

  • How wrap Flash into JSF Component?

    I need to make Flash which will be wrapped by JSF component. Flash component will be placed on the page and it presents some data by the user request. Page will not be reloaded, all transfering will be between Flash and Server. What architectural solutions I may use?
    Well be thankfulness for any infomation about it.
    Edited by: JavaKirill on Dec 12, 2008 7:31 AM

    You normally represent a flash object using HTML <object> tag.
    JSF components normally just renders HTML.
    I don´t see how wrapping it in a JSF component would be impossible.

  • How to load a class dynamically (via reflection) in a jsf-component

    Hi all,
    I am writing my own jsf component and I would like to do it generically. Therefore I have an attribute, where the developer can pass a fully qualified classname, which I want to use to instantiate. But I have a Problem with the classloaders, everytime I get a ClassNotFound-Exception during debugging.
    Does anybody know how it is possible, to to get the most parent classloader?
    Currently I am even not able to load a class, which is in the same package like all other compontent-classes.
    Thank you very much in advance
    Thomas

    Within web applications, I believe it is recommended to use Thread.getContextClassLoader(). Keep in mind that web applications require different classloader semantics than regular Java applications. The class loader which gets resources from the WAR is favored over others, even when this violates the normal class loading conventions.

  • How can I include a javaScript files from within jsf component

    Is there any way using which I can include javascript files from my jsf component. Because otherwise I have to write all the javascript commands using writer.write which is very tedious rather than this I just want to include the javascript file which contains all the functions required. Also I want that this file should be included only once irrespective of the number of components included.
    Thanx in advance

    This doesn't depend on JSF. You need to include a script tag, like:
    <script src="/path/script.js"
    language="JavaScript" type="text/javascript"></script>
    If you want to include this only once, make a file included into every page, into which you can put other resources to be included along with this script.
    HTH,
    rs.

  • How to make Javascript access standard JSF component

    Hello all,
    I'm in need of a proper javascript code that access standard jsf component.
    Like we do for html tags;
    if( el.tagName.toLowerCase() != 'select')
    I need to do the same thing for a jsf tag i.e; <h:selectOneMenu>. How to make javascript access <h:selectOneMenu> like it does with <select> tag ? Please let me know asap. Extremely sorry if the question is kind of stupid....cause I'm a beginner for JSF environment.
    Any sort of help, suggestion or advice would highly be appreciated.
    Thanks in advance.

    Ummmm, I may be off the beaten path, but by the time your javascript is called the h:selectOneMenu would be a select tag within the dom. You should be able to reference that tag as you normally would.

  • Can i use one JSF component's value for other component in the same page.

    Can i use one JSF component's value for other component in the same page.
    For example
    I have a <h:selectBooleanCheckbox id="myChk"> in my jsf page, i want to access its value for another component like:
    <h:commandButton disabled="#{myChk.checked}" action="myAction" value="myValue" />
    ** "myChk.checked" >> I am just asuming "checked" property is available...

    Bind the checkbox to a UIInput myChk property. Then you can reference this property from the page, e.g.
    <h:selectBooleanCheckbox binding="#{myBean.myChk}" onchange="submit();" />
    <h:commandButton disabled="#{myBean.myChk.value}" action="myAction" value="myValue" />

  • Relative positioning of JSF component

    Hi,
    How can I place a JSF component relative to another component, say I want to place a table below another table whose number of rows may vary.
    Thanks,
    Bob

    Have two differnt tables or use frames and place the controls(tableand button in this case) in different frames.
    <table width="100%" height="350"> -outertable
    <table .................................................><tr> any number of rows. </tr>-inner table
    </table>- - close outer
    </tr </table> - close inner
    <table> -new table
    command button
    </table> - close new table

  • Tutorial on how to create an Ajax-enabled JSF component in Creator?

    Is there a tutorial on how to create (not use/import existing) an Ajax-enabled JSF component using Creator 2? I read somewhere that it was done during a presentation in 3 minutes! Now that I really want to see ;-
    thanks,
    -nikita

    As far as I remeber, Edwin Goei's examples are the
    closest thing to the info you are looking. He has an
    example component, but don't remember if they're
    AJAX enabled. Check it on
    http://wiki.java.net/bin/view/Javatools/CustomCompone
    tLibraries.
    Best regards
    Antonio.Thanks for the plug. I've been meaning to update that article. Writing an AJAX component is similar to writing other kinds of components but the developer uses AJAX techniques. The latest version of the popup calendar which is checked into the bpcatalog project of java.net uses Dojo which also has some support for AJAX. I haven't yet had time to update the article yet, unfortunately.
    -Edwin
    http://blogs.sun.com/edwingo/

  • Setting focus to a jsf component inside a tab.

    Hi,
    How can I set focus to a jsf component that is placed on some tab other then the first. Suppose that on the 2nd tabitem of the tab. there are some components on this tab . How can I set the focus to any one of these components on tabitem2 when the jsf page is opened.
    Any ideas..
    Thanks in advance..

    Use Javascript.var el = document.getElementById('elementId');
    if (el && el.focus) {
        el.focus();
    }

Maybe you are looking for

  • 2 mac user accounts, 2 itunes match accounts, 1 mac

    I have a mac that I share by two seperate logins. I was using itunes match fine in my login. My gf signed up for itunes match and associated under itunes with in her own login, totally seperate itunes libary etc. Now I had issus with match not workin

  • How to create materialized view based on a synonym

    Hi all, I am trying to create simple materialized view based on a synonym and that synonym is pointing a view in other database (using dblink). I am getting table or view not found error . I am able to select synonym if i use select but not in materi

  • How to read a whole file as a set of characters (including spaces)

    Hi, I'mt trying to read a file, and i want to save each character in the file including the space character. Is there a new line char as well? I'm using this at the moment because buffer reader loses my trailing spaces, but it's only taking the first

  • Photoshop cs5 is spiking ram use and lagging

    When I open Photoshop CS5 its sitting idle with nothing open and still using 330,000 MB of ram. After opening a simple file, fairly small, 40 MB. It jumps its ram use to almost 2 gigs. It then lags very badly when I try to save taking almost 10 min t

  • Oracle Sql Developer Installation

    Hi Guys, I will be using oracle sql developr at my place and currently installed it at my personal pc.I am very new to the Oracle Sql Developer. I am not able to connect to the Oracle sql Developer.I have Oracle 9i db and oracle forms 10G running and