You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by jelmstrom <Jo...@edb.com> on 2006/05/08 13:12:34 UTC

Using Context to report errors

Hi, 

I'm trying to use the FacesContext to report exceptions thrown by code
accessed by BackingBeans, but I cannot access the view component to alter
the state of the controls. This is simply because it has not been created
yet, because as far as the JSF framework knows, this is a new request. 

The sequence of eventsI am looking for is this :
1 - The input fields are validated ok and the action method on the backing
bean is invoked. 
2 - This catches an exception and sets a message on the page (adds a Message
to the context and sets the UIInputComponent to invalid. (valid == false) i
3 - the view is renedered showing the error.

However,  at point 2 I cannot access the UIInputComponent and which has a
value that is not allowed (i.e. a customer that is not in the database, a
grid reference that is off the chart, etc..), and alter its style
This is because when i try to access the UIComponent, the ViewRoot is null
or already pointing to the next page (which of course does not contain my
field)

Is there any way that I am able to set the UIInputComponent to invalid in
the action Method on teh BackingBean and trigger a reload of the previous
page(Similar to the validation exception in a Validator)??

regards
/Johan

--
View this message in context: http://www.nabble.com/Using-Context-to-report-errors-t1576171.html#a4279005
Sent from the MyFaces - Users forum at Nabble.com.