Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Strange behavior with navigation - navigation rules don't work until URL is entered manually.  RSS feed

 
John Tannel
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry that the subject was not very clear, but let me try to clarify what I am doing.

My default file is index.jsp. This contains:



If I navigate to the directory, the url bar contains /foo/bar/ but the page displays the code from foo/bar/main.jsf as it should.

When I click on a button, instead of taking me where it should it simply refreshes the page but with foo/bar/main.jsf in the url bar (and still displaying that page). I can press the buttons as many times as I want, but nothing happens except the refresh. It looks like it's not matching a navigation rule and just keeping me on the same page. If I then navigate via url bar to /foo/bar/main.jsf (or simply clicking in the url bar and hitting enter) all the buttons start to work perfectly.

I know I've used this exact same setup before, and have no idea why it's not working right now. Does anyone have any ideas?

Thanks!

John
 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the JavaRanch, John!

The browser navigation control (url bar) displays the returned URL from the last request. URLs are NOT file paths, even though they look like file paths. In most web frameworks, the framework directly locates resources based on the URL path.

That isn't true in JSF. In JSF there's a lot of postback going on. The URL isn't so much an absolute resource location as it is a "handle" to the ongoing conversation. Which is why it often is out of sync as far as displayed resource goes.

You can make the URL resource path track better by putting a "redirect" into your navigation rules, but be forewarned - redirection is extra overhead, since effectively it takes the original URL returned, throws it away and manually resubmits under the new resource path specification.
 
John Tannel
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tim,

Thanks for the greeting. I actually do use redirects for your suggested purpose. The problem remains whether I have them or not though and so seems unrelated. Do you have any ideas what may be causing the issue I mentioned?

John


Edit: Okay, so I have some more info. I think it has something to do with my context declaration in server.xml. I have mine declared a bit strange because of some other projects in the same directory that aren't for tomcat 5.5 and cause my error log to get clogged up. Basically I have my appbase set to this project and my docbase set to '.' When declared normally (like on our production server) everything behaves normally. I guess this is mostly solved as it's not a big deal for local testing and doesn't affect our production environment. However, if anyone knows why this is happening, it would still be both interesting and potentially helpful to anyone else that happens upon this thread.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!