You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by ben_p <be...@standardbank.com> on 2008/05/16 16:44:00 UTC

[Tobago] Popup and navigation

Hi All,
I am trying to do something I believe to be very fundamental with Tobago
v1.0.13. I want to click a button which will ultimately retrieve some
results from a database and display them in a subsequent screen. However if
the results returned are large I want a popup to come up which informs the
user of the number returned and provides the option of continuing to the
next screen or cancelling. To abstract away from the actual case I simple
want the following

InputScreen.jsp->click button-> popup (ok/cancel) ->NewScreen.jsp or
InputScreen.jsp.

I have tried allsorts of permeatations with actions and actionListeners and
below is my current efforts. It seems that the only way to get the popup to
show is if the submit method has a void return type, but this is useless for
navigation and I can't get the actionListener to somehow come in and display
the popup. As the submit method below has a return type of String the popup
is not shown and navigation to the next screen occurs. changing the return
type to void means the popup get displayed but there is no navigation to the
next screen.

Firstly my InputScreen.jsp:


<tc:button label="Open Popup" action="#{InputScreenBean.submit}"
actionListener="#{InputScreenBean.myActionListener}" immediate="true">
<f:facet name="popup">
<tc:popup width="300" height="270"
rendered="#{InputScreenBean.popup">
<tc:box label="Popup Title">
<tc:panel>
<f:facet name="layout">
<tc:gridLayout rows="fixed;fixed;fixed;fixed" />
</f:facet>
<tc:in value="#{InputScreenBean.myData1}" />
<tc:cell />
<tc:button label="OK">
<tc:attribute name="popupClose" value="afterSubmit" />
</tc:button>
<tc:button label="Cancel">
<tc:attribute name="popupClose" value="immediate" />
</tc:button>
</tc:panel>
</tc:box>
</tc:popup>
</f:facet>
</tc:button>

Secondly my InputScreenBean.java:

public void myActionListener(ActionEvent event) {
  System.out.println("in action event");
  setPopup(true);
  System.out.println("rendering response");
  // I have tried with and without this
  cxt.renderResponse();
 }

// the only way to get the popup to show is if this
// method is of return type void. but then I can't
// do my navigation!
 public String submit() {
  try {
   System.out.println("in InputScreenBean.submit ");
   setPopup(true);
  } catch (Exception e) {
   System.out.println("Error in submit()");
   e.printStackTrace();
    return "failure";
  }
   return "success";
 }

Any help greatly appreciated.

Ben.

-- 
View this message in context: http://www.nabble.com/-Tobago--Popup-and-navigation-tp17276445p17276445.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: [Tobago] Popup and navigation

Posted by ben_p <be...@standardbank.com>.
I hadn't tried this, but on your suggestion I have returned null and indeed
the popup window is displayed. However this does not solve my problem. The
popup is displayed and asks if the user wants to continue. If the answer is
yes/ok then I want to navigate to the next page. By returning null I have
lost that chance and am back at the original page.

By returning null however has taught me a bit about the JSF flow, it seems
that submit() completes before the popup will be shown. I guess what I
really want is the popup to be shown during the submit() method. and based
on the user input to the popup the submit() method will determine the
navigation.



Helmut Swaczinna-2 wrote:
> 
> Hi,
> 
> have you tried to return null from the submit method in case the popup 
> should be displayed?
> 
> Helmut
> 
> ----- Original Message ----- 
> From: "ben_p" <be...@standardbank.com>
> To: <us...@myfaces.apache.org>
> Sent: Friday, May 16, 2008 4:44 PM
> Subject: [Tobago] Popup and navigation
> 
> 
>>
>> Hi All,
>> I am trying to do something I believe to be very fundamental with Tobago
>> v1.0.13. I want to click a button which will ultimately retrieve some
>> results from a database and display them in a subsequent screen. However 
>> if
>> the results returned are large I want a popup to come up which informs
>> the
>> user of the number returned and provides the option of continuing to the
>> next screen or cancelling. To abstract away from the actual case I simple
>> want the following
>>
>> InputScreen.jsp->click button-> popup (ok/cancel) ->NewScreen.jsp or
>> InputScreen.jsp.
>>
>> I have tried allsorts of permeatations with actions and actionListeners 
>> and
>> below is my current efforts. It seems that the only way to get the popup 
>> to
>> show is if the submit method has a void return type, but this is useless 
>> for
>> navigation and I can't get the actionListener to somehow come in and 
>> display
>> the popup. As the submit method below has a return type of String the 
>> popup
>> is not shown and navigation to the next screen occurs. changing the
>> return
>> type to void means the popup get displayed but there is no navigation to 
>> the
>> next screen.
>>
>> Firstly my InputScreen.jsp:
>>
>>
>> <tc:button label="Open Popup" action="#{InputScreenBean.submit}"
>> actionListener="#{InputScreenBean.myActionListener}" immediate="true">
>> <f:facet name="popup">
>> <tc:popup width="300" height="270"
>> rendered="#{InputScreenBean.popup">
>> <tc:box label="Popup Title">
>> <tc:panel>
>> <f:facet name="layout">
>> <tc:gridLayout rows="fixed;fixed;fixed;fixed" />
>> </f:facet>
>> <tc:in value="#{InputScreenBean.myData1}" />
>> <tc:cell />
>> <tc:button label="OK">
>> <tc:attribute name="popupClose" value="afterSubmit" />
>> </tc:button>
>> <tc:button label="Cancel">
>> <tc:attribute name="popupClose" value="immediate" />
>> </tc:button>
>> </tc:panel>
>> </tc:box>
>> </tc:popup>
>> </f:facet>
>> </tc:button>
>>
>> Secondly my InputScreenBean.java:
>>
>> public void myActionListener(ActionEvent event) {
>>  System.out.println("in action event");
>>  setPopup(true);
>>  System.out.println("rendering response");
>>  // I have tried with and without this
>>  cxt.renderResponse();
>> }
>>
>> // the only way to get the popup to show is if this
>> // method is of return type void. but then I can't
>> // do my navigation!
>> public String submit() {
>>  try {
>>   System.out.println("in InputScreenBean.submit ");
>>   setPopup(true);
>>  } catch (Exception e) {
>>   System.out.println("Error in submit()");
>>   e.printStackTrace();
>>    return "failure";
>>  }
>>   return "success";
>> }
>>
>> Any help greatly appreciated.
>>
>> Ben.
>>
>> -- 
>> View this message in context: 
>> http://www.nabble.com/-Tobago--Popup-and-navigation-tp17276445p17276445.html
>> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>>
>> 
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/-Tobago--Popup-and-navigation-tp17276445p17278761.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: [Tobago] Popup and navigation

Posted by Helmut Swaczinna <my...@wlp-systems.de>.
Hi,

have you tried to return null from the submit method in case the popup 
should be displayed?

Helmut

----- Original Message ----- 
From: "ben_p" <be...@standardbank.com>
To: <us...@myfaces.apache.org>
Sent: Friday, May 16, 2008 4:44 PM
Subject: [Tobago] Popup and navigation


>
> Hi All,
> I am trying to do something I believe to be very fundamental with Tobago
> v1.0.13. I want to click a button which will ultimately retrieve some
> results from a database and display them in a subsequent screen. However 
> if
> the results returned are large I want a popup to come up which informs the
> user of the number returned and provides the option of continuing to the
> next screen or cancelling. To abstract away from the actual case I simple
> want the following
>
> InputScreen.jsp->click button-> popup (ok/cancel) ->NewScreen.jsp or
> InputScreen.jsp.
>
> I have tried allsorts of permeatations with actions and actionListeners 
> and
> below is my current efforts. It seems that the only way to get the popup 
> to
> show is if the submit method has a void return type, but this is useless 
> for
> navigation and I can't get the actionListener to somehow come in and 
> display
> the popup. As the submit method below has a return type of String the 
> popup
> is not shown and navigation to the next screen occurs. changing the return
> type to void means the popup get displayed but there is no navigation to 
> the
> next screen.
>
> Firstly my InputScreen.jsp:
>
>
> <tc:button label="Open Popup" action="#{InputScreenBean.submit}"
> actionListener="#{InputScreenBean.myActionListener}" immediate="true">
> <f:facet name="popup">
> <tc:popup width="300" height="270"
> rendered="#{InputScreenBean.popup">
> <tc:box label="Popup Title">
> <tc:panel>
> <f:facet name="layout">
> <tc:gridLayout rows="fixed;fixed;fixed;fixed" />
> </f:facet>
> <tc:in value="#{InputScreenBean.myData1}" />
> <tc:cell />
> <tc:button label="OK">
> <tc:attribute name="popupClose" value="afterSubmit" />
> </tc:button>
> <tc:button label="Cancel">
> <tc:attribute name="popupClose" value="immediate" />
> </tc:button>
> </tc:panel>
> </tc:box>
> </tc:popup>
> </f:facet>
> </tc:button>
>
> Secondly my InputScreenBean.java:
>
> public void myActionListener(ActionEvent event) {
>  System.out.println("in action event");
>  setPopup(true);
>  System.out.println("rendering response");
>  // I have tried with and without this
>  cxt.renderResponse();
> }
>
> // the only way to get the popup to show is if this
> // method is of return type void. but then I can't
> // do my navigation!
> public String submit() {
>  try {
>   System.out.println("in InputScreenBean.submit ");
>   setPopup(true);
>  } catch (Exception e) {
>   System.out.println("Error in submit()");
>   e.printStackTrace();
>    return "failure";
>  }
>   return "success";
> }
>
> Any help greatly appreciated.
>
> Ben.
>
> -- 
> View this message in context: 
> http://www.nabble.com/-Tobago--Popup-and-navigation-tp17276445p17276445.html
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>
> 


Re: [Tobago] Popup and navigation

Posted by ben_p <be...@standardbank.com>.
That has solved my problem. Thanks a lot for your help.

Ben.

Helmut Swaczinna-2 wrote:
> 
> Hi,
> 
> the Ok button on the popup should have an action assigned, say
> submitPopup(), and this action should return an outcome to
> navigate to the next page.
> 
> Helmut
> 
> 
>>
>>I hadn't tried this, but on your suggestion I have returned null and
indeed
>>the popup window is displayed. However this does not solve my problem. The
>>popup is displayed and asks if the user wants to continue. If the answer
is
>>yes/ok then I want to navigate to the next page. By returning null I have
>>lost that chance and am back at the original page.
>>
>>By returning null however has taught me a bit about the JSF flow, it seems
>>that submit() completes before the popup will be shown. I guess what I
>>really want is the popup to be shown during the submit() method. and based
>>on the user input to the popup the submit() method will determine the
>>navigation.
>>
>>
>>
>>Helmut Swaczinna-2 wrote:
>>> 
>>> Hi,
>>> 
>>> have you tried to return null from the submit method in case the popup 
>>> should be displayed?
>>> 
>>> Helmut
>>> 
>>> ----- Original Message ----- 
>>> From: "ben_p" <be...@standardbank.com>
>>> To: <us...@myfaces.apache.org>
>>> Sent: Friday, May 16, 2008 4:44 PM
>>> Subject: [Tobago] Popup and navigation
>>> 
>>> 
>>>>
>>>> Hi All,
>>>> I am trying to do something I believe to be very fundamental with
>>>> Tobago
>>>> v1.0.13. I want to click a button which will ultimately retrieve some
>>>> results from a database and display them in a subsequent screen.
>>>> However 
>>>> if
>>>> the results returned are large I want a popup to come up which informs
>>>> the
>>>> user of the number returned and provides the option of continuing to
>>>> the
>>>> next screen or cancelling. To abstract away from the actual case I
>>>> simple
>>>> want the following
>>>>
>>>> InputScreen.jsp->click button-> popup (ok/cancel) ->NewScreen.jsp or
>>>> InputScreen.jsp.
>>>>
>>>> I have tried allsorts of permeatations with actions and actionListeners 
>>>> and
>>>> below is my current efforts. It seems that the only way to get the
>>>> popup 
>>>> to
>>>> show is if the submit method has a void return type, but this is
>>>> useless 
>>>> for
>>>> navigation and I can't get the actionListener to somehow come in and 
>>>> display
>>>> the popup. As the submit method below has a return type of String the 
>>>> popup
>>>> is not shown and navigation to the next screen occurs. changing the
>>>> return
>>>> type to void means the popup get displayed but there is no navigation
>>>> to 
>>>> the
>>>> next screen.
>>>>
>>>> Firstly my InputScreen.jsp:
>>>>
>>>>
>>>> <tc:button label="Open Popup" action="#{InputScreenBean.submit}"
>>>> actionListener="#{InputScreenBean.myActionListener}" immediate="true">
>>>> <f:facet name="popup">
>>>> <tc:popup width="300" height="270"
>>>> rendered="#{InputScreenBean.popup">
>>>> <tc:box label="Popup Title">
>>>> <tc:panel>
>>>> <f:facet name="layout">
>>>> <tc:gridLayout rows="fixed;fixed;fixed;fixed" />
>>>> </f:facet>
>>>> <tc:in value="#{InputScreenBean.myData1}" />
>>>> <tc:cell />
>>>> <tc:button label="OK">
>>>> <tc:attribute name="popupClose" value="afterSubmit" />
>>>> </tc:button>
>>>> <tc:button label="Cancel">
>>>> <tc:attribute name="popupClose" value="immediate" />
>>>> </tc:button>
>>>> </tc:panel>
>>>> </tc:box>
>>>> </tc:popup>
>>>> </f:facet>
>>>> </tc:button>
>>>>
>>>> Secondly my InputScreenBean.java:
>>>>
>>>> public void myActionListener(ActionEvent event) {
>>>>  System.out.println("in action event");
>>>>  setPopup(true);
>>>>  System.out.println("rendering response");
>>>>  // I have tried with and without this
>>>>  cxt.renderResponse();
>>>> }
>>>>
>>>> // the only way to get the popup to show is if this
>>>> // method is of return type void. but then I can't
>>>> // do my navigation!
>>>> public String submit() {
>>>>  try {
>>>>   System.out.println("in InputScreenBean.submit ");
>>>>   setPopup(true);
>>>>  } catch (Exception e) {
>>>>   System.out.println("Error in submit()");
>>>>   e.printStackTrace();
>>>>    return "failure";
>>>>  }
>>>>   return "success";
>>>> }
>>>>
>>>> Any help greatly appreciated.
>>>>
>>>> Ben.
>>>>
>>>> -- 
>>>> View this message in context: 
>>>> 
>>http://www.nabble.com/-Tobago--Popup-and-navigation-tp17276445p17276445.html
>>>> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>>>>
>>>> 
>>> 
>>> 
>>> 
>>
>>-- 
>>View this message in context: 
>>http://www.nabble.com/-Tobago--Popup-and-navigation-tp17276445p17278761.html
>>Sent from the MyFaces - Users mailing list archive at Nabble.com.
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/-Tobago--Popup-and-navigation-tp17276445p17304572.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.