• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

having navigation probelms using h:commandLink

 
Village Idiot
Posts: 484
jQuery Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Saloon Keeper
Posts: 27764
196
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
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
Posts: 484
jQuery Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 484
jQuery Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Saloon Keeper
Posts: 27764
196
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
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
Posts: 484
jQuery Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 484
jQuery Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Saloon Keeper
Posts: 27764
196
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
Well, your second URL should have worked like this:

<h:outputLink value="pages/new_project.jsf" >New Project</h:outputLink>

or

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

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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic