Re: [Shale/JSF] Frustrating Navigation Quirk

2006-05-08 Thread Gary VanMatre
From: James Reynolds [EMAIL PROTECTED] 

 
 My problem deals with navigation between two pages, a Contract list page 
 and a Contract detail page. On the list page is a Boolean check box 
 that filters the list according to a certain criteria with a 
 ValueChangeListener. When the user click on a contract, the id of that 
 contract is sent as a parameter to the detail page. That parameter is 
 used in the init() method of the detail page's backing bean to load a 
 contract object and place it in session. All this works great. 
 
 The user can go back and forth between the list page and the detail page 
 *except* if the booleanCheckBox is clicked. Here is the sequence: The 
 user is viewing the detail page, then goes back to the list page _via 
 the back button of the browser_ (I suspect that's a key issue of the 
 problem), then the user clicks the booleanCheckBox. Instead of 
 filtering the list (and reloading the list page), the user is returned 
 to the detail page. 
 
 What I've done so far: My first thought was that the detail page was 
 still the most recent view because the user employed the browser's back 
 button to return the list. The ValueChangeListener method, wired to the 
 list page (and that bean is in session scope), changes a Boolean 
 property, then calls renderResponse(). That which would reload the 
 current view - which is the detail page, according to my thought 
 process. 
 
 To compensate for this, I placed additional code in the 
 ValueChangeListener that loaded the ViewId. If it didn't match my List 
 page ViewId, I set up the necessary code to navigate to the correct 
 ViewId. It didn't make any difference, so I'm not sure if my hypothesis 
 was correct. 
 
 I'm frankly stumped right now, so any advice would be appreciated. I'm 
 thinking that this must have something to do with the 
 ValueChangeListener, which I've listed below. Should I be adding 
 something else in there? 


It seems like you are trying to use the ValueChangeListener for navigation 
instead of for state management.  The action method binding on a command
component is where you would want to place the conditional navigation rules.

Could you set the boolean flag in the ValueChangeListener that an action
method would use to determine the correct navigation path?  The action
binding would be hooked to the command you are using to submit the page.

From the action, you could look at the boolean value a choose a logical
outcome.  Something like:

public String filterList() {

if (wasCheckBoxChanged)
   return showList;
else
   return showDetail; 
}


navigation-rule
from-view-id/list.jsp/from-view-id
navigation-case
  from-outcomeshowDetail/from-outcome
  to-view-id/detail.jsp/to-view-id
/navigation-case  
navigation-case
  from-outcomeshowList/from-outcome
  to-view-id/list.jsp/to-view-id
/navigation-case  
/navigation-rule


Gary

 
 Thanks, 
 
 public void compOnlyChecked(ValueChangeEvent vce) { 
 compOnly = (Boolean) vce.getNewValue(); 
 getFacesContext().renderResponse(); 
 } 
 
 
 - 
 To unsubscribe, e-mail: [EMAIL PROTECTED] 
 For additional commands, e-mail: [EMAIL PROTECTED] 
 

RE: [Shale/JSF] Frustrating Navigation Quirk

2006-05-08 Thread James Reynolds
Thanks Gary,

I was stuck in ValueChange rut.  Switching to a command link fixed the
problem and is much simpler. 

Have a great day!


-Original Message-
From: Gary VanMatre [mailto:[EMAIL PROTECTED] 
Sent: Monday, May 08, 2006 12:03 PM
To: Struts Users Mailing List
Subject: Re: [Shale/JSF] Frustrating Navigation Quirk

From: James Reynolds [EMAIL PROTECTED]

 
 My problem deals with navigation between two pages, a Contract list 
 page and a Contract detail page. On the list page is a Boolean check 
 box that filters the list according to a certain criteria with a 
 ValueChangeListener. When the user click on a contract, the id of that

 contract is sent as a parameter to the detail page. That parameter is 
 used in the init() method of the detail page's backing bean to load a 
 contract object and place it in session. All this works great.
 
 The user can go back and forth between the list page and the detail 
 page
 *except* if the booleanCheckBox is clicked. Here is the sequence: The 
 user is viewing the detail page, then goes back to the list page _via 
 the back button of the browser_ (I suspect that's a key issue of the 
 problem), then the user clicks the booleanCheckBox. Instead of 
 filtering the list (and reloading the list page), the user is returned

 to the detail page.
 
 What I've done so far: My first thought was that the detail page was 
 still the most recent view because the user employed the browser's 
 back button to return the list. The ValueChangeListener method, wired 
 to the list page (and that bean is in session scope), changes a 
 Boolean property, then calls renderResponse(). That which would reload

 the current view - which is the detail page, according to my thought 
 process.
 
 To compensate for this, I placed additional code in the 
 ValueChangeListener that loaded the ViewId. If it didn't match my List

 page ViewId, I set up the necessary code to navigate to the correct 
 ViewId. It didn't make any difference, so I'm not sure if my 
 hypothesis was correct.
 
 I'm frankly stumped right now, so any advice would be appreciated. I'm

 thinking that this must have something to do with the 
 ValueChangeListener, which I've listed below. Should I be adding 
 something else in there?


It seems like you are trying to use the ValueChangeListener for
navigation 
instead of for state management.  The action method binding on a command
component is where you would want to place the conditional navigation
rules.

Could you set the boolean flag in the ValueChangeListener that an action
method would use to determine the correct navigation path?  The action
binding would be hooked to the command you are using to submit the page.

From the action, you could look at the boolean value a choose a logical
outcome.  Something like:

public String filterList() {

if (wasCheckBoxChanged)
   return showList;
else
   return showDetail; 
}


navigation-rule
from-view-id/list.jsp/from-view-id
navigation-case
  from-outcomeshowDetail/from-outcome
  to-view-id/detail.jsp/to-view-id
/navigation-case  
navigation-case
  from-outcomeshowList/from-outcome
  to-view-id/list.jsp/to-view-id
/navigation-case  
/navigation-rule


Gary

 
 Thanks, 
 
 public void compOnlyChecked(ValueChangeEvent vce) { 
 compOnly = (Boolean) vce.getNewValue(); 
 getFacesContext().renderResponse(); 
 } 
 
 
 - 
 To unsubscribe, e-mail: [EMAIL PROTECTED] 
 For additional commands, e-mail: [EMAIL PROTECTED] 
 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]