Custom converter attributes

This may be a dumb question, but...
I have a custom converter with attributes. I've built the converter itself, but am not clear on how to hook it in as far as the attributes are concerned. Is there a .tld? How does one set it up?
Sorry if this is a dumb question.

Cancel this question. I figured it out from looking at the built-in converters.

Similar Messages

  • How to create a custom tag for a custom converter

    In Jdeveloper 11g, I have a project where I have created a custom converter class that impements the javax.faces.convert.Converter class. I have registered the converter with an id in the faces-config.xml file of the project, and the converter works fine by using the <f:converter type="myconverter"> tag. However, the custom converter has a field which I would like to set from the tag itself. Hence, I would like to add an attribute to <f:converter> tag if possible or create a custom tag that has the attribute.
    I have done some reserach and I found that a custom tag can be implemented: I need to create a class which extends from the ConverterTag class or javax.faces.webapp.ConverterElTag class, which I did, but I also need to create ".tld" (tag library) file which defines the tag itself.
    The part about creating the ".tld" file and registring the new tag is what I'm not sure how to do.
    Does someone know how to do this?
    thank you

    Hi frank,
    that's a good document, and it explains how to make a custom converter. I already created the custom converter, it converts a number to any currency pattern. I know java already has a currency converter, but it doesn't support Rupee currency format, and I need that format.
    My converter works, but I would like to pass the pattern of the format through an attribute in a tag. Since f:converter doesn't seem to support that, I created a custom tag which uses my converter, and it enables me to pass a pattern to the converter.
    All of that works, but I need to be able to pass the pattern as an EL expression, and it's not evaluating the expression before passing it to the converter. It just passes the whole expression as a string. I'm thinking It may be something I'm doing wrong.
    this is the tag library definition file:
    <!DOCTYPE taglib
    PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
    "http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">
    <taglib>
    <tlib-version>1.2</tlib-version>
    <jsp-version>2.1</jsp-version>
    <short-name>custom</short-name>
    <uri>custom-currency-converter</uri>
    <description>
    custom currency custom tag library
    </description>
    <tag>
    <name>CurrencyConverter</name>
    <tag-class>
    converter.Tag.CurrencyConverterTag
    </tag-class>
    <body-content>JSP</body-content>
    <attribute>
    <name>pattern</name>
    <type>java.util.String</type>
    <required>true</required>
    <rtexprvalue>true</rtexprvalue>
    </attribute>
    </tag>
    </taglib>
    Edited by: Abraham Ciokler on Feb 4, 2011 11:20 AM

  • H:selectManyCheckbox and custom converter

    Hi there
    Firstly, I am trying to implement a custom converter to capture choices a user makes on a check box(es), i.e. if they uncheck one or more boxes I want to use the converter to save this information. I have applied this logic previously for a selectOneMenu based on BalusC's tutorial (very good by the way): http://balusc.blogspot.com/2007/09/objects-in-hselectonemenu.html. So, my first question is... Is this the correct way of doing this?
    Assuming that it is, this is the code I have implemented:
    Faces-config.xml
    <converter>
    <converter-id>CheckBoxStatusConverter</converter-id>
    <converter-class>examples.user.CheckBoxStatusConverter</converter-class>
    </converter>jsp file
    <h:form>
    <body>
    <h1>A horizontal line of check boxes!</h1>
    <%-- value="#{standardCheckBoxBeanStatus.colours}" --%>
    <h:selectManyCheckbox id="HStandardcheckbox" value="#{standardCheckBoxBeanStatus.status}">
    <f:selectItems value="#{standardCheckBoxBeanStatus.colour}" />
    <f:converter binding="CheckBoxStatusConverter" converterId="checkboxstatus" />
    </h:selectManyCheckbox>
    </body>
    </h:form>standardCheckBoxBeanStatus
    public class standardCheckBoxBeanStatus
    private List<SelectItem> Colour = new ArrayList<SelectItem>();
    private CheckBoxStatusBean Colours = new CheckBoxStatusBean();
    private String[] CheckBoxStatus = new String[7];
    private static CheckBoxStatusDAO CheckBoxcoloursDAO = new CheckBoxStatusDAO();
    private String selectedColour;
    private dbBean db;
    public standardCheckBoxBeanStatus()
    fillCColourItems();
    db = new dbBean("username","password");
    public List<SelectItem> getColour()
    return Colour;
    public String[] getStatus()
    String[] b = new String[7];
    for (int i = 0; i < 7; i++)
    b[i] = Colour.get(i).getValue().toString();
    return b;
    public void setStatus(String[] state)
    System.out.println("Status could be set to ");
    for (int i = 0; i < state.length; i++)
    System.out.println(state);
    public void setColours(CheckBoxStatusBean t)
    System.out.println("setColours called with "+t);
    Colours = t;
    public String Action()
    System.out.println("Action called!");
    return "ValuesUpdated";
    private void fillCColourItems()
    int i = 0;
    for (CheckBoxStatusBean tK : CheckBoxcoloursDAO.list())
    System.out.println("Colour adding "+tK+", "+tK.getValue());
    Colour.add(new SelectItem(tK, tK.getValue()));
    CheckBoxStatus[i] = tK.getKey();
    i++;
    ChechBoxStatusConverter:public class CheckBoxStatusConverter implements Converter
    private static CheckBoxStatusDAO CheckBoxStatusDAO = new CheckBoxStatusDAO();
    public String getAsString(FacesContext f, UIComponent c, Object o)
    System.out.println("In converter getAsString method");
    String ret = "";
    if ((o != null) && (o instanceof CheckBoxStatusBean) )
    ret = ((CheckBoxStatusBean)o).getKey();
    return ret;
    public Object getAsObject(FacesContext f, UIComponent c, String s)
    System.out.println("In converter getAsObject method");
    return CheckBoxStatusDAO.find(s);
    CheckBoxStatusDAOpublic class CheckBoxStatusDAO
    private static ArrayList<SelectItem> checkBoxColours = new ArrayList<SelectItem>();
    private static Map<String, CheckBoxStatusBean> CheckBoxRecordsMap;
    private static dbBean db = new dbBean("tagcloud","tagcloud");
    static
    setupcheckBoxColours();
    loadKRecordsMap();
    public CheckBoxStatusDAO()
    public CheckBoxStatusDAO(ArrayList<SelectItem> t)
    this.checkBoxColours = t;
    public CheckBoxStatusBean find(String key)
    return CheckBoxRecordsMap.get(key);
    public List<CheckBoxStatusBean> list()
    return new ArrayList<CheckBoxStatusBean>(CheckBoxRecordsMap.values());
    public Map<String, CheckBoxStatusBean> map()
    return CheckBoxRecordsMap;
    private static void loadKRecordsMap()
    checkBoxColours = db.getAllColoursStatus();
    CheckBoxRecordsMap = new LinkedHashMap<String, CheckBoxStatusBean>();
    for (int i = 0; i < checkBoxColours.size(); i++)
    System.out.println("CheckBoxRecordsMap contains: "+checkBoxColours.get(i).getValue()+", "+checkBoxColours.get(i).getLabel());
    CheckBoxRecordsMap.put(String.valueOf(i), new CheckBoxStatusBean((String)checkBoxColours.get(i).getValue(), (String)checkBoxColours.get(i).getLabel()));
    System.out.println("Complete, RecordsMap is "+CheckBoxRecordsMap.size()+" in size");
    So I add the line: <f:converter binding="CheckBoxStatusConverter" converterId="checkboxstatus" /> to my jsp file I get the error mesage:{noformat}java.lang.IllegalArgumentException: Cannot convert CheckBoxStatusConverter of type class java.lang.String to interface javax.faces.convert.Converter{noformat}However, without that line I get a nice line of check boxes.
    Could you advise. I have been struggling on this all day. I am not even sure this is the correct approach any more?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    Obviously you bind the converter to a litteral string !!
    <f:selectItems value="#{standardCheckBoxBeanStatus.colour}" />
    <f:converter binding="CheckBoxStatusConverter" <!-- use an EL here not a simple string-->
    converterId="checkboxstatus" />
    </h:selectManyCheckbox>Are you sure that f:converter had a binding attribute ?

  • Adding custom converter to custom component ?

    Hi,
    I have created a custom component in JSF 1.1 that extends HtmlInputText.
    The component works as it should. My Problem is that when I apply one of my own custom converts to it, the converter is never invoked ?
    <ps:custInputText id="text1" validator="#{pc_Start.validateText1}">
    <f:attribute name="fieldReference" value="ref_text1" />
    <f:converter converterId="ps.trimAllSpaces" />
    </ps:custInputText>Does anyone know that's wrong ? Maybe it is not possible to to apply custom converters to custom components ?
    Thanks in advance.

    Try by adding value attribute to ur custom tag, it might work.

  • Is there a Simple Way to Reformat  Database Text with Custom Converter?

    When a database column contains a string, often the string may be stored in the database in a form that may not be suitable for viewing by the user. It is often interesting to show the user the string after it has been reformatted. Many things including phone numbers, product codes and various other application specific encodings fit into this category. The JSF Converter concept seems to be an ideal place to apply the reformatting via the application of a custom converter. In fact, many of the text books written on JSF refer to the JSF ability to support text reformatting using a custom converter. However, we have not been able to make it work in JSC2_1.
    For example, when a CachedRowSet Table Data Provider is used in a JSC2 application to show tabular data from a database, text columns from the database are automatically bound to StaticText components. Unfortunately, if the developer creates a custom converter and attaches it to the StaticText component, the converter is never called when the object to be converted is already of type String. If the object to be converted is a Date, CLOB or any other type the custom converter will be called - but not for type String. Thus the text is presented to the user directly as stored in the database witout the desired reformatting. The OutputText component on the other hand does appear to support custom converters but there is no possibility within the JSC2 IDE to substitute the OutputText component for the StaticText component in the CachedRowSet Table Data Provider.
    This situation appears to be inconsistent with the JSF specification. Does anyone know if this is a bug or a deliberate design decision or a misuse of the IDE on our part? Last question; has anyone come across a workaround?

    Try using "Examine Document" to remove the OCR output.
    Be well...

  • Rich Text Editor with Custom Text Attribute

    Hello All,
    We are using the latest version of Oracle Portal 10G. I have a need to create custom Attributes of the type text to let people enter a lot of text. But when User are in edit mode of an item where this custom attribute is used, the Rich Text Editor is not shown for entering the Text for the Custom Text Attribute. It shows a normal html text area. Has anyone ever used RTE with Custom Attribute?
    I request you guys for help.
    Thanks.

    The Problem with the Custom Attribute is not solved, but I have now compromised with the Situation and now I am not using a Custom attribute.
    Rather, Now I am creating a Custom Item Type using Base Text Type (earlier i wanted to create custom item type at my own without any base item type). In this case now I will not be able to change the Lable of the RTE (that is "Text", when the Custom Item is in Edit Mode), but I hope that my users can understand that much.
    I have created a template for portal pages. In the Template I can edit the Region Properties. When I edit the Region property of the region where I want to display my Custom Items. I get two Tabs on the top, Main and Attributes/Style. ON the main tab I can tell what type of region it should be, width etc, in my case it is item type region. And on the Attributes/Style tab, I can select from the availabe Attributes as which all Attributes I want to display. Here if i select only "Associated Functions" Attribute then normally portal should not render anything by default on the Page. It should rather make a call to the procedure which is associated with the Custom Item and as when I was creating the custom item type, I had clicked on "Display Procedure Results With Item", so portal should now display the result of my Procedure. So far it works without problem.
    But the problem is that the Portal displays the text at its own also. As i have written that Portal should not display anything at its own, this doesn't work in this version of Portal for a Custom Item Type that is made using Base Text Item Type. For all others it has worked till now (I have create 50s of Custom item types).
    You can better understand by going to the following URL. Just have a look between the two dotted lines (Dotted line is also a seperate Custom Item Type). Between the two Dotted Lines is a custom item, in general it would be a Custom News Item having title, image and so on.
    http://sunnode1.edvz.sbg.ac.at:7778/portal/page?_pageid=79,56047&_dad=portal&_schema=PORTAL
    I have really programmed a lot with portal but now at this stage where I am near to end, I am getting problems which are coming from Product. I request you for help.

  • Custom Dynamic Attributes

    Hello Experts:
    Does anyone knows if it is possible to create a Custom Dynamic Attribute for Bid Comparison where this custom Attribute can be automatically filled through a function module or program with some calculated value?
    My requirement is to provide an automatic supplier qualification which can be used as a comparison attribute, the qualification could be calculated using supplier information from previous POs, Confirmations, etc.
    Hope you can help me out
    Hugo

    Hi,
      Dynamic Attributes for Bid Invitation can be created using customization.
    SPRO-> SRM Server->Bid Invidation - > Dynamic Attributes.
    Generally the response to  the dynamic attributes are given by Bidder when submitting the Bid.
    For automaic population of response to the bidder do you want to do through report ?
    you can implement "BBP_DOC_CHANGE" BADI metod "BBP_QUOT_CHANGE" for pupulating the response of dynamic attribute while submitting BId.
    Regards
    Kalandi
    PS : Reward points if it helps you.

  • My Custom Converter Doesn't Work With DataModel

    Hi,
    I have this simple object with its custom converter taken from the Core JSF Book. It works fine, but when I put it in DataModel, somehow it didn't get updated. I don't put the whole codes here, only the important parts.
    Any1 knows what is the reason? I have been looking for an answer but I haven't found one. Plz help.
    public class CreditCard {
    private String number;
    public CreditCard(String number) { this.number = number; }
    public String toString() { return number; }
    public class CreditCardConverter implements Converter, Serializable {
    private String separator;
    public void setSeparator(String newValue) { separator = newValue; }
    public Object getAsObject(............);
    return new CreditCard(builder.toString());
    public String getAsString(..............)
    throws ConverterException {
    return result.toString();
    public class MyBackBean{
    private DataModel creditCardDataModel;
    private static final CreditCard[] ccs = {
    new CreditCard("1111 111 111 111"),
    new CreditCard("2222 222 222 222")
    public DataModel getCards(){
    if (creditCardDataModel == null) {
    creditCardDataModel = new ArrayDataModel(ccs);
    return creditCardDataModel;
    <h:dataTable value="#{myBackBean.cards}" var="card">
    <h:column>
    <h:inputText id="card" value="#{card}"/>
    </h:column>
    </h:dataTable>
    Edited by: JW77 on Dec 3, 2009 12:47 AM

    Please explain.
    What does "cellcom line doesn't work with my iPhone" mean?
    What are you trying?  What is happening?
    Where did you buy the iphone?
    Any info abnout your issue at all?

  • Custom tag attribute calculated by scriptlet expression

    Hi,
              If I set the rtexprvalue subelement of the attribute element in my tld to
              "true", should I be able to dynamically determine the value of my custom tag
              attribute using a scriptlet expression?
              When I include the custom tag reference:
              <prod:getCategory id="category"
              categoryID="<%=request.getParameter("catID")%>" scope="page"/>
              it actually gets written to the html as:
              <prod:getCategory id="category" categoryID="2133" scope="page"/>
              and is not recognized as a jsp tag.
              I am using weblogic 6.0 sp1.
              Thanks in advance!
              daniel
              

    I had the same problem in a design a couple of months ago and could not get around it so I switched the functionality into code and out of the tag lib.
    I take it you are trying to do something like this?
    <%
    String value="hiworld";
    %>
    <mytaglib:saysomething value="<%=value%>"/>

  • Custom tag attribute question

    How to assign value of expression or variable to custom tag attribute in jsp?

    I had the same problem in a design a couple of months ago and could not get around it so I switched the functionality into code and out of the tag lib.
    I take it you are trying to do something like this?
    <%
    String value="hiworld";
    %>
    <mytaglib:saysomething value="<%=value%>"/>

  • Custom converter for selectManyCheckbox

    I am having the following problem/general question regarding custom converter and a selectManyCheckbox tag:
    The value property of the selectManyCheckbox tag is referring to a List of Transfer Objects (TO). For this example it is a UserRoleTo, which consists of role id and role description. A List of the SelectItems is used to generate a complete list of roles. Now, I want to convert selected role id�s to UserRoleTOs, and vice versa, but it does not seem to work. What should be the Object returned by getAsObject method: UserRoleTO or SelectItem?
    I would appreciate help and an example.

    This article might provide an interesting read: [http://balusc.blogspot.com/2007/09/objects-in-hselectonemenu.html]

  • Display custom hosts attributes in Internal Identity Store

    Any one know how to Display custom attributes to the Internal Identity Store
    I have created several attributes, but can't seem to find anyway to add them to the display window.
    Cheers

    They are displayed by default and there's no actual way to hide them.
    Are you sure that you didn't create a customer HOST attribute and are looking in the internal user table or vice-versa ? Host and users have different custom attributes page. That's the only explanation I See

  • Customer-specific attributes (properties) for processes?

    Hello community,
    I already know how to define customer-specific attributes (properties) for documents stored in Solution Manager using the Document Modelling Workbench. For documents, everything works fine, so far.
    But: I also want to define customer-specific properties for processes. Is this possible? If yes, how do I do that? I cannot find any related configuration options -- neither in SPRO nor in Solution Manager's own project configuration area.
    Thanks in advance,
    Thomas

    Hi,
    In SPRO, naviagete to SAP Solution Manager Implementation Guide -> SAP Solution Manager -> Scenario-Specific Settings -> Implementation/Upgrade -> Blueprint and Configuration -> Object Attributes -> Definition of Customer Attributes for Object Types
    Best regards,
    Jacques.

  • Updating custom boolean attribute in Active Directory via OIM

    The adapters delivered with the AD connector support updating standard attributes (string) and multi-value attributes, but I can't seem to figure out how to update a custom Boolean attribute in AD via OIM. The delivered Boolean fields all appear to have custom adapters (ie Account Locked, Password Never Expires, etc.)
    I've tried using the delievered adpADCSCHANGEATTRIBUTE adapter, but it fails (as expected) with:
    +com.thortech.xl.integration.ActiveDirectory.tcUtilADTasks : updateDetails : Attributes cannot update:[LDAP: error code 21 - 00000057: LdapErr: DSID-0C090B73, comment: Error in attribute conversion operation, data 0, v1772 ]+
    Suggestions?

    No I don't have custom boolean attributes in AD. But I added custom attributes of other types.
    When you say custom, do you mean it did not come with the out of the box AD connector, but exists in the Active Directory of your organization?
    There are a few attributes in AD which look like they are boolean when you see the AD console but are actually different. Look at the link for details.
    [http://support.microsoft.com/kb/305144]
    Look at this post for context.
    AD Provisioning - Password never expires & User must chg pwd at next logon
    Thanks,
    M

  • Custom UME attribute with pre-defined values

    All,
    Is it possible to define a custom UME attribute which will have pre-defined values so that it appears as dropdown select when the admin creates a user?
    Your help is appreciated.
    Thanks

    Hi Aakash,
    I am not a software developer so I cannot really give you details. I can point you to our documentation: [SAP NetWeaver Developer's Guide|http://help.sap.com/saphelp_nw70ehp1/helpdata/en/8b/0b674240449c60e10000000a1550b0/frameset.htm]
    This guide should point you in the right direction. The UME has a public API with which you access the attributes in question programmatically. What you do from there depends what you as a programmer want to do.
    -Michael

Maybe you are looking for

  • Graphics card memory  NVIDIA GeForce 8600M GT with 512MB vs. 256MB

    how much difference will i see between the NVIDIA GeForce 8600M GT with 512MB of GDDR3 memory, and the NVIDIA GeForce 8600M GT with 256MB of GDDR3 memory?? i will be doing HD editing on FCP. any input is appreciated!! e

  • Getting all mail from a gmail account

    I am trying to download all my old emails from an gmail account via thunderbird. The main reason is for backup. The problem is that each time I push on GET MESSAGES it only downloads a few mails. I need to wait till it ends and then click again and s

  • How do you access application solution folder without hardcoding?

    Working in C# in Visual Community 2013, coding for Desktop only. In WinForms and WFP, you can open a stream to write to a file without any directory (Streamwriter ("test.txt")) and the file would get saved in the directory the executable is in, gener

  • How to find cost element group linked to account number

    Hi all, I have following scenario. I have account number and i want to find out it's cost element group. In t-code KAH3 when i enter cost element group i get all the account number in that group. But the problem is that i have account number and i wa

  • Why did my max loose wifi and bluetooth?

    Not sure if it was after last update or when.  But my phone lost wifi and bluetooth.  I didnt even realize until I got a data alert. I have tried a full reset witch made me very unhappy due to the apps I lost.