Hello all,

have a nice day.

i need your help in JSF

I am a Working on JSF custom Component.

I am facing a problem i am adding JSF Component in my Encode method.
i have a A4J:CommandLink
when i click on a4j link i want the InputTextField to be Render and a4j link hide.


My Code is here.

public void encodeBegin(FacesContext context) throws IOException {

ResponseWriter writer = context.getResponseWriter();

UIForm uiform = (UIForm) this.getParent();

HtmlAjaxCommandLink aj = new HtmlAjaxCommandLink(); // //// Ajax LInk

HtmlInputText intext = new HtmlInputText(); // /////// InputTextField Because Ajax and commandButton only Work under Form tag
if (uiform != null && uiform instanceof UIForm) {
aj.setParent(uiform);// /////////// set The Parent of AjaxLink
intext.setParent(uiform); // //////// Set the Parnet of InputField
}

intext.setId("textf");
intext.setValue("nain");
boolean showf = (Boolean) TagUtils.getTagValue(context, this,
"showfield");
intext.setRendered(showf);

String clientId = getClientId(context);
id = (String) TagUtils.getTagValue(context, this, "cid");
this.setId(id);

MethodBinding actionforbutton = (MethodBinding) TagUtils.getTagValue(
context, this, "action");
if (actionforbutton != null) {
aj.setAction(actionforbutton);
}

boolean showlink = (Boolean) TagUtils.getTagValue(context, this,
"showlink");
aj.setRendered(showlink);
aj.setId("link1");
value = (String) TagUtils.getTagValue(context, this, "value");
aj.setValue(value);

aj.setReRender(intext); // //// i want to _reRender the TextField
aj.setOncomplete("ello()");
intext.encodeBegin(context);
intext.encodeEnd(context);
aj.encodeBegin(context);
aj.encodeEnd(context);

this.setParent(uiform);
}

in my decode Method

MyComponent.queueEvent(new ActionEvent(this));

but nothing happen no Rerendering done by a4j link

Can you Please Tell Whether this is possible Using Custom Component what i am doing