myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Roger Lee, NOTiFY" <roger....@notify.co.uk>
Subject Re: navigating from tree2
Date Tue, 29 Mar 2005 16:25:51 GMT
Thanks for the suggestion.

But I need a listener as I require and action to occur as the user clicks on 
the "Document" TreeNode of the tree2 component.

The ActionListener method is being executed and the value returned is 
"success" but it doesn't cause my <navigation-rule> to execute!

I have tried added a <commandLink action="#{bean.method}" ...> on the 
Document node as well, after the <ActionListener>, but this doesn't get 
executed.

Are you saying that I cannot use the <navigation-rule>  from a tree2 
component?

Regards,

Roger Lee

Internet communications are not secure and therefore NOTiFY
does not accept legal responsibility for the contents of this message.
Although NOTiFY operates anti-virus programmes, it does not
accept responsibility for any damage whatsoever that is caused by
viruses being passed.  Any views or opinions presented are solely those
of the author and do not necessarily represent those of NOTiFY.
Replies to this email may be monitored by NOTiFY for operational or
business reasons.


----- Original Message ----- 
From: "Matthias Wessendorf" <mailings@matthias-wessendorf.de>
To: "MyFaces Discussion" <myfaces-user@incubator.apache.org>
Sent: Tuesday, March 29, 2005 3:48 PM
Subject: Re: navigating from tree2


> Roger Lee,
>
> if you use <commandLink action="#{bean.method}" ...>
> and you have a
> <snip>
> public String method(){
>   return ("foo");
> }
> </snip>
> that will help to navigate (be carefull with immediate="true";
> my tree.jsp has no immediate for commandLinks that use faces-config.xml
> for navigation)
>
> I use actionListener for other things.
>
> Imagine a form that has lot's of opional fields
> but only some mandatory fields.
>
> By standard you could show only the mandatory fields
> and provide a link "Show complete form". There a actionListener
> fits fine in (IMHO).
>
> Below there is a simple example on that.
> (a <h:form/> and two actionListener-methods)
>
> HTH,
> Matthias
>
> --------------------------form.jsp--------------------------
> <h:form>
> <h:panelGrid columns="2">
>
>   <h:outputText value="Vorname"/>
>   <h:inputText value="#{person.vorname}"/>
>
>   <h:outputText value="Nachname"/>
>   <h:inputText value="#{person.nachname}"/>
>
>   <h:outputText value="Strasse" rendered="#{person.komplett}"/>
>   <h:inputText value="#{person.strasse}" rendered="#{person.komplett}"/>
>
>   <h:outputText value="Hausnummer" rendered="#{person.komplett}"/>
>   <h:inputText value="#{person.hausnummer}" 
> rendered="#{person.komplett}"/>
>
>   <h:outputText value="Postleitzahl" rendered="#{person.komplett}"/>
>   <h:inputText value="#{person.postleitzahl}" 
> rendered="#{person.komplett}"/>
>
>   <h:outputText value="Ort" rendered="#{person.komplett}"/>
>   <h:inputText value="#{person.ort}" rendered="#{person.komplett}"/>
>
>   <h:outputText value="Telefonnummer" rendered="#{person.komplett}"/>
>   <h:inputText value="#{person.telefonnummer}" 
> rendered="#{person.komplett}"/>
>
>   <h:outputText value="Handynummer" rendered="#{person.komplett}"/>
>   <h:inputText value="#{person.handynummer}" 
> rendered="#{person.komplett}"/>
>
>   <h:commandButton
>     id="kompaktId"
>     value="small formular"
>     style="color:red"
>     immediate="true"
>     rendered="#{person.komplett}"
>     actionListener="#{person.kompaktAnsicht}"/>
>
>   <h:commandButton
>     id="vollansichtId"
>     value="complete formular"
>     style="color:red"
>     immediate="true"
>     rendered="#{! person.komplett}"
>     actionListener="#{person.komplettAnsicht}"/>
>
>   <h:commandButton value="absenden" action="{person.submitValues}"/>
> </h:panelGrid>
> </h:form>
> --------------------------actionListener--------------------------
>
> private boolean komplett;
>
>   public void kompaktAnsicht(ActionEvent event){
>     this.komplett = false;
>   }
>
>   public void komplettAnsicht(ActionEvent event){
>     this.komplett = true;
>   }
>
>
>
>
>
>
> Roger Lee, NOTiFY wrote:
>> Michael,
>>
>> The return value was declared outside as;
>>
>> public class LoanSelectionTreeActionListener {
>>
>>     public String nodeDescription = null;
>>
>>     public LoanSelectionTreeActionListener() {
>>     }
>>
>>     public String selectLoan(ActionEvent actionEvent) throws 
>> AbortProcessingException {
>>
>>     etc etc.
>>
>>
>> Changed it as suggested, but still fails to forward to 
>> LoanEnquirySummary.jsp
>>
>> I had this working in WebGalileo using similar technique.
>>
>> Thanks for your suggestions.
>>
>>
>>
>> Internet communications are not secure and therefore NOTiFY
>> does not accept legal responsibility for the contents of this message.
>> Although NOTiFY operates anti-virus programmes, it does not
>> accept responsibility for any damage whatsoever that is caused by
>> viruses being passed.  Any views or opinions presented are solely those
>> of the author and do not necessarily represent those of NOTiFY.  Replies 
>> to this email may be monitored by NOTiFY for operational or business 
>> reasons.
>>
>>
>> ----- Original Message ----- 
>> From: "Flesch, Michael RD-AS2" <Michael.Flesch@heidelberg.com>
>> To: "MyFaces Discussion" <myfaces-user@incubator.apache.org>; "Roger Lee, 
>> NOTiFY" <roger.lee@notify.co.uk>
>> Sent: Tuesday, March 29, 2005 2:11 PM
>> Subject: AW: navigating from tree2
>>
>>
>> I thing you lost the return value.
>> Use:
>> public String selectLoan(ActionEvent actionEvent) throws 
>> AbortProcessingException {
>>       ...
>>        return isTreeNodeSelected();
>>     }
>> Michael -----Ursprüngliche Nachricht-----
>> Von: Roger Lee, NOTiFY [mailto:roger.lee@notify.co.uk] Gesendet: 
>> Dienstag, 29. März 2005 14:44
>> An: MyFaces Discussion
>> Betreff: navigating from tree2
>>
>>
>> My ActionListener in a tree2 component calls a backing class and gets the 
>> Description from the Tree Node.
>>
>> LoanSelectionTree.jsp
>>
>> <x:commandLink immediate="true" styleClass="document" 
>> actionListener="#{loanSelectionTreeActionListener.selectLoan}" >
>>
>>
>> I then call a method in this Backing Class which returns "success".
>>
>>  public void selectLoan(ActionEvent actionEvent) throws 
>> AbortProcessingException {
>>         //System.out.println("********** LoanSelectionTreeActionListener 
>> selectLoan");
>>
>>         UIComponent component = actionEvent.getComponent();
>>
>>         UIComponent parent = component.getParent().getParent();
>>
>>         HtmlTree tree = (HtmlTree) parent;
>>         TreeNode node = tree.getNode();
>>         nodeDescription = node.getDescription();
>>
>>         System.out.println(">>>>> LoanSelectionTreeActionListener

>> selectLoan node.getDescription = " + node.getDescription());
>>
>>         // To force return of "Success"
>>         isTreeNodeSelected();
>>     }
>>
>>     public String getNodeDescription() {
>>         return (nodeDescription);
>>     }
>>
>>     public String isTreeNodeSelected() {
>>
>>         if (nodeDescription != null) {
>>             System.out.println(">>>>> LoanSelectionTreeActionListener

>> isTreeNodeSelected = " + FortyTwoObjectsConstants.SUCCESS_OUTCOME);
>>             return FortyTwoObjectsConstants.SUCCESS_OUTCOME;
>>         }
>>         else {
>>             System.out.println(">>>>> LoanSelectionTreeActionListener

>> isTreeNodeSelected = " + FortyTwoObjectsConstants.ERROR_OUTCOME);
>>             return FortyTwoObjectsConstants.ERROR_OUTCOME;
>>         }
>>     }
>>
>> in my Faces-Config I have;
>>
>> <navigation-rule>
>>         <from-view-id>/LoanSelectionTree.jsp</from-view-id>
>>         <navigation-case>
>> 
>> <from-action>#{loanSelectionTreeActionListener.selectLoan}</from-action>
>>             <from-outcome>success</from-outcome>
>>             <to-view-id>/LoanEnquirySummary.jsp</to-view-id>
>>         </navigation-case>
>>     </navigation-rule>
>>
>> I have also tried it with;
>>
>> 
>> <from-action>#{loanSelectionTreeActionListener.isTreeNodeSelected}</from-action>
>>
>> Either way it does not navigate to my "LoanEnquirySummary.jsp"
>>
>> No errors thrown. Any suggestions?
>>
>> Many thanks.
>>
>> Roger Lee
>>
>> Internet communications are not secure and therefore NOTiFY does not 
>> accept legal responsibility for the contents of this message.
>> Although NOTiFY operates anti-virus programmes, it does not accept 
>> responsibility for any damage whatsoever that is caused by viruses being 
>> passed.  Any views or opinions presented are solely those of the author 
>> and do not necessarily represent those of NOTiFY.
>> Replies to this email may be monitored by NOTiFY for operational or 
>> business reasons.
> 



Mime
View raw message