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.