Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Error Occurring while run the jsf project  RSS feed

 
nagarjun kalivarapu
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

i created a JSF project in eclipse IDE using rich faces. in that project i created a index.xhtml file in web content and i created a java class in src folder and made it as managed bean. I added all required jar files in project. Every thing is good. i didn't get any errors . but when i run the project the browser will open and it is asking "do you want to save the file".. i am getting this message in a popup. what shall i do now.. please help me . i am fighting with this error from 3 days

Thank you
 
E Armitage
Rancher
Posts: 989
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How are you running the project?
 
nagarjun kalivarapu
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
from index.html--> right click--> run on server
 
E Armitage
Rancher
Posts: 989
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you do that does it show anything in the logs, like that the server is starting? Also, how are you accessing the page that is giving you the pop up?
 
nagarjun kalivarapu
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But i didnt get any output.. if i open the file from the popup it will show the code of my .xhtml file
 
E Armitage
Rancher
Posts: 989
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the only thing I can suggest is that you should get a tutorial which shows how to use your IDE (eclipse) to deploy and test JSF applications.
 
nagarjun kalivarapu
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i created my project as war file and i deployed in other user's eclipse . there it will executed successfully..so i changed my eclipse also and started from the starting.. again i am getting same conflict
 
Tim Holloway
Bartender
Posts: 18709
71
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is one reason why we don't recommend having an IDE doing all the thinking for you.

I've got a pretty good idea what's going on. It's probably trying to download your View Definition template.

First of all, you have to understand that there is a critical difference in J2EE between a URL and a resource. They look a lot alike, but they are not the same thing.

A URL is what you type into the client browser's navigation control. For example, "http://www.javaranch.com/myapp/page1.jsf".

A resource is what is used to render a response to the URL request. It is located within the WAR. For example, "/page1.xhtml". Note that the effective root of a resource is the base directory of the WAR than contains it.

JSF has a mechanism that takes incoming URL requests and breaks them into meaningful components. It then employs various conversion processes to locate the resources needed to service that request and render a response. If you are using what is probably the most common set of options, the URL for page1.jsf will cause JSF to fetch and apply /page1.xhtml.

So while it's possible that you mis-coded web.xml, my money is that you're attempting to use a URL in the form "http://www.javaranch.com/myapp/page1.xhtml".

That won't work. It won't match the URL mapping rules that would get it routed to the JSF Master Controller (FacesServlet) and by default if a URL cannot be mapped to a servlet or JSP, the server will attempt to locate a resource with the same name and copy it to the client. Depending on the client's MIME settings, that would either cause the xhtml to either be displayed in its original text form in the browser window or download to the client.
 
nagarjun kalivarapu
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
wow.......... what a good say.. thank you for your valuable information..
 
nagarjun kalivarapu
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i tried from firefox browser by entering url http://localhost:8080//richdemo/faces/index.html jsf code is executing. if i run from the eclipse it's not executing..
 
Tim Holloway
Bartender
Posts: 18709
71
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I do not understand. How do you "run a URL from Eclipse"? Are you attempting to use the Eclipse built-in browser? If so, don't bother. It's primarily intended for things like Mylyn interfaces to web-based resources such as Trac tickets. I don't think it was designed to have full CSS or JavaScript support like a real browser would?

Just to be pedantic, you don't "run a JSF project", you run a JSF web application. Eclipse isn't going to be anywhere nearby when the project is installed on a production server. At least not in any IT shop that's sane and competent.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!