JSF Converter how to use property in faces-config

I have made an Converter for my listbox, and it is working.
Now I want to use a property to change the behavior of the converter.
My faces-config looks like this:
<!-- Converters -->     
<converter>
<converter-for class>model.PacemakerBranche</converter-for-class>
     <converter-class>cconverter.BrancheConverter</converter-class>
     <property>
          <property-name>test</property-name>
          <property-class>java.lang.String</property-class>
          <default-value>12345</default-value>
     </property>
</converter>
I try to set the test property to 12345.
The setTest(String test) is not set.
What am I doing wrong??
My converter looks like this:
public class BrancheConverter implements Converter {
private String test;
public String getTest() {
System.out.println("getTest " + test);
return test;
public void setTest(String test) {
System.out.println("setTest " + test);
this.test = test;
public Object getAsObject(FacesContext ctx, UIComponent component,
String value) {
return getMgr(ctx).getObject(model.PacemakerBranche.class, new Long(value));
public String getAsString(FacesContext ctx, UIComponent component,
Object object) {
return ((BaseObject) object).getId().toString();
private Manager getMgr(FacesContext ctx) throws HibernateException {
return (Manager) FacesContextUtils.getWebApplicationContext(ctx).getBean("manager");
}

You can't use f:converter tag for setting properties.
There are two ways you can use:
(1) use f:attribute tag
ex.<h:inputText value="#{...}"/>
  <f:converter converterId="...."/>
  <f:attribute name="test" value="#{...}"/>
</h:inputText>Note that you should get the value of the attribute from the UIInput component, something like:comp.getAttributes.get("test");(2) develop a custom converter tag.

Similar Messages

  • How to use requestScope in faces-config.xml file?

    a managed-bean need get value from request as its property
    so i configure the manged-bean as below:(use requestScope object)
    <managed-bean>
    <description>this is for item test bean.</description>
    <managed-bean-name> item </managed-bean-name>
    <managed-bean-class> test.Item </managed-bean-class>
    <managed-bean-scope> request </managed-bean-scope>
    <managed-property>
    <property-name>id</property-name>
    <value-ref>requestScope.id</value-ref>
    </managed-property>
    </managed-bean>
    but it didnot work.
    after i restart tomcat with above configure file, it report
    HTTP Status 404 error.
    and seemed that the context donot start...
    if i change the line
    <value-ref>requestScope.id</value-ref>
    to:
    <value>7</value>
    then everything will be OK...but this isnot fit my require.
    any body can help me?
    I use JSF 1.0 beta.

    Rather than starting a new thread, I thought I'd just add on to this one, since it already lays the grounds for my question. I'm using the
    I noticed that my setId() method is being called once during the ApplyRequestValuesPhase, and then again in the UpdateModelValuesPhase. The first time, it sets the ID to null, despite the fact that I'm posting an id to the page. When it comes around the second time, it sets the id properly, and the data is loaded from the database and everything works great. If I'm not posting anything to the page, it is only hit once and the value is null.
    Normally I wouldn't fuss over such small things like this, but there's a bit of a probelm. I have a few buttons which are rendered based on this id. If the id is zero (i.e. null or empty string is passed into the setId() method), I want the add button to appear, else I want the update/delete/cancel buttons to appear. If any of these buttons are false after the ApplyRequestValuesPhase, the button's action will not be executed. In other words, when I'm editing an entry and I press the update button the life cycle goes a little like this...
    Object constructed
    ApplyRequestValuesPhase calls setId(null),add button to be rendered, update/delete/cancel to not be rendered
    // the call to save() is not queued up! (save() is the method associated with the action of my update button)
    UpdateModelValuesPhase calls setId("34"), data loaded from database, add button is not to be rendered, update/delete/cancel are to be rendered
    Since save() is never called, it renders the data loaded from the database, and the update/delete/cancel buttons are shown. So, from the user's perspective... nothing happened other than a page refresh. A.k.a. the update button is broken!
    I can, of course, choose to not update the boolean flags which determine if the buttons are rendered or not when setId() is called with a null. Since the default is to render everything (which was a decision specifically to avoid the buttons not being rendered in the early stages of the JSF life cycle, and the action not being executed). That works when I post an id to the page because it's called a second time and the correct buttons are rendered. The problem is when no parameters are given... it isn't called a second time, so it renders all buttons when I only want it to render the add button.
    So how can I get the values to post during the ApplyRequestValuesPhase? I thought that would be how it would work, but apparently not. Anyone know why it explicitly sets the id to null the first time aroud?
    Here's all you should need...
        <managed-bean>
            <managed-bean-name>dropdownEntry</managed-bean-name>
            <managed-bean-class>org.dc949.bugTrack.DropdownEntry</managed-bean-class>
            <managed-bean-scope>request</managed-bean-scope>
            <managed-property>
                <property-name>id</property-name>
                <value>#{param.id}</value>
            </managed-property>
        </managed-bean>
        public void setId(String id) {
            try {
                this.id = Long.parseLong(id);
                load();  // loads data from DB
            } catch(Exception e) {
                if(id != null && !id.equals(""))
                    log.warn("Unable to convert id from String to long ("+id+")", e);
            if(id != null) {  // this was my solution while I was frusterated that my save method wasn't being called
                if(this.getIdAsLong() == 0) {
                    this.showAdd = true;
                    this.showUpdate = false;
                    this.showDelete = false;
                } else {
                    this.showAdd = false;
                    this.showUpdate = true;
                    this.showDelete = true;
                        <t:div>
                            <h:commandButton id="add" value="Add dropdown entry"
                                             rendered="#{dropdownEntry.showAddButton}"
                                             action="#{dropdownEntry.save}" />
                            <h:commandButton id="update" value="Update dropdown entry"
                                             rendered="#{dropdownEntry.showUpdateButton}"
                                             action="#{dropdownEntry.save}" />
                            <h:commandButton id="delete" value="Delete dropdown entry"
                                             rendered="#{dropdownEntry.showDeleteButton}"
                                             action="#{dropdownEntry.deleteDropdownEntry}" />
                            <h:commandButton id="cancel" value="Cancel"
                                             rendered="#{dropdownEntry.showUpdateButton}"
                                             action="#{dropdownEntry.reset}" immediate="true" />
                        </t:div>I could, and probably will get rid of the showDeleteButton flag and isShowDeleteButton() method and make it like the cancel button since these update/delete/cancel will always be shown/hidden together.
    Edit: Now I feel like a fool. A little clean and build, and it's working perfectly. If any one of the above people read this, I thank you for your help from years past. <img class="emoticon" src="images/emoticons/happy.gif" border="0" alt="" />
    Edited by: AdamNichols on Apr 18, 2008 9:57 PM

  • How to use property file - sql query define in property file

    Hi All,
    Anybody please tell me how to use property file.
    I have placed sql query in propery file and I have to access this in my file.
    well so far this is my code but don't know how to implement in the following ...
    pstmt = con.prepareStatement("select * from registration where username=?");
    instead of writting the query I want to use the property file.
    so far I have developed the following code...
    FileInputStream fis = new FileInputStream("querysql.property");
    Properties dbProp = new Properties();
    dbProp.load(fis);is the code correct... or is there another way to access property file
    Please help.
    please reply soon....
    Thanks

    Before answering, check if it's already been done here http://www.jguru.com/forums/view.jsp?EID=1304182

  • How to use the same services-config for the local and remote servers.

    My flex project works fine using the below but when I upload my flash file to the server I doesn't work, all the relative paths and files are the same execpt the remote one is a linux server.
    <?xml version="1.0" encoding="UTF-8"?>
    <services-config>
        <services>
            <service id="amfphp-flashremoting-service"
                class="flex.messaging.services.RemotingService"
                messageTypes="flex.messaging.messages.RemotingMessage">
                <destination id="amfphp">
                    <channels>
                        <channel ref="my-amfphp"/>
                    </channels>
                    <properties>
                        <source>*</source>
                    </properties>
                </destination>
            </service>
        </services>
        <channels>
        <channel-definition id="my-amfphp" class="mx.messaging.channels.AMFChannel">
            <endpoint uri="http://localhost/domainn.org/amfphp/gateway.php" class="flex.messaging.endpoints.AMFEndpoint"/>
        </channel-definition>
        </channels>
    </services-config>
    I think the problem  is the line
            <endpoint uri="http://localhost/domainn.org/amfphp/gateway.php" class="flex.messaging.endpoints.AMFEndpoint"/>
    but I'm not sure how to use the same services-config for the local and remote servers.

    paul.williams wrote:
    You are confusing "served from a web-server" with "compiled on a web-server". Served from a web-server means you are downloading a file from the web-server, it does not necessarily mean that the files has been generated / compiled on the server.
    The server.name and server.port tokens are replaced at runtime (ie. on the client when the swf has been downloaded and is running) not compile time (ie. while mxmlc / ant / wet-tier compiler is running). You do not need to compile on the server to take advantage of this.
    Hi Paul,
    In Flex, there is feature that lets developer to put all service-config.xml file configuration information into swf file. with
    -services=path/to/services-config.xml
    IF
    services-config.xml
    have tokens in it and user have not specified additional
    -context-root
    and this swf file is not served from web-app-server (like tomcat for example) than it will not work,
    Flash player have no possible way to replace token values of service-config.xml file durring runtime if that service-config.xml file have been baked into swf file during compilation,
    for example during development you can launch your swf file from your browser with file// protocol and still be able to access blazeDS services if
    -services=path/to/services-config.xml
    have been specified durring compilation.
    I dont know any better way to exmplain this, but in summary there is two places that you can tell swf  about service confogiration,
    1) pass -services=path/to/services-config.xml  parameter to compiler this way you tell swf file up front about all that good stuff,
    or 2) you put that file on the webserver( in this case, yes you should have replacement tokens in that file) and they will be repaced at runtime .

  • When To Use redirect/ In faces-config.xml

    In what situations should I use <redirect/> in faces-config. I understand what that using it causes it to generate a HTTP redirect instead of redirection through the view handler.
    I have ran into situations where if I don't use redirect, evein in a request scoped bean data isn't completely cleared out of a form. IE I have a list of users with a list of their addresses. If I look at an address on user 1 I see the right details, if I then move to user2 and look at one of his addresses it reflects the information from user1. As soon as I add <redirect/> the problem disappears.

    You normally use it to fire a brand new request.
    If I look at an address on user 1 I see the right details, if I then move to user2 and look at one of his addresses it reflects the information from user1. As soon as I add <redirect/> the problem disappears.This rather sounds like faulty code logic. Debug it.

  • How to use Property Editor from an Add-In?

    Hi,
    I am writing a WYSIWYG add-in for JDev that allows users to put some object into a JPanel instance.
    Thess object has properties such as left, right, width, height, etc.
    - Question: how to use JDev's property editor to allow users change properties of thess object?
    - Another word: how to user JDev's Property Editor API from an add-in?
    I looked at the document. It does not give me enough information about Property Editor.
    Thanks in advance,
    Trung

    Hello Prasad,
    You are on the right avenue - launch an external application which can connect to running Outlook instance and then close it. After this you can launch Outlook anew. Here are the steps required to get the job done:
    1. Use the Marshal.GetActiveObject method which obtains
    a running instance of the specified object from the running object table (ROT) - Outlook in your case, for example:
    // Check whether there is an Outlook process running.
    if (Process.GetProcessesByName("OUTLOOK").Count() > 0)
    // If so, use the GetActiveObject method to obtain the process and cast it to an Application object.
    application = Marshal.GetActiveObject("Outlook.Application") as Outlook.Application;
    then use the
    Quit method to close the running instance. The
    associated Outlook session will be closed completely; the user will be logged out of the messaging system and any changes to items not already saved will be discarded.
    2.  Use the
    Start method of the System.Diagnostics.Process class to start Outlook anew.

  • How to use Property nodes?

    Hi everyone,
                           I am a beginner of LabVIEW. So I want to know about Property Node in detail. Please Please someone help me know the function of each property node......
    Thank You in Advance,
    Solved!
    Go to Solution.

    Achuthaperumal wrote:
    I am a beginner of LabVIEW. So I want to know about Property Node in detail.
    Property node allows you to programmatically read/write that particular property of associated object. For example, say you have a String Control, and you want to modify its 'Display Style'... for that you need to create and use that particular property node (of the String control).
    Check the attached example.
    I am not allergic to Kudos, in fact I love Kudos.
     Make your LabVIEW experience more CONVENIENT.
    Attachments:
    Example - Using Property Node [LV 2009].vi ‏11 KB

  • How to use property sheets in jsp? ( Property | Value )

    i want guidance regarding using property sheets. like a table.

    i want guidance regarding using property sheets. like a table.

  • Can I use morethen one faces-config.xml

    HI,
    now I am learning jsf, I have a doubt that ,can I use more than on faces-config.xml in one application ? and can we cahange name of faces-config.xml to faces-config-first.xml, and faces-config-second.xml? if it is possible , what should i do?
    Thank&Regards
    satya..

    Why would you want multiple config files? Is it for organization only...
    How would your app. know the when to use a different config file?
    Thanks,
    --Todd                                                                                                                                                                                                                                                                                                                       

  • Setting a converter property from faces-config.xml

    According to web-facesconfig_1_1.dtd you could assign a value to a converter
    property, e.g.:
    <converter>
    <converter-id>date_time</converter-id>
    <converter-class>javax.faces.convert.DateTimeConverter</converter-class>
    <property>
    <property-name>pattern</property-name>
    <property-class>java.lang.String</property-class>
    <default-value>dd.MM.yyyy hh:mm:ss</default-value>
    </property>
    </converter>
    This simply isn't implemented, and I haven't found it reported anywhere!
    I'm really surprised! I even look at the source code of the RI and it seems
    that the property tags are parsed by the xml digester, but then are ignored when adding the converter to the application!
    Any one has a clue?

    Today I downloaded tomahawk-examples-1.1.5-bin. (http://myfaces.apache.org/download.html). They have one example with tiles, and it works the way I want it to.
    I'm still trying to figure it out what is causing this behaviour.
    At least, I tried to change the value they're using for linkage between <to-view-id> and tiles definition, and found that JSF is still ignoring the real value in <to-view-id>
    : it was originally 'blah.jsp', but 'blah' or 'blah.tiles' worked the same way, while in tiles definition the corresponding name was always blah.tiles.
    It seems that they are looking into tiles definitions first with the key composed of the first part of the value in <to-view-id> (before the dot) concatenated with hardcoded '.faces'.
    I tried to change the key value in both config files to something like 'blah.ttt', and it did not work.
    I'm not sure at the moment if this would be a problem for me, I may use this framework, knowing the limitations.
    Also, I'll look into the code, if this may be altered and at what cost.
    Still, the basic jsf problem with always interpreting the value in <to-view-id> as blah.jsp remains.

  • How to use property of dimension to filter the 2nd dimension in Allocation?

    Hi experts,
    How do we use a property of one dimension to filter out the members of another dimension in allocation script engine?
    eg of two dimensions
    1.)Entity dimension - (entity dimension)
      memberset:                                        Channeltype (property)
                       Stores
                        Store1                           Boutique
                        Store2                           Kiosk
                        Store3                           Branch
                        Store4                           Concession
                        Store5                           Franchise
                      Nonstore
    2.)business Channel dimension - (user define)
       memberset:
                   Channeltype   
                       Boutique
                       Kiosk
                       Branch
                       Concession
                       Franchise
                       Nochannel
    in allocation code
    *runallocation
    *factor
    *dim entity                          what=Nonstore;                where=bas(Stores)
    *dim businesschannel        what=nochannel;             where= ? ;
    *endallocation
    The thing is that when the engine selected store 2 for entity it should select kiosk as its businesschannel.
    Please advise.
    Thanks as always,
    yajepe

    Hi,
    In this case, I believe, you should have the allocation within a for loop. But you should note that the performance might reduce.
    *FOR %VAR% = BAS(STORES)
       *RUNALLOCATION
       *FACTOR
       *DIM ENTITY WHAT = NONSTORE; WHERE = %VAR%
       *DIM BUSINESSCHANNEL WHAT = NOCHANNEL; WHERE = %VAR%.CHANNELTYPE
       *ENDALLOCATION
    *NEXT
    Hope this helps.

  • How to Use Property Loader to Load All Step Limits of SubSequence

    I have a MainSequence which have 7 Sequence Call Steps,and these Steps all have several Numeric Limit Test(LabVIEW Adapter),Now I want Creat a property Loader Step in the Setup Table of MainSequence to load all the SubSequences' Steps Limits.But I do not know how to realize it?Who Can help me,Thank you!

    It wasn't your english I just misread the question. I found this link that might help answer your question.
    http://forums.ni.com/ni/board/message?board.id=330&message.id=13163&requireLogin=False
    Hope it helps.
    Using LabVIEW 2010SP1 and TestStand 4.5

  • How to use property object with dequeue

    I tried to do following steps in Labview7.1 and Teststand3.1:
    - Create a named Queue in Teststand
    - Get the named Queue reference in Labview (GetQueue)
    - Enqueue an property of type NI_BatchControllerRequest into the Queue in Teststand
    - Dequeue the element in Labview by using a Fileglobal of type NI_BatchControllerRequest as destination property object
    At the first Enqueue, the object is correctly dequeued and stored in the Fileglobal. But at the next enqueue, I get the error -17300 (Exception occured in TSSync, Unable to set a top-level property object to another object) at the dequeue operation.
    When I use flat datatypes like string or bool, there are no errors, also at multiple enqueue operations.
    Can anyone help?

    LVFan -
    I did not realize that you are using the SyncManager low level API. The low-level API has a few restrictions that the step type does more work to hide from the user.
    If you look at the dequeue API function it takes an input parameter which is the destination object. Internally the dequeue operation uses the SetPropertyObject method to do the assignment. This method requires that the object that you assign a value to has a parent so that the engine can go to the parent, delete the child, and add the new child in its place. Even if the destination property object that you supplied had a parent, your reference to the "destination" would not be the new object because your reference is pointing to the old property a
    nd not the new one. You would be required to go to the parent and ask for the child again.
    A simple change to make this work for you is to use a reference object as the destination and then use GetValInterface on it to get the element from the queue. I have updated your VI to illustrate this.
    Scott Richardson (NI)
    Scott Richardson
    National Instruments
    Attachments:
    Queue.vi ‏93 KB

  • Create declaritive jsf components : how to use a model ?

    Hi,
    I'd like to create a component, like it is described in this how to : [http://www.oracle.com/technology/products/jdev/tips/fnimphius/declarative_comp_adf/declarative_component_adf.html|http://www.oracle.com/technology/products/jdev/tips/fnimphius/declarative_comp_adf/declarative_component_adf.html], and the screencast from Shay Schmeltzer.
    What we need is only one attribute, that is a Model. A model in the meaning of the TableModel in JavaSwing or CollectionModel, TreeModel with ADF. My question is : is there a class that my java class Model should extend, or implement, so that attributes of this class are usable in the jsf page that encapsulate the component. In mean, even with getters and setters, attribute are not usable in the jsf with any EL. Maybe I am going the wrong way here.
    So to sum up : a jsf declarative component that takes a Model as parameters, and from this model, the component builds itself. Is it even possible ? How ?
    Many thanks.
    regards
    Fred-

    Hi,
    why don't you define an attribute of type CollectionModel on the declarative component. You can then access this attribute from a managed bean in your declarative component (make sue its in backingBeanScope) to work with it. Note that the collection model is passed to the component to read data fromit. It is not a way to share data between your component and the JSF page
    Frank

  • How to use property Upgrade Code in detection method "Windows Installer"?

    Hi
    I am a packaging specialists helping our deployment guys to add our software (100rds of installers) as application entries in SCCM 2012. The methods supplied by SCCM seem however quite generic and limited.
    The detection method "Windows Installer" is hardcoded to use the Product Code, why?
    Normal detection of Windows Installer packages are done using the Upgrade Code and the Product Version. Is it possible for us our self to add/reconfigure to use that method or are we forced to use the custom detection method?(both those methods should be provided
    by SCCM to better match Windows Installer architecture)
    Ps. It says in http://technet.microsoft.com/en-us/library/bb632336.aspx for Version that "This
    must be in the standard Windows Installer four-part version number format.", but the version number is 255.255.65535 (which is real stupid) as described by http://msdn.microsoft.com/en-us/library/aa370859(v=vs.85).aspx. Ds.
    Regards
    Pär

    Under LV 7.1 with DSC installed I get the same error code (-2147418113) but "explain error" gives me this.
    "LabVIEW DSC:  (Hex 0x8000FFFF) Catastrophic failure."
    This prompts the question is it possible to set an activeX object running in a container for Full Screen.
    This is probably a Q for MS.
    If it look like it is possible, try to get a VB example and that will tell us what we have to do to make this work.
    Ben
    Message Edited by Ben on 10-31-2005 04:45 PM
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

Maybe you are looking for

  • Error In BPC IC Elimination Package-Version 7.5

    Hi , We upgraded our Dev BPC system rom version 7 to version 7.5. Now we are facing an error when running IC Elimination packge.Please find the error message as below "RUN_LOGIC:No account is available for inter-company elimination. Failed Applicatio

  • ORA:01658 Unable to create initial extent error

    Gurus, While importing a .dmp file I am getting following error IMP-00003 : Oracle error 1658 encountered ORA-01658: Unable to create INTIAL EXTENT for segment in tablespace INDX IMP-000017: following statement failed with ORacle error 1658: " CREATE

  • Solaris 8 install on ultra 10

    I'm trying to do a custom install. Towards the ends of the process (i.e. after CD 2 of 2 & Supplement CD have been used) I get a banner about Enterprise 10000 & then a prompt for info about the speed of my CPU. The info requested includes: 1. what is

  • Error in HCM Performance Management

    What does this error mean? --- Column "Object Setting" was defined without a function There is no help text available

  • Create a WDS with Airport Extreme and Belkin Pre-N

    I would like to setup a WDS using my Airport Extreme Base as the main router and a Belkin Wireless Pre-N (F5D8230-4) as a remote client. I have done this successfully using Linksys WRT54G and WRT54GS routers (using Sveasoft's firmware upgrade which h