myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gianluca Correndo <gianluca_corre...@yahoo.com>
Subject Re: adding parameters for actionHandler
Date Sat, 29 Sep 2007 10:55:52 GMT
Hi Simon,
  thanks for the help. I don't know why Trinidad 'param' didn't work. I've
setted up the environment for Tobago, maybe I lost some filter on the way..
  In any case, I've been able to fix the problem using this:

  JSF:
  <tc:button label="erase"			actionListener="#{OntologyManager.eraseOntology}">
<f:param name="toErase" value="#{ontology}" />
						</tc:button>


--- simon <simon.kitching@chello.at> wrote:

> On Fri, 2007-09-28 at 08:40 -0700, Gianluca Correndo wrote:
> > Hello everyone,
> >   I have started to develop with MyFaces and Tobago few weeks ago. I
> >  have used
> > tomahawk for a while and with it there was an easy way to add
> >  parameters to an
> > event for customising actions. For example in a page I could add a link
> >  to
> > erase one ontology I manage:
> > 
> >  <t:commandLink styleClass="submitButton"  value="erase" id="eraseC"
> > action="#{SessionBean.eraseOntology}"> 
> >   <f:param name="oid" value="#{ontology.id}"/>
> >  </t:commandLink>
> > 
> > 
> > And the event handler was able to retrieve the parameter "oid" from the
> >  faces
> > context with:
> > 
> > public void eraseOntology(ActionEvent actionEvent){
> >         String oid =
> >
>
javax.faces.context.FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("oid");
> > 
> >   Now in the Tobago library this doesn't work anymore. How can I
> >  achieve the
> > same behaviour?
> 
> I don't know why it's not working, but there is an elegant alternative.
> 
> With JSF1.1 you can use the tomahawk t:updateActionListener tag to get
> the same effect. The JSF1.2 standard has made this a part of the
> standard.
> 
> For JSF1.1, see updateActionListener here:
>   http://myfaces.apache.org/tomahawk/tlddoc/index.html
> 
> <t:commandLink ....>
>   <t:updateActionListener 
>     property="#{SessionBean.ontologyToErase}"
>     value="#{ontology.id}"/>
> </t:commandLink>
> 
> The setOntologyToErase method will be called before eraseOntology.
> 
> For JSF1.2, see f:setPropertyActionListener here:
> http://java.sun.com/javaee/javaserverfaces/1.2/docs/tlddocs/index.html
> 
> NB: I haven't used this for a while so the syntax might not be exactly
> right..
> 
> Regards,
> 
> Simon
> 
> 



      ____________________________________________________________________________________
Catch up on fall's hot new shows on Yahoo! TV. Watch previews, get listings, and more!
http://tv.yahoo.com/collections/3658 

Mime
View raw message