• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

navigation issue

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm a newbie to JSF so please take it easy on me. I'm an experienced programmer with Struts, but this is a new small project I have to do (by myself of course) with JSF.

I'm using ICEFaces 1.8, with JSF 1.2 and Java6 SDK. Tomcat 6 web container.

I have Page1 that contains a data table, that lists master record data. One of the columns contains a commandLink which allows a specific child record to be edited, in Page2. The navigation works perfectly from Page1 to Page2. The problem comes in when after the user is done on Page2, they may need to go back to Page1 to look at the rest of the master records and perhaps view another one. I cannot get that to work. I created a commandLink in Page2, to navigate back to Page1, using a static outcome string. Regardless if I use redirect true or false, JSF will immediately go to Page2 and not display Page1. If I re-enter the URL for Page1 into a new browser tab, it still goes to Page2. The only way I can get back to Page1 is to completely close the browser, the open it back up and put in the URL.

I know there must be something simple I am missing here. I tried to search for the answer with all of the search terms I can think of but I keep getting back results that do not apply to my situation. Can someone tell me what I'm doing wrong here, or point me to an existing thread that explains this?

Thanks in advance!

Tom
 
Tom Cog
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Bump. Anyone? Please...
 
Ranch Hand
Posts: 90
Eclipse IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Tom

You have an strange problem , because there is not problem using a commandLink to navigate from one page to another and go back to the first, remember that jsf use a post method for navigation and for that the url is one step behind, you use redirect to make a new get and refresh the url but you lost the data from the page.

If I re-enter the URL for Page1 into a new browser tab, it still goes to Page2.


I think for some weird reason when you try to enter the url for Page1 the ViewHandler load the outcome (a session bean) and for that reason match a navigation case and cause the navigation for page2. Try to create 2 empty page with the same behavior of the navigation and check if the same problem occurs.
Sorry for not having a concrete answer, I hope this helps somewhat.
Regards
Cesar
 
Tom Cog
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, a completely static navigation test works. I created two simple pages that use a commandLink to go to the other page. This works. I am still completely mystified why my original case does not work. The link back from the detail record page to the master record page is also static. I also want to make it completely clear that I am NOT pressing the browser 'back' button, or in any way trying to implement 'back button' behavior. I want to have a command link that will go to a specific JSF page.
 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For one like this, Tom, you really need to post your code. My first suspicion is that you're using a backing class that is "session" scoped and whatever flag value you use to detect/perform the navigation is still set the next time you enter Page 1 so the trip to Page 2 is appearing to occur automatically.

But, I'm just guessing.

Eric


Tom Cog wrote:I'm a newbie to JSF so please take it easy on me. I'm an experienced programmer with Struts, but this is a new small project I have to do (by myself of course) with JSF.

I'm using ICEFaces 1.8, with JSF 1.2 and Java6 SDK. Tomcat 6 web container.

I have Page1 that contains a data table, that lists master record data. One of the columns contains a commandLink which allows a specific child record to be edited, in Page2. The navigation works perfectly from Page1 to Page2. The problem comes in when after the user is done on Page2, they may need to go back to Page1 to look at the rest of the master records and perhaps view another one. I cannot get that to work. I created a commandLink in Page2, to navigate back to Page1, using a static outcome string. Regardless if I use redirect true or false, JSF will immediately go to Page2 and not display Page1. If I re-enter the URL for Page1 into a new browser tab, it still goes to Page2. The only way I can get back to Page1 is to completely close the browser, the open it back up and put in the URL.

I know there must be something simple I am missing here. I tried to search for the answer with all of the search terms I can think of but I keep getting back results that do not apply to my situation. Can someone tell me what I'm doing wrong here, or point me to an existing thread that explains this?

Thanks in advance!

Tom

 
Saloon Keeper
Posts: 28117
198
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the JavaRanch, Tom, but please don't "bump". You shouldn't have to, since we have a lot of traffic here and if someone knows the answer, you'll usually get a response fairly quickly. "Fairly quickly" isn't instantaneous, however, since we're all volunteers here, not 24x7 paid support, and the planet needs to spin around once or twice before all potential contributors are likely yo have seen your question. Patience is a virtue.

I'm afraid I can't really tell what's wrong from your description. Usually when you get stuck on a page that means that one or more of the form's data objects is failing validation. An <h:messages globalOnly="false"/> tag can generally tell you what the problem is.

One thing to be aware of however, is that in JSF, unlike most webapp frameworks, a URL isn't an absolute resource locator, it's more of a session handle. So the displayed URL value and the displayed page are often at variance.
 
Tom Cog
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Eric Ford wrote:For one like this, Tom, you really need to post your code. My first suspicion is that you're using a backing class that is "session" scoped and whatever flag value you use to detect/perform the navigation is still set the next time you enter Page 1 so the trip to Page 2 is appearing to occur automatically.

But, I'm just guessing.

Eric



Hi Eric, thanks for the response. The bean which is used is request scope. There are no UI components within the bean, its purely used to hold properties that are referenced in the jsp pages with value bindings. I'm not permitted to post the exact code here, but I should be able to create a cloned version of it that would be safe for me to post. Until I can do that, I will just give a quick description here. The first page is very simple. It has a data table, with three columns. The data table has a value binding for the property which contains an ArrayList of objects for the data table to iterate. The second and third columns contain simple text from object properties. The first column contains a commandLink, whose action binds to a method of a different bean (the backing bean for the second page) that will load the data based on the value being set with setPropertyActionListener.

The second page has a commandLink with a string outcome hard coded for the action, which directs back to the first page. The expected behavior would be that following this command link would display the first page, but it does not. The second page is displayed instead.
 
How do they get the deer to cross at the signs? Or to read this tiny ad?
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic