You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Dave <ja...@yahoo.com> on 2006/03/18 15:54:30 UTC
CommandButton subclass
For <commandButton>, its action listener and action method are executed in Invoke Application phase. I need to create a custom component that is a subclass of <commandButton>, but execute action listeners and action method in two different phases:
Action listeners in ApplyRequestValue phase, and
Action method in Invoke Application phase,
Is this possible?
Some info on how to do this would be very helpful. Thanks!
---------------------------------
Brings words and photos together (easily) with
PhotoMail - it's free and works with Yahoo! Mail.
Re: CommandButton subclass
Posted by Mike Kienenberger <mk...@gmail.com>.
On 3/18/06, Dave <ja...@yahoo.com> wrote:
> HtmlCommandButton is a subclass of UICommand. Should I subclass
> HtmlCommandButton and override queueEvent(), like
Yes, I think that should work. Give it a try and see.
> I am new to creating custom components. How to set it up so that I can use
> it in JSP? like tag, where to put the tag description, etc.
For JSP, to create a new component, you would need to specify it in
your faces-config.xml file and in a tld file. I'm not really very
knowledgeable about JSP, though, as I use facelets instead. You
could just copy what's in there for HtmlCommandButton.
You might also be able to replace the component-type class for
HtmlCommandButton directly in the faces-config file. Maybe you
wouldn't need to create a new component definition if you're willing
to use your new component everywhere you currently using an
HtmlCommandButton.
-Mike
Re: CommandButton subclass
Posted by Dave <ja...@yahoo.com>.
UICommand.java has:
public void queueEvent(FacesEvent event)
{
if (event != null && event instanceof ActionEvent)
{
if (isImmediate())
{
event.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
}
else
{
event.setPhaseId(PhaseId.INVOKE_APPLICATION);
}
}
super.queueEvent(event);
}
HtmlCommandButton is a subclass of UICommand. Should I subclass HtmlCommandButton and override queueEvent(), like
class MyHtmlCommandButton extends HtmlCommandButton {
public void queueEvent(FacesEvent event)
{
if (event != null && event instanceof ActionEvent)
{
event.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
}
super.queueEvent(event);
}
}
immediate is not supported. Event phaseId is set to APPLY_REQUEST_VALUES.
I am new to creating custom components. How to set it up so that I can use it in JSP? like tag, where to put the tag description, etc.
Thanks for help.
Mike Kienenberger <mk...@gmail.com> wrote:
Yes, this should be possible. I can't remember if the code that
determines the phase is in the component (Probably UICommand) or in
the renderer. It may be as simple as providing an alternate
renderer.
On 3/18/06, Dave wrote:
>
> For , its action listener and action method are executed in
> Invoke Application phase. I need to create a custom component that is a
> subclass of , but execute action listeners and action method
> in two different phases:
> Action listeners in ApplyRequestValue phase, and
> Action method in Invoke Application phase,
>
> Is this possible?
> Some info on how to do this would be very helpful. Thanks!
>
>
> ________________________________
> Brings words and photos together (easily) with
> PhotoMail - it's free and works with Yahoo! Mail.
>
>
---------------------------------
Yahoo! Mail
Use Photomail to share photos without annoying attachments.
Re: CommandButton subclass
Posted by Mike Kienenberger <mk...@gmail.com>.
Yes, this should be possible. I can't remember if the code that
determines the phase is in the component (Probably UICommand) or in
the renderer. It may be as simple as providing an alternate
renderer.
On 3/18/06, Dave <ja...@yahoo.com> wrote:
>
> For <commandButton>, its action listener and action method are executed in
> Invoke Application phase. I need to create a custom component that is a
> subclass of <commandButton>, but execute action listeners and action method
> in two different phases:
> Action listeners in ApplyRequestValue phase, and
> Action method in Invoke Application phase,
>
> Is this possible?
> Some info on how to do this would be very helpful. Thanks!
>
>
> ________________________________
> Brings words and photos together (easily) with
> PhotoMail - it's free and works with Yahoo! Mail.
>
>