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

having navigation probelms using h:commandLink  RSS feed

 
Matt Kohanek
Village Idiot
Ranch Hand
Posts: 484
Java jQuery Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a page saved under NIRAP/WebContent/pages/first.xhtml. The page displays fine.
I also have a page /NIRAP/WebContent/pages/new_project.xhtml. This one also dispalys fine when I run it on local host.
There is a command link on first.xhtml:



But when I try to go there I get the nice familiar requested resource is not available (I want to throw somethign Ive seen that error so many times now!)

Ive tried a few different things for value=, such as NIRAP/WebContent/pages/new_project.xhtml (with and without the / in front of NIRAP)
but I get

message NIRAP/pages/NIRAP/WebContent/pages/new_project.xhtml

description The requested resource (/NIRAP/pages/NIRAP/WebContent/pages/new_project.xhtml) is not available.


or /pages/new_project.xhtml and I get

message /pages/new_project.xhtml

description The requested resource (/pages/new_project.xhtml) is not available


this seems fairly simple so I dont understand why I cant even make this little thing work! I mean i can give myself a break not gettign some of the more advanced stuff Ive asked about working, but this too!! JSF gods are out to get me it seems. The only time I dont get an error is when I simply put value="new_project.xhtml" (without a / ), but that just gives me a prompt to save the file or use the internet to find the correct type of program to open it

Do I just need a navigation rule of some kind? I thought with a straightforward thing like this I wouldnt need one


edit - hmm..after playing with this some more, Im thinking maybe I am supposed to use a navigation rule here, and for all links I guess...I just thought navigation rules were needed so you would only be directed to the next page upon some completion of some java code? Is that incorrect then?

edit 2 - no, Im pretty sure a navigation rule isnt what I need here...why cant I get this tiny problem to work, this is pathetic
 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think this is probably improper context. Take a good close look at the URL. It would probably work better like this:


BTW, commandLink and outputLink are quite different. But outputLink is what you wanted here.
 
Matt Kohanek
Village Idiot
Ranch Hand
Posts: 484
Java jQuery Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I only got to try a few things before everything in my project broke, so now I have to deal with that before I can come back to this...but

I tried your suggestion two times before everything else went haywire, here are the two things I tried



But it still would not direct me to that page. I was just about to try the entire path /NIRAP/WebContent/pages/new_project.xhtml, but things are broken now and none of my jsf pages will even show up anymore...I dont know what happened, but now I cant work on this problem.
So if you see what I did there please let me know so Ill have one less thing to deal with once I get things running again (god I hope...)

Thanks for all your help
 
Matt Kohanek
Village Idiot
Ranch Hand
Posts: 484
Java jQuery Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this is becoming a real problem, nothing I have tried will work

Ive tried every possible thing you can for value= but it simply will not redirect to another page.

Anyone have any problems like this, or is this another "make Matt a failure" issue that only afflicts me?

Is there another way to handle this, such as through a navigation rule? I know the generic way to use navigation rules, but is there a way to make one for a single outputLink on a page?
 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Urp. I just noticed something. You're referencing the SOURCE FILE, not the URL.

Let's try this again:


YMMV, depending on how you form your JSF URLs.
 
Matt Kohanek
Village Idiot
Ranch Hand
Posts: 484
Java jQuery Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have launched the page ths link is supposed to redirect to in its own window and Im trying to use that url to figure out what to put here. I am getting closer, it just seems every time I try to change the value of outputLink it tacks on some other pieces of text!
Im getting closer though, its just trial and error now
 
Matt Kohanek
Village Idiot
Ranch Hand
Posts: 484
Java jQuery Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well I had to just add a new folder add_project to the /pages folder, and then put the new_project.xhtml page in there. Then used this for the line of code:



Now this seems like it might get cumbersome when I have a lot of pages. Does something like this effect speed or efficiency very much?
 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, your second URL should have worked like this:

<hutputLink value="pages/new_project.jsf" >New Project</hutputLink>

or

<hutputLink value="#{pageContext.contextPath}/pages/new_project.jsf" >New Project</hutputLink>

You shouldn't have had to do anything further. Usually, however, dividing pages into subdirectories is a good thing, though. Fewer files often mean faster directory searches, it's easier to write security rules based on directory paths, and it's easier for the maintenance people to find the different parts of the program if they're not all jumbled up together in one big ball.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!