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

default.jsp

baran tamer
Ranch Hand

Joined: Jan 22, 2009
Posts: 33
hello , i am trying to configure a default page

my default page is at



and my web.xml file includes



when i type

http://localhost:8181/baran/


the error is

org.apache.jasper.JasperException: java.lang.RuntimeException: FacesContext not found
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:522)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:416)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
com.ardic.web.EncodingFilter.doFilter(EncodingFilter.java:34)




What would be the problem ?
thanks
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
You have JSF components in the welcome page, but the FacesServlet isn´t been invoked by the specific URL so it can´t create the FacesContext. The JSF components are complaining that they cannot find the FacesContext.

Create an index.jsp with a jsp:forward to default.jsf and only mention the index.jsp in the welcome file list.
baran tamer
Ranch Hand

Joined: Jan 22, 2009
Posts: 33


my index.jsp is



when i start index,jsp it redirects to default.jsp , but when i type

http://localhost:8181/baran/


i get the same error

Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
baran tamer wrote:

In your other topic you said that you successfully changed it to *.jsf.


my index.jsp is



when i start index,jsp it redirects to default.jsp , but when i type

http://localhost:8181/baran/


i get the same error


default.jsf, I said default.jsf.

And you should not be using JSF in the welcome page (you should already realize that if you understood the exception). Leave all of those clutter away. Just use jsp:forward, nothing more.
baran tamer
Ranch Hand

Joined: Jan 22, 2009
Posts: 33
sorry i missread your post
baran tamer
Ranch Hand

Joined: Jan 22, 2009
Posts: 33
thanks a lot it works,

But what if i had not changed it to *.jsf and kept it as /faces/* ?
Is there any way to do that ?
Which will be better for my project , cause i need to do lots of redirect modifications

BTW : Solution was just putting the jsp:forward in the index.jsp as you told me
thanks
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
baran tamer wrote:thanks a lot it works,

But what if i had not changed it to *.jsf and kept it as /faces/* ?
Is there any way to do that ?
Then obviously forward to /faces/default.jsp instead of default.jsf.

I only have read in your another topic that you wanted suffix mapping rather than prefix mapping and saw that you successfully have changed it. So I just changed my answer on that .. Call it advancing understanding.

Which will be better for my project , cause i need to do lots of redirect modifications

I don´t dare to say, it depends on your functional requirements.

If I would start a brand new JSF project, I would prefer suffix mapping over prefix mapping.

BTW : Solution was just putting the jsp:forward in the index.jsp as you told me
thanks

You´re welcome.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: default.jsp