Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Custom Converter - Java Studio Creator  RSS feed

 
Jeremy Tauriello
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to create and use a Customer Data Converter in Java Studio Creator to convert an Unsigned BigInteger to String and back. I created a package (.jar) with the class listed below. From what I have read I need to register the converter in the faces-config file. How do I go about this in Java Studio Creator and then what steps do I take to bind the converter to say an outputBox?

package com.webenable.jsf.converters;

import java.math.BigInteger;
import javax.faces.convert.Converter;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;

class BigIntConverter implements Converter {

public Object getAsObject(FacesContext context,UIComponent component, String value) {
BigInteger bigInt = new BigInteger(value);
return bigInt;
}

public String getAsString(FacesContext context, UIComponent component, Object value) {
BigInteger bigInt = (BigInteger) value;
return bigInt.toString();
}

}
 
Varun Khanna
Ranch Hand
Posts: 1400
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Using a custom converter

P.S. You can use a custom converter with an outputText in same way as you will use a standard converter.
 
Jeremy Tauriello
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for your response. I am however still un-clear on how to address this from within Java Studio Creator. The only faces-config files that I can locate are in the distibuted .jar files. I am having trouble either locating the correct faces-config.xml file on my PC or from with the Java Studio Creator IDE. Should I be able to access the faces-config.xml file from within the IDE ( I was expecting to be able to see it along with the navigation.xml file )? Otherwise where should the file be located in relation to the the other configuration files?
[ May 23, 2005: Message edited by: Jeremy Tauriello ]
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!