Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JSF language support and error handling

 
nikos karanikos
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am new at JSF and i want to do some things.
->When the user request for a file that is not exists i want to redirect to a valid url where i can inform him that the file does not exists.
->I am trying to use the properties messages for the language that the user has. I want to use it cause i want to reuse some of the message and it is easier to translate the page to other languages. How when the browser has a default page English to let user change the language to Italian for example but for all page. Is it possible?
Thank you for your help
 
Tim Holloway
Bartender
Posts: 18423
60
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're not likely to get a prompt or well-informed answer that way.

We don't have many rules here at the JavaRanch, but we do insist that you use your Real Name and not some sort of "handle" or obvious alias. If you're not sure about this, see
http://www.javaranch.com/name.jsp .
 
nikos karanikos
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I find how to have a generic message if the file not exists. I added at web.xml the code

How i can change the location so i can use the location messages from the properties files?
Thank you
 
Tim Holloway
Bartender
Posts: 18423
60
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you, Nikos!

I don't think that you can make that work. The error-page mechanism is controlled not by the webapp, but by the server itself - the exception has been thrown out of the application entirely and the server is simply using information from the deployment descriptor (web.xml) to recover. In other words, you cannot count on the error page being processed by the FacesServlet and therefore none of the JSF features would work.

An errorpage CAN be straight HTML or a vanilla (non-JSF) JSP page. And you should be able to find lots of examples on how to use I18N resources to display a locale-specific message text on an error JSP using property bundles.
 
BWA HA HA HA HA HA HA! Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!