Converter-for-class

Is converter-for-class or any other "-for-class" attributes required to match against subclasses of the specified class, or just the class itself?
It you specify converter-for-class as Object, is the converter required to apply to every subclass of Object (i.e. every class), or just to those properties with a runtime value of exactly Object?
Thanks.

Hello BalusC,
thanks for reply. I'm definitely use JSF RI 1.2_13.
The problem is, that the converter-method public String getAsString( FacesContext p_ctx, UIComponent p_comp, Object p_value ) is never called.
But the other method public Object getAsObject( FacesContext p_ctx, UIComponent p_comp, String p_value ) is called.
BalusC, which JSF implementation do you use?
regards, Joerg

Similar Messages

  • Use of converter-for-class

    Hello,
    I start to use Jdev11 TP4.
    I have written my own converter which performs "trims" on character fields. This converter works fine when I apply it to the adf input texts which are present on my jspx pages.
    But I would like to apply this converter on all "adf input text" fields.
    To do this I have added the following lines in my faces-config.xml files :
    <converter>
    <description>Trim the fields</description>
    <display-name>FieldTrimer</display-name>
    <converter-for-class>oracle.adf.view.rich.component.rich.input.RichInputText</converter-for-class>
    <converter-class>lu.ehl.lp.converter.MyFieldTrimer</converter-class>
    </converter>
    The tag <converter-for-class> is always underlined in "red" saying that Reference to oracle.adf.view.rich.component.rich.input.RichInputText is not found.
    And the input fields on my jspx pages are not trimed...
    Could somebody help me to solve this problem ?

    Hi,
    please send me a testcase. Put the testcase in a zip and rename the zip to unzip. my mail address is in my profile
    Frank

  • Converter Element - converter-for-class

    I assume a converter can be registered statically on a UI-Component, e.g. one can only remove the converter using java methods. In JSP code, one then does not have to add the converter each time.
    Again, the attribute and property elements confuse me. Can anyone explain the difference`?

    If you have not explicity registered a converter for a component, but you have declared a value binding expression for the "value" attribute, JavaServer Faces can examine the data type of your model data property and determine if it has a by-class converter that knows how to handle that data type. This is why, for example, you can simply point at an int property with your "value" attribute, and not have to specify an explicit converter.
    If you have explicitly specified a converter, or you did not use a value binding expression for the "value" attribute (so JavaServer Faces does not know what the model data type is), then no by-class converter is searched for.
    Craig McClanahan
    1

  • Custom converter for h:selectManyCheckbox, no getAsObject call

    Hello.
    I have a strange problem with my PersonConverter. This converter should convert object of type Person. Implementatin of these classes is not important. So I defined it to faces-config.xml:
    <converter>
      <converter-for-class>x.y.Person</converter-for-class>
      <converter-class>x.y.PersonConverter</converter-class>
    </converter>In my jsp page I have:
    <!-- List<Person> Bean.getSelectedPersons() -->
    <h:selectManyCheckbox id="xyz" value="#{bean.selectedPersons}">
      <!-- List<SelectItem> Bean.getPersons() -->
      <!-- SelectItem oneItem = new SelectItem(person, person[i].getName()) -->
    <f:selectItems value="#{products.persons}"/>
    <h:message for="xyz"/>
    </h:selectManyCheckbox>
    When I access this page I get requested result, eg. checkboxes with names. There are printlns in  getAsString() and getAsObject() so I see that getAsString() was called. However when I submit page I cannot see call to getAsObject() (eg. the println) and on page I get:Conversion Error setting value 'Thomas' for '#{bean.selectedPersons}'. (Assuming that I checked checkbox with label 'Thomas', If I don't check anything, there is '').
    What am I doing wrong please?
    I also tried giving the converter id and adding <f:converter id="personConverterId"/> between h:selectManyCheckbox tags, but it was same.
    Thank you.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    Thanks for your support.
    I found that #{bean.selectedPersons} evaluated to Set so I added selectedPersonsList property which just creates ArrayList from Set. This is pretty stupid, I'm sorry. Next time I'll look twice before posting.
    By the way, thanks for tutorials on your blog. It helped me a lot with understanding JSF.

  • Cannot convert type class java.lang.String to class oracle.jbo.domain.Clob

    Cannot convert type class java.lang.String to class oracle.jbo.domain.ClobDomain.
    Using ADF Business Components I have a JSFF page fragment with an ADF form based on a table with has a column of type CLOB. The data is retrieved from the database and displayed correctly but when any field is changed and submitted the above error occurs. I have just used the drag and drop technique to create the ADF form with a submit button, am I missing a step?
    I am using the production release of Jdeveloper11G

    Reproduced and filed bug# 7487124
    The workaround is to add a custom converter class to your ViewController project like this
    package oow2008.view;
    import javax.faces.application.FacesMessage;
    import javax.faces.component.UIComponent;
    import javax.faces.context.FacesContext;
    import javax.faces.convert.Converter;
    import javax.faces.convert.ConverterException;
    import oracle.jbo.domain.ClobDomain;
    import oracle.jbo.domain.DataCreationException;
    public class ClobConverter implements Converter {
         public Object getAsObject(FacesContext facesContext,
                                   UIComponent uIComponent,
                                   String string) {
           try {
             return string != null ? new ClobDomain(string) : null;
           } catch (DataCreationException dce) {
             dce.setAppendCodes(false);
             FacesMessage fm =
               new FacesMessage(FacesMessage.SEVERITY_ERROR,
                                "Invalid Clob Value",
                                dce.getMessage());
             throw new ConverterException(fm);
         public String getAsString(FacesContext facesContext,
                                   UIComponent uIComponent,
                                   Object object) {
           return object != null ?
                  object.toString() :
                  null;
    }then to register the converter in faces-config.xml like this
    <faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee">
      <application>
        <default-render-kit-id>oracle.adf.rich</default-render-kit-id>
      </application>
      <converter>
        <converter-id>clobConverter</converter-id>
        <converter-class>oow2008.view.ClobConverter</converter-class>
      </converter>
    </faces-config>then reference this converter in the field for the ClobDomain value like this
              <af:inputText value="#{bindings.Description.inputValue}"
                            label="#{bindings.Description.hints.label}"
                            required="#{bindings.Description.hints.mandatory}"
                            columns="40"
                            maximumLength="#{bindings.Description.hints.precision}"
                            shortDesc="#{bindings.Description.hints.tooltip}"
                            wrap="soft" rows="10">
                <f:validator binding="#{bindings.Description.validator}"/>
                <f:converter converterId="clobConverter"/>
              </af:inputText>

  • Thiz iz Urgent..........How to convert a .class file to a .java file

    Hi Everybody,
    I want to convert back a .class file (a compiled servlet) into .java (source code) file. How do I do it???
    Note using javap has not been of any help.
    Thanks in Advance
    Rajib

    Why don't you look at this thread:
    http://forums.java.sun.com/thread.jsp?forum=31&thread=143500
    If thats not enough, try searching all the forums for:
    "convert .java .class" That'll give yu a bunch of other threads...
    Sjur

  • How to convert java class file version without decompiling

    Hi,
    Oracle R12.1.3 i am having illegal access error while try to access the class file version Java 1.3 uses major version 47,So how to convert the class file version without using decompiling.
    Current java version is 1.6.0_07
    Is there any tool or API for converting class file version?
    Thanks,
    Selvapandian T

    Beside this I wonder where you get your error from since AFAIK 12c comes with java 1.6.
    Well wonder no more!
    OP isn't using Oracle 12c database.
    They are using Oracle R12.1.3 - which is the E- Business Suite.

  • How to convert a .class file?!!

    sorry guys,
    but I've a question in knowing the code of some file,
    I've zipped file, when I unzip it, it contains an html page with a .class files
    (passing parameters to applet)
    my problem is that I want to know the code of the .java file (which is not included)
    but the program is working well, coz I have the .class file,
    so, can I convert this .class file into a java file, so its java code could be readable (to understand it)
    thanks in Advance :)

    sorry man, but Can't u send me a specific link for downloading this "Java decomplier"
    coz I found my self in something called (jad decompiler) with lots of versions and this is confusing
    and Is that mean, that there's a decompiler which can convert the .class file into .java one?
    and thanks alot man.....u help me always!
    (I'm still begginner in java)

  • How to convert a class file to exe file and how to cteate a class file to d

    how to convert a class file to exe file

    Hi Bhaskarq,
    Hi,
    It is not at all possible.
    But it is a really worst method.
    Please go through it.
    This is a very common question asked in the comp.lang.java newsgroup. Its often useful to have an
    executable application when deploying your
    applications to a specific platform, but remember to
    make your .class files available for users running
    Unix/Macintosh/other platforms.
    Microsoft provide a free system development kit (SDK),
    for Java, which includes the jexegen tool. This
    will convert class files into a .EXE form. The only
    disadvantage is that users need a Microsoft Java
    Virtual Machine (JVM) installed. If your target
    platform is Win32, you can either redistribute the
    virtual
    machine, or raise the level of your system
    requirements, to include Windows 98, or Windows 95
    with
    Internet Explorer 4. Systems matching these
    requirements will already have a copy of the Microsoft
    Java Virtual Machine installed.
    Note : You must specify all of the class files your
    application needs (except for standard java packges)
    as a parameter, so if you have third party libraries,
    you'll need to include them as well. You can use wildcards * though, and you don't need the original source code.
    Also please see this Forum which will give a good idea
    http://forum.java.sun.com/thread.jsp?forum=31&thread=149733
    I hope this will help you.
    Thanks
    Bakrudeen
    Technical Support Engineer
    Sun MicroSystems Inc, India

  • Converting a class file to a dll

    Hai please help me..
    I am trying to convert my .class file to a .dll file.
    This is my java code:
    public class DateFunctions {
         public int getTimeInSeconds(int i){
              return i;
         public int addNumbers(int i, int j) {
              return (i+j);
         public static void main(String[] args) {
              DateFunctions df=new DateFunctions();
              df.getTimeInSeconds(
    Created class file DateFunctions.class.
    Created jar DateFunctions.jar using:
    jar cvf DateFunctions.jar DateFunctions.class
    Generated dll file using bimp tool like this (Visual J# .NET tool):
    jbimp DateFunctions.jar /t:library
    I got the file: DateFunctions.dll
    Now loaded this dll into my code (say, TSL code in WinRunner) using load_dll("DateFunctions.dll");
    When I try to access the method like:
    j=getTimeInSeconds(int i);
    I am getting the error RPC error.
    Note: DLL is loading fine. but while accessing the functions I am getting the RPC error..
    What could be the reason..?
    Please help...?
    Thanks,
    Satish

    Your answer lies in the documentation for WinRunner and whatever else is calling the DLL.
    Certainly Java JNI has requirements for DLLs called from Java: They have to be C++ bindings that use the native header that Java generates, right?
    So now you need to look at the requirements for your WinRunner and make sure that the program translating your .class file to a DLL does it in a such a way that the bindings WinRunner expects are indeed there.
    But none of that has anything to do with Java. If your Java class compiles and tests successfully, then your questions about Java are satisfied. You have to figure out what WinRunner needs and what's missing from what you supplied.
    %

  • Error: could not be converted to [class java.lang.Class].

    I am newbie to JDeveloper (10.1.2) on winxp and i was trying to setup the example from the following url http://radio.weblogs.com/0129487/2003/09/19.html
    It is a how to on "Executing Toplink Queries using JavaBean DataControl "
    Any help would be greatly appreciated.
    Near the bottom on step "In StrutsPageFlow diagram, select allEmpsDA Data Action, right mouse and chooe Run" i get a the following runtime errors:
    Validation Error
    You must correct the following error(s) before proceeding:
    JBO-29000: Unexpected exception caught: oracle.jbo.JboException, msg=JBO-29000: Unexpected exception caught: oracle.toplink.exceptions.ConversionException, msg= Exception Description: The object [mypackage.Employees], of class [class java.lang.String], could not be converted to [class java.lang.Class]. Please ensure that the class [class java.lang.Class] is on the CLASSPATH. You may need to use alternate API passing in the appropriate class loader as required, or setting it on the default ConversionManager Internal Exception: java.lang.ClassNotFoundException: mypackage.Employees
    JBO-29000: Unexpected exception caught: oracle.toplink.exceptions.ConversionException, msg= Exception Description: The object [mypackage.Employees], of class [class java.lang.String], could not be converted to [class java.lang.Class]. Please ensure that the class [class java.lang.Class] is on the CLASSPATH. You may need to use alternate API passing in the appropriate class loader as required, or setting it on the default ConversionManager Internal Exception: java.lang.ClassNotFoundException: mypackage.Employees
    Exception Description: The object [mypackage.Employees], of class [class java.lang.String], could not be converted to [class java.lang.Class]. Please ensure that the class [class java.lang.Class] is on the CLASSPATH. You may need to use alternate API passing in the appropriate class loader as required, or setting it on the default ConversionManager Internal Exception: java.lang.ClassNotFoundException: mypackage.Employees

    This error is happening on a read.
    Here is the mapping descriptor:
    <database-mapping>
    <attribute-name>SuppItemCollection</attribute-name>
    <read-only>false</read-only>
    <reference-class>package.SuppItem</reference-class>
    <is-private-owned>false</is-private-owned>
    <uses-batch-reading>false</uses-batch-reading>
    <indirection-policy>
    <mapping-indirection-policy>
    <type>oracle.toplink.internal.indirection.NoIndirectionPolicy</type>
    </mapping-indirection-policy>
    </indirection-policy>
    <container-policy>
    <mapping-container-policy>
    <container-class>java.util.Vector</container-class>
    <type>oracle.toplink.internal.queryframework.ListContainerPolicy</type>
    </mapping-container-policy>
    </container-policy>
    <source-key-fields>
    <field>SUPP.REQ_NUM</field>
    </source-key-fields>
    <target-foreign-key-fields>
    <field>SUPP_ITEM.REQ_NUM</field>
    </target-foreign-key-fields>
    <type>oracle.toplink.mappings.OneToManyMapping</type>
    </database-mapping>
    Object model has a Supp class that has a collection of SuppItem(s). I was allowing the Mapping Workbench to create the Java Source. I'm not to fond of that, but I thought it would be easiest to get things going.
    The datamodel is similiar to the class model.
    Thanks for the help,
    Mike

  • I need a simple Converter for a selectBooleanCheckbox.

    Hi,
    Can someone tell me how to build a simple converter to go from a selectBooleanCheckbox value to a String and back.
    I save a String ("Y" or "N") in my table but the checkbox returns a boolean. I need a Converter to do the conversion from TRUE to "Y" and FALSE to "N". Should be easy to do but as of now, mine won't even execute properly.
    I get a
    javax.servlet.ServletException: javax.servlet.jsp.JspException: Can't instantiate class: 'ca.sshrc.web.common.converters.BooleanConverterYn'.
    I don't understand how getAsObject and getAsString work I guess.
    Thanks

    Hi,
    Has anyone been able to make the converter for "<h:selectBooleanCheckBox>" work??
    seems like the converter method itself is not getting invoked.
    this is what i am trying to do..
    Code in jsp is
    <h:selectBooleanCheckbox id="testCheckBox" value="#{myBean.testCheckBox}" >
         <f:converter converterId="booleanConverter" />     
    </h:selectBooleanCheckbox>entry in faces-config is
    <converter>          
           <converter-id>booleanConverter</converter-id>                  <converter-class>package.MyBooleanConverter</converter-class>
      </converter>class MyBooleanConverter looks like this at the moment
    public class MyBooleanConverter implements Converter {
         public Object getAsObject(FacesContext context, UIComponent component, String value) {
              myBooleanClass myBoolean = new myBooleanClass(value);
              return myBoolean;
         public String getAsString(FacesContext context, UIComponent component, Object value) {
              return value.toString();
    }     Have kept myBooleanClass as a simple wrapper for the Boolean class.
    Same is working for string and integer but not in this case..
    Am i going wrong somewhere... kindly help

  • What is the wrong about converting the .class of api of jc to .cap files?

    hi everyone
    l tried to convert the .class filses of api to .cap files,there are some wrongs please help me!
    ___the .opt file:___
    -out JCA CAP EXP
    -exportpath D:\jCDK2_2_1\api_export_files
    -classdir D:\workspace\framework
    framework
    0x0a:0x0:0x0:0x0:0x62:0x1:0x01 1.2
    converter result:
    c:documents and settings\administrator>converter -config d:\workspace\framework\framework.opt
    java card 2.2.1 class files converter ,version 1.3
    copyright 2003 sun microsystems,inc.all rights reserved.use is subject to license terms
    error:javacard.framework.JCSystem:unsupported method modifier native in method isTransient.
    error:javacard.framework.JCSystem:unsupported method modifier native in method makeTransientBooleanArray.
    error:javacard.framework.JCSystem:unsupported method modifier native in method makeTransientByteArray
    error:javacard.framework.JCSystem:unsupported method modifier native in method makeTransientShortArray
    conversion completed with 13 errors and 0 warnings.
    thanks in advance

    Hi,
    I am not sure why you are trying to convert the API packages into CAP files. The JAR files that ship with the JCDK are only stub implementations for compiling against. They do not have an actual implementation. You will find methods returning a short always return 0 etc. You should only need to convert your code into CAP files. You will just need to reference the .exp files that are included in the JCDK for the API so your code can be converted.
    Cheers,
    Shane

  • Strange problem when tried to convert HelloWorld.class..

    Hi friends..
    i've downloaded the Java Card SDK 2.2.1, and i tried to compile HelloWorld application that shipped with its distribution..
    i found strange problem when i tried to convert HelloWorld.class into .CAP, etc.. :(
    I use Windows XP, assume that i've set the Environment Variables needed
    i've compiled the HelloWorld.java into HelloWorld.class..
    the package of of HelloWorld is : com.sun.javacard.samples.HelloWorld;
    and i use this config file :
    -out EXP JCA CAP
    -exportpath .
    -applet  0xa0:0x0:0x0:0x0:0x62:0x3:0x1:0xc:0x1:0x1 com.sun.javacard.samples.HelloWorld.HelloWorld
    com.sun.javacard.samples.HelloWorld
    0xa0:0x0:0x0:0x0:0x62:0x3:0x1:0xc:0x1 1.0and then i tried to run converter script in the Console :
    *C:\java_card_kit-2_2_1\samples>converter -config com\sun\javacard\samples\HelloWorld\HelloWorld.opt*
    *error: file com\sun\javacard\samples\HelloWorld\HelloWorld.opt could not be found*
    Usage:  converter  <options>  package_name  package_aid  major_version.minor_ve
    sion
    OR
    converter -config <filename>
                        use file for all options and parameters to converter
    Where options include:
            -classdir <the root directory of the class hierarchy>
                          set the root directory where the Converter
                          will look for classes
            -i            support the 32-bit integer type
            -exportpath  <list of directories>
                          list the root directories where the Converter
                          will look for export files
            -exportmap    use the token mapping from the pre-defined export
                          file of the package being converted. The converter
                          will look for the export file in the exportpath
            -applet <AID class_name>
                          set the applet AID and the class that defines the
                          install method for the applet
            -d <the root directory for output>
            -out  [CAP] [EXP] [JCA]
                          tell the Converter to output the CAP file,
                          and/or the JCA file, and/or the export file
            -V, -version  print the Converter version string
            -v, -verbose  enable verbose output
            -help         print out this message
            -nowarn       instruct the Converter to not report warning messages
            -mask         indicate this package is for mask, so restrictions on
                          native methods are relaxed
            -debug        enable generation of debugging information
            -nobanner     suppress all standard output messages
            -noverify     turn off verification. Verification is defaultPlease help me regarding this, because i'm new in this field..
    Thanks in advance..

    Thanks safarmer for your reply..
    i tried this :
    C:\java_card_kit-2_2_1\samples>javac -target 1.3 -source 1.1 -g -classpath .\cla
    sses;..\lib\api.jar;..\lib\installer.jar src\com\sun\javacard\samples\HelloWorld
    \*.java
    javac: invalid source release: 1.1
    Usage: javac <options> <source files>
    use -help for a list of possible options
    C:\java_card_kit-2_2_1\samples>javac -target 1.3 -source 1.2 -g -classpath .\cla
    sses;..\lib\api.jar;..\lib\installer.jar src\com\sun\javacard\samples\HelloWorld
    \*.java
    it seems that i can't specify the -source to 1.1, so i tried to use -source 1.2..
    after that, i tried to convert again, and i got this error :
    C:\java_card_kit-2_2_1\samples\src>converter -config com\sun\javacard\samples\He
    lloWorld\HelloWorld.opt
    Java Card 2.2.1 Class File Converter, Version 1.3
    Copyright 2003 Sun Microsystems, Inc. All rights reserved. Use is subject to lic
    ense terms.
    error: com.sun.javacard.samples.HelloWorld.HelloWorld: unsupported class file fo
    rmat of version 47.0.
    conversion completed with 1 errors and 0 warnings.Please help me regarding this..
    Thanks in advance..

  • SelectOneMenu: Error finding converter for component

    I keep getting an error in my selectOneMenues saying
    "Error finding converter for component myselectone".
    The SelectOne elements contains both key and value as String.
    The value that is to be set in my bean is also a String.
    Why do I need a converter here and what is that converter supposed to be??
    Beacause of this, the selectOneMenu want post.

    Is the value which is bound to the selectOneMenu reachable?
    Try logging the getter-method of the bound value. When you bind the value to a nested bean, the bean might have not been initialized.
    I had the same problem with something like this
    I had a Person class with a nested person-attribute object.
    I bound the value of the selectOneMenu to one of the attributes of the nested person-attribute object, without instantiating the object first in the faces-config. After instantiating not only the person class as a managed bean but also the nested person-attribute object, all was well.

Maybe you are looking for