aspose file tools*
The moose likes JSF and the fly likes test.jsf works test.jsp doesn't Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "test.jsf works test.jsp doesn Watch "test.jsf works test.jsp doesn New topic
Author

test.jsf works test.jsp doesn't

Mark Kelsall
Greenhorn

Joined: Apr 23, 2011
Posts: 19
Hi Guys,

I'm new here & relatively new to java. I've been at it in SAP for the last year or so & i've been quite protected from real Java. So now i want to get my teeth into something...

I have been trying to understand the best way to put dynamic data into my .jsp page & found out that JSF is the way forward...right? I managed to find a tutorial working first time (pretty much) with test.jsf (even though i generated a test.jsp file according to eclipse). However i want it to display as test.jsp on my URL & that's how i would like to navigate to it through from other pages.

Is this possible? I have tried playing with my web.xml & changing the url-pattern, however this just seems to make it throw lots of errors & the faces-context error catching thingy page shows.

Thanks in advance!

Mark
Tuna Töre
Ranch Hand

Joined: Aug 17, 2008
Posts: 219

Just read this post as a starting point;

http://www.coderanch.com/t/533197/JSF/java/HTML-JSP-start-JSF-page

Tuna TÖRE


blog: http://tunatore.wordpress.com
SCJP 6.0 + SCWCD 1.5
Mark Kelsall
Greenhorn

Joined: Apr 23, 2011
Posts: 19
Thanks, i read the other post, however it doesn't quite make sense yet.

In my web.xml i have the following...



If i navigate to http://localhost:8080/mywebapp/jsf/test.jsp it tells me that the FacesContext cannot be found, however if i navigate to http://localhost:8080/mywebapp/jsf/test.jsf it finds the page & displays the contents correctly.

Thanks

Mark
Emmanuel F. Borges
Greenhorn

Joined: Mar 25, 2011
Posts: 12

Have you tried to change the pattern to *.jsp ? This way, all your JSP's will be interpreted as JSF files and processed by Faces Servlet. But I don't know if that is advisable.

In my application, I use xhtml files and the url pattern is *.xhtml
Mark Kelsall
Greenhorn

Joined: Apr 23, 2011
Posts: 19
Hi Emmanuel,

Yeah i've tried changing it to *.jsp, unfortunately that just throws lots of errors.

I think that is the sort of thing i am looking for, best practices, things like using *.xhtml

Does that mean that when you a coding links to & from jsp pages with JSF in them, you link to .xhtml?

An example maybe:

create test.jsp page with JSF in, in my folder in my web app.
from another jsp page (say hello.jsp), an <a> tag would be:

<a href="http://localhost:8080/mywebapp/test.xhtml">to test</a>

Thanks

Mark
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: test.jsf works test.jsp doesn't