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
Similar Messages
-
How to create a help view for a customized error message
Hi all,
Can you guide me how to create a help view for a customized error message, we need to put some suggestions in it so that user can can resolve this issue with this guide. ( the short text is too short to describe all situations via TC:SE91)
Thanks very much!
Bruce, WenHi Bruce,
Could you brief your concerns again.
Why don't you maintain long text in message class for long description.
Regards,
Ranjith N -
How to create a user class for the customer realm
how can I create a User class for my custom security realm, please help me out. i am trying to access using the active directory server and iam unable to write a simple classs for this user, can anyone help me. iam a beginner, would appriciate if any one helps me.regardsbaba
Hi Rawat,
You Don't need to create User Exits,but you need to find user Exits.Below are list of user Exits for MB31.
Use proper exit as per your requirement.
Exit Name Description
MBCF0002 Customer function exit: Segment text in material doc. item
MBCF0005 Material document item for goods receipt/issue slip
MBCF0006 Customer function for WBS element
MBCF0007 Customer function exit: Updating a reservation
MBCF0009 Filling the storage location field
MBCF0010 Customer exit: Create reservation BAPI_RESERVATION_CREATE1
MBCF0011 Read from RESB and RKPF for print list in MB26
MB_CF001 Customer Function Exit in the Case of Updating a Mat. Doc.
award points if ans is useful.
Regards,
Albert -
How to create a authority group for our customer table(se54)?
Hi,everyone:
I found a problem when I create a authority group for my customer table,I can't write the creation
to a request no(can't assign to a package),I want to know whether the authority group I created can be
transport to the PRD when I realse the request no.
Thanks!!!Auth Group is nothing but a table entry so for sure it can be transported to any environment, before Assigning any Auth group create one in SE54 when you try saving it it would ask you the TR number which you can transport to PROD.
-
How to create a sales order for Onetime customer with Tax code?
Hi everyone,
Can I use sd_salesdocument_create for a one-time customer? From the standard bapi, which field can I use for the Tax Code ?
pOints will be given.I have the same problem... should I use a different function module on this? if yes, what is it?
I need to create a sales order for one onetime customer with tax code... help me pls.... -
Is it possible and how to create bright preview mode for a custom Proof Setup
You know how there is Proof Setup preview modes under the View menu. Can I create a custom preview mode so that when I choose it and press Ctrl + y it shows the image very bright without changing it.
I need this because I want to see and edit more details in the dark areas which I may not be seeing on my monitor or room lighting conditions and thus to create images with more rich and dynamic shading in the darks so when viewed on brighter monitors or when levels are eventually changed the darks reveal nice shading instead of flat black.
I'm looking for per image solution that doesn't affect other images or applications like using global gamma.
I'll greatly appreciate your helpThat's what I use Adjustment layers but they are a big pain because the color picker can't disregard them. So every time I want ot use the color picker I have to hide the adjustment layer and then when I paint I have to enable it again. I want a color picker that picks from all but not the adjustment layer. This makes this workflow impossible. I need this for painting artworks from scratch.
There are no two equal monitors out there and some are quite off, so I want to create artworks that look as good as possible on all kinds of monitor including miscalabrated ones.These are samples to sell artwork. Not only that but the artwork often is edited from other designers not by brush repainting but using global adjustments like levels. And I don't want to use 32 bit workflows. What I'm asking will serve the purpose perfectly.
I feel that since PS pulls the preview information from profiles that probably reside in files somewhere, I can modify a copy of a profile and I was hoping if someone here knows more details about this and helps.
Thanks anyway -
How to create/configure an OVS for a custom BO?
I have created a new BO with three elements (ID, Name, FilterCriteria).
For this BO I created a Query (QueryByElements):
- Selection: ID, Name, FilterCriteria
- Basic Find: ID, Name
- Result: ID, Name, Filtercriteria
After this I created an OVS for this BO.
In DataModel Tab I bound the Items Node of the OVS to the Query Node of the BO, OVS:ObjectID -> Query:ID, OVS:ObjectName -> Query:Name and OVS:FilterCriteria -> Query:FilterCriteria.
Next i created a structure in the OVS with the data fields: ID, Name, FilterCriteria and SerchText.
In the Controller Tab I bound the ValueHelpQuery of the OVS to the (new) Query of the BO with this parameters:
- ID : /Root/Structure/ID
- Name : /Root/Structure/Name
- SearchText : /Root/Structure/SearchText
- FilterCriteria : /Root/Structure/FilterCriteria
Inport:
- ID : /Root/Structure/ID
- Name : /Root/Structure/Name
- SearchText : /Root/Structure/SearchText
- FilterCriteria : /Root/Structure/FilterCriteria
- + standard parameters like ParentComponent...
Outport:
- ObjectId : /Root/Items/ObjectId
- ObjectName : /Root/Items/ObjectName
With this configuration I get a correct value suggestion when I am typing in the field, and when i select a value from the drop down list the value is transferred to the field.
But, if I open the screen:
- the search is not working, I always see all values.
- if I select a row, the value is not transferred to the field. the field is empty.
I tried it without the FilterCriteria in the parameters and inport, but id shown the same behavior...
Do you have any idea to solve this problem?
Thanks,
Eduardsuddenly the transfer of the selected value from OVS UI to the fiels is working... I didn't change anything.
But the search in the OVS UI is still not working. Has someone any ideas how to fix it? -
How to use custom tags for integrating FCK Editor?
Hi All,
I am looking for the integrating the FCK Editor in my jsp page. any one can please provide the procedure of How to create fckeditor in jsp?
I have the jar file of fck editor but i am confusing while creating the custom tag for that editor.
I want like this:
<FCKeditor:fck ?> like this
Regards,
Sateeshgoogle answers it all..
[http://www.jroller.com/coreteam/entry/using_fckeditor_in_jsp_web]
[http://java.fckeditor.net/properties.html]
[http://java.fckeditor.net/java-core/tagreference.html] -
How to allow create different transaction type for different customer
We are using CRM 7.0 now. We have two types customer, one is sap customer, the other is potential customer. We want to distinguish the two types customer. And user can create all transaction (for example: quotation, opportunity, activity) the sap customer. And the user only can create activity for the potential customer, they can't create others transaction type for potential customer. How can we realize it? Thanks.
Hi,
We can make use of the BLOCKING REASONS to realize your requirement.
A Blocking Reason can be assigned to the Business Partner role dependent data and to the transaction type. A Business partner can be used in a transaction only if he is not assigned to this blocking reason.
For Ex, In your scenario you can create a Blocking reason 'Not a SAP Customer ' and assign it to all the Potential Customers. You should assign the blocking reason to all the transaction types which the potential customers should not be allowed.
Hope it helps. Please let me know if you need further help.
Regards,
Vamsi.
Edited by: Vamsi Krishna Potta on Sep 7, 2010 9:41 AM -
Hi All,
How to create a Platinum,Gold and Silver Customer and how to set different price for a single material based on customer?
Assume Material is Pen.
While creating Sales Order in VA01 how to bring different price for the same material for Platinum,Gold and Silver Customers.
Kindly help me out.
Thanks,
Renjith JoseA good place to start is http://www.javaworld.com/javaworld/javatips/jw-javatip34.html
Also, do a search in this forum on HttpURLConnection. That class allows you to use POST method to send form data to a web server.
"Hidden" variables are only hidden in HTML. The HTTP that gets POSTed to the web server doesn't distinguish between hidden and not hidden. That is, the content you would write to the HttpURLConnection.getOutputStream() would be something like:
hidden=1&submit=ok(Of course, the variable names would depend on what the web server was expecting from the form.)
Also, be sure to set the Content-Type request parameter to "application/x-www-form-urlencoded" -
Hello folks,
I am looking for best practices advice when (1) creating
custom components and (2) styling and skinning.
I already know how to skin a component part of the Flex
framework. I can make a class extending ProgrammaticSkin and have
my component skinned using CSS to link the component with the
reference to my custom class.
However what about those cases when you are completely
creating a component from scratch?
Imagine a "Freehand Drawing Canvas" component that allows the
user to draw on it and has some buttons to set color styles, line
styles, etc., or imagine a "Screen Flow Gallery" component that
displays visual objects in a fashion similar to Cover Flow in the
Mac.
In many components I am aware you may reuse other components
part of the Flex framework but I am trying to picture an scenario
where you would need to draw everything yourself because there just
isn't something to base it upon so you will end up drawing it from
scratch.
To learn how instead of building one of those components I
mentioned previously I decided to start with something simple that
would illustrate this like a LiteButton component that will behave
just like the Flex mx.controls.Button but will extend UIComponent
and be completely custom drawn.
The component will have a default look and will also be
style-able and skin-able. I will provide styles for users of the
component to modify and regarding skinning anyone can create a
custom ProgrammaticSkin adding its own drawing logic and link it to
the component via CSS with the ClassReference applied to the skin
selector.
So far so good and it's clear what I want to achieve. I
actually know how to do most of the stuff here but I have one
single problem.
Here is my question, where should I put my custom drawing
logic? If I do it in the updateDisplayList inside the class
extending UIComponent it works, however I thought that it would be
a better practice to do it using programmatic skins, that way I
could provide different skin themes for my component set.
The problem is that I can't make the programmatic work in
this scenario. I tried instantiating the custom programmatic skin
during the updateDisplayList of the LiteButton component and adding
it to my display object via addChild but that didn't do anything. I
also tried creating a "default.css" stylesheet and tried to use
ClassReference as I would normally do to skin an already existing
component (or composite component as well) but that didn't do
anything either.
So how do I apply programmatic skins for completely custom
drawn components of my Flex library project?
I could do it inside the updateDisplayList of the LiteButton
class extending UIComponent but again I would like to provide
different theme sets for my components so it makes sense using
programmatic skins."jbucaran" <[email protected]> wrote in
message
news:[email protected]...
> Hello folks,
>
> I am looking for best practices advice when (1) creating
custom components
> and
> (2) styling and skinning.
>
> I already know how to skin a component part of the Flex
framework. I can
> make
> a class extending ProgrammaticSkin and have my component
skinned using CSS
> to
> link the component with the reference to my custom
class.
>
> However what about those cases when you are completely
creating a
> component
> from scratch?
>
> Imagine a "Freehand Drawing Canvas" component that
allows the user to draw
> on
> it and has some buttons to set color styles, line
styles, etc., or imagine
> a
> "Screen Flow Gallery" component that displays visual
objects in a fashion
> similar to Cover Flow in the Mac.
>
> In many components I am aware you may reuse other
components part of the
> Flex
> framework but I am trying to picture an scenario where
you would need to
> draw
> everything yourself because there just isn't something
to base it upon so
> you
> will end up drawing it from scratch.
This may help with that
http://livedocs.adobe.com/flex/3/html/help.html?content=skinstyle_3.html
> To learn how instead of building one of those components
I mentioned
> previously I decided to start with something simple that
would illustrate
> this
> like a LiteButton component that will behave just like
the Flex
> mx.controls.Button but will extend UIComponent and be
completely custom
> drawn.
>
> The component will have a default look and will also be
style-able and
> skin-able. I will provide styles for users of the
component to modify and
> regarding skinning anyone can create a custom
ProgrammaticSkin adding its
> own
> drawing logic and link it to the component via CSS with
the ClassReference
> applied to the skin selector.
>
> So far so good and it's clear what I want to achieve.
Actually after
> playing
> with the weekend and today I know how to do most of the
stuff but I have
> one
> single problem. So here is my question, where should I
provide my custom
> drawing logic? If I do it in the updateDisplayList
inside the class
> extending
> UIComponent it works, however I thought that it would be
a better practice
> to
> do it using programmatic skins, that way I could provide
different skin
> themes
> for my component set.
These aren't mutually exclusive. When you provide a skin with
a
TypeSelector, you have to add it to the display list
somewhere, and this is
typically done in updateDisplayList or addChildren. I prefer
to do it in
updateDisplayList, because you can then change it if the
style changes.
> The problem is that I can't make the programmatic work
in this scenario. I
> tried instantiating the custom programmatic skin during
the
> updateDisplayList
> of the LiteButton component and adding it to my display
object via
> addChild but
> that didn't do anything.
Exactly what did you do?
> I also tried creating a "default.css" stylesheet and
> tried to use ClassReference as I would normally do to
skin an already
> existing
> component (or composite component as well) but that
didn't do anything
> either.
I've never had any problem using an approach similar to
this...but I will
say that I couldn't see any advantage in creating a
default.css style sheet,
since it's not really default in the way that the one that
comes with Flex
is. It's much more obvious to anyone using your component
what's going on
there if you create a style sheet where they're likely to
spot it.
> So how do I apply programmatic skins with the default
look for custom
> drawn
> components?
It seems like your approach is fine, but maybe you've made a
mistake in your
implementation.
> I could do it inside the updateDisplayList of the
LiteButton class
> extending
> UIComponent but again I would like to provide different
theme sets for my
> components so it makes sense using programmatic skins.
You might want to consider also adding an instance of
HaloBorder to your
component. That brings a lot of functionality with it.
HTH;
Amy -
How to create a new tag in page properties in the sidekick of geometrrix page
how to create a new tag in page properties in the sidekick of geometrrix pagesame as basic, advanced, blue print??
Hi prachi,
Is it tag OR Tab ? Seems like you are looking for Tab. Look at [1] & overlay to custamize per your need. Or define at your page component.
[1] /libs/foundation/components/page/dialog/items/tabs/items
Thanks,
Sham -
HOW TO CREATE A USER-EXIT FOR MB31 GOODS RECEIPT
Hy,
<b>HOW TO CREATE A USER-EXIT FOR MB31</b>
TO COMPARE ORDER QTY CONFIRMED AND GOODS RECEIPT QTY
( IF GR QTY GREATER THAN CONFIRMED QTY ERROR MESSAGE SHOULD COME AND NOT ALLOW TRANSCATION TO PROCEED).
POINTS CONFIRMED.
REGARDS,
KARTIKEY.Hi Rawat,
You Don't need to create User Exits,but you need to find user Exits.Below are list of user Exits for MB31.
Use proper exit as per your requirement.
Exit Name Description
MBCF0002 Customer function exit: Segment text in material doc. item
MBCF0005 Material document item for goods receipt/issue slip
MBCF0006 Customer function for WBS element
MBCF0007 Customer function exit: Updating a reservation
MBCF0009 Filling the storage location field
MBCF0010 Customer exit: Create reservation BAPI_RESERVATION_CREATE1
MBCF0011 Read from RESB and RKPF for print list in MB26
MB_CF001 Customer Function Exit in the Case of Updating a Mat. Doc.
award points if ans is useful.
Regards,
Albert -
How can identify the default currency for a customer?
How can identify the default currency for a customer?
I know that this is being determined when you create a sales order for a particular customer, for example, so I could break this process open and find out what it uses. But I thought it worth asking in this forum first.
BlueHi Gary,
As per my understanding of your question I am replying , If you are looking some thing else then I request you to please elaborate your query.
If you see the BP sales area data in transaction BP, In billing tab you maintain the currency for a customer which is default currency when you create a sales order.
<b>Reward points if it helps!!</b>
Best regards,
Vikash -
Hi,
I am trying to develop a custom tag for Marquee in JSF, my usecase is to display a value from managed bean(Dynamically). please find the code below and guide me where i have made mistake
regards
Sandeep
Component class:
package customtags;
import javax.el.ValueExpression;
import javax.faces.component.UIComponentBase;
import javax.faces.context.FacesContext;
public class Marquee extends UIComponentBase {
public static final String COMPONENT_TYPE = "marqueecomp";
public static final String RENDERER_TYPE = "marqueeRenderer";
private Object[] _state = null;
private String value;
public String getValue() {
if (null != this.value) {
return this.value;
ValueExpression _ve = getValueExpression("value");
return (_ve != null) ? (String) _ve.getValue(getFacesContext()
.getELContext()) : null;
public void setValue(String marquee) {
this.value = marquee;
public String getFamily() {
// TODO Auto-generated method stub
return COMPONENT_TYPE;
// public void encodeBegin(FacesContext context) throws IOException {
// ResponseWriter writer = context.getResponseWriter();
// writer.startElement("marquee", this);
// writer.write(getValue());
// writer.endElement("marquee");
public void restoreState(FacesContext context, Object state) {
this._state = (Object[]) _state;
super.restoreState(_context, this._state[0]);
value = (String) this._state[1];
public Object saveState(FacesContext _context) {
if (_state == null) {
_state = new Object[2];
state[0] = super.saveState(context);
_state[1] = value;
return _state;
Tag Class:
package customtags;
import javax.el.ValueExpression;
import javax.faces.component.UIComponent;
import javax.faces.webapp.UIComponentELTag;
public class MarqueeTag extends UIComponentELTag {
protected ValueExpression marquee;
public String getComponentType() {
// TODO Auto-generated method stub
return Marquee.COMPONENT_TYPE;
public String getRendererType() {
// TODO Auto-generated method stub
return Marquee.RENDERER_TYPE;
* protected void setProperties(UIComponent component) {
* super.setProperties(component); Marquee marqComp = (Marquee) component;
* if (marquee != null) { marqComp.setValue(marquee); } }
protected void setProperties(UIComponent component) {
super.setProperties(component);
Marquee marqComp = null;
try {
marqComp = (Marquee) component;
} catch (ClassCastException cce) {
throw new IllegalStateException(
"Component "
+ component.toString()
+ " not expected type. Expected: com.foo.Foo. Perhaps you're missing a tag?");
if (marquee != null) {
//marqComp.setValueExpression("value", marquee);
marqComp.setValue("fsdfsdfsdfsdfsd");
* @return the marquee
public ValueExpression getMarquee() {
return marquee;
* @param marquee
* the marquee to set
public void setMarquee(ValueExpression marquee) {
this.marquee = marquee;
*.tld file*
<?xml version="1.0" encoding="UTF-8"?>
<taglib xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd"
version="2.1">
<tlib-version>1.0</tlib-version>
<short-name>marqueecomp</short-name>
<uri>http://tags.org/marquee</uri>
<tag>
<name>marqueeTag</name>
<tag-class>customtags.MarqueeTag</tag-class>
<body-content>empty</body-content>
<attribute>
<description><![CDATA[Your description here]]></description>
<name>id</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<description><![CDATA[Your description here]]></description>
<name>value</name>
</attribute>
</tag>
</taglib>
Renderer class:
package customtags;
import java.io.IOException;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
import javax.faces.render.Renderer;
public class MarqueeRenderer extends Renderer {
public void encodeBegin(final FacesContext facesContext,
final UIComponent component) throws IOException {
super.encodeBegin(facesContext, component);
final ResponseWriter writer = facesContext.getResponseWriter();
writer.startElement("DIV", component);
/*String styleClass =
(String)attributes.get(Shuffler.STYLECLASS_ATTRIBUTE_KEY);
writer.writeAttribute("class", styleClass, null);*/
public void encodeEnd(final FacesContext facesContext,
final UIComponent component) throws IOException {
final ResponseWriter writer = facesContext.getResponseWriter();
writer.endElement("DIV");
in Faces-Config:
<component>
<display-name>marqueecomp</display-name>
<component-type>marqueecomp</component-type>
<component-class>customtags.Marquee</component-class>
<component-extension>
<renderer-type>marqueeRenderer</renderer-type>
</component-extension>
</component>
<render-kit>
<renderer>
<component-family>marqueecomp</component-family>
<renderer-type>marqueeRenderer</renderer-type>
<renderer-class>customtags.MarqueeRenderer</renderer-class>
</renderer>
</render-kit>
In class path --->marquee.taglib.xml
<?xml version="1.0"?>
<!DOCTYPE facelet-taglib PUBLIC
"-//Sun Microsystems, Inc.//DTD Facelet Taglib 1.0//EN"
"http://java.sun.com/dtd/facelet-taglib_1_0.dtd">
<facelet-taglib>
<namespace>http://tags.org/marquee</namespace>
<tag>
<tag-name>marqueeTag</tag-name>
<component>
<component-type>marqueecomp</component-type>
<renderer-type>marqueeRenderer</renderer-type>
</component>
</tag>
</facelet-taglib>
*.xhtml file*
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core" xml:lang="en" lang="en"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich" xmlns:mycomp="http://tags.org/marquee">
<head>
<title>DEBTDOC Home Page</title>
<meta http-equiv="keywords" content="enter,your,keywords,here" />
<meta http-equiv="description"
content="A short description of this page." />
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" href="../css/common.css"></link>
<script language="javascript" src="../script/common.js"></script>
</head>
<body>
<f:view>
<mycomp:marqueeTag value="hello World"></mycomp:marqueeTag>There exist the JSTL SQL taglib, but I don't recommend this. It should only be used for quick development and testing. For database connectivity, rather create a data layer with DAO classes which you on its turn just plug in your business layer (with servlets).
Maybe you are looking for
-
Adding more than one photo per frame
Is there a way in iMovie HD 5.0.2 to show more than one photo at a time that is imported from iPhoto?
-
Deployment Problems of Enterprise Application in NWDS 7.1
Hello Everyone,<br> <br> I am having a problem when trying to deploy an application I made to the server. The project consists of two DCs, one which is an Enterprise Application and the other is a Web Module. I have configured the web module to be a
-
CreatePDF printer File shows ERROR in the status column and will not upload to my account
When printing to the CreatePDF printer. the file shows ERROR in the status column and will not upload to my account
-
Hi We are having the SOLMAN Version 4.0 SP13 system. As per my understanding the CHRAM can b eused for the following 1.Maintenance optimizer ( for downloading& implimenting support packages) 2, Maintnenance cycle(for enhancment or bug fix cycle) 3.
-
TS1538 My itunes is not recognizing my iphone.
I have tried all the fixes listed on the support website and it has made no difference. Itunes recognizes my ipod and works fine, just my iphone is not connecting. My laptop runs off Windows 8 and it is identifying with my iphone and the phone is c