| Author |
Message |
![[Post New]](/JForum/templates/default/images/icon_minipost_new.gif) 22/08/2010 12:05:53
|
eli_lato
Joined: 10/03/2010 00:00:00
Messages: 30
Offline
|
Is there an easy, javascriptless way to make a button whose action is like the Back button in IE? Iow, I want a button that navigates back to the last page that the user displayed.
Thanks,
Eli
|
|
|
 |
![[Post New]](/JForum/templates/default/images/icon_minipost_new.gif) 26/08/2010 08:38:36
|
alexgiul
Joined: 08/02/2010 00:00:00
Messages: 76
Offline
|
In my app, I use this way:
Code:
<ice:commandButton image="#{msg['image.back']}" alt="back" immediate="true" action="#{view.backFromInsertOrModify}" actionListener="#{view.backFromInsertOrModifyListener}"/>
In the action, you'll put the dynamically the action to come back, and in actionListener a method to put some logic
|
|
|
 |
![[Post New]](/JForum/templates/default/images/icon_minipost_new.gif) 29/08/2010 05:21:19
|
eli_lato
Joined: 10/03/2010 00:00:00
Messages: 30
Offline
|
Good start! What event or listener can I use to assign view.backFromInsertOrModify?
Thanks,
Eli
|
|
|
 |
![[Post New]](/JForum/templates/default/images/icon_minipost_new.gif) 30/08/2010 06:15:10
|
alexgiul
Joined: 08/02/2010 00:00:00
Messages: 76
Offline
|
my solution at this king of problem is:
1) a View controller, a bean (where there are properties and attributes) and a dao for data managing.
Immagine View controller made by a base class and the extendend class.
In the base class I put 2 attribute, the current view name,the other view.
So when I'm on the first view, I can go only to the second (no back button), when I'm on the second, the back button has setted the previous view name.
The view name is the same in faces-config.xml
This is my idea how to solve it
I hope this help you.
|
|
|
 |
![[Post New]](/JForum/templates/default/images/icon_minipost_new.gif) 12/09/2010 07:24:52
|
eli_lato
Joined: 10/03/2010 00:00:00
Messages: 30
Offline
|
Yes, it helped a lot.
Here's my adaptation of your solution:
<ice:commandButton dir="rtl" accesskey="k" immediate="true"
image="#{!empty image ? image : '/resources/images/previousScreen.gif'}"
alt="Previous Screen"
title="#{general['previousScreenButtonToolTip']}"
style="border: 1px solid black;margin: 5px; padding-left: 12px;
padding-right: 12px; padding-top: 2px; padding-bottom: 2px;"
action="#{navigationController.previousView}" />
First, I made a phaseListener that calls NavigationController to push each new view into a stack:
public void afterPhase(PhaseEvent e) {
String viewId = FacesContext.getCurrentInstance().getViewRoot()
.getViewId();
((NavigationController) JsfUtils.getBean("navigationController"))
.pushView(viewId);
}
Second, the CommandButton's navigationController.previousView simply unstacks the current view, unstacks the previous view, and navigates to the previous view.
Thanks a lot!
Eli
|
|
|
 |
|
|