Thats so simple! :S I swear i checked FacesContext over and over for a method. Geeezz i'm blind. Thanks!

Frode Oldervoll wrote:

Use FacesContext.getCurrentInstance().addMessage

 

-Frode

 


From: Robert Parsons [mailto:[EMAIL PROTECTED]]
Sent: 2. november 2005 07:37
To: MyFaces Discussion
Subject: Re: Call managed bean method based on request attribute

 

Thanks!

Just another question if anyone is still around, if I want to add a message to the response from a bean method rather than at validation time (such as 'save' method), how do that? The only way I can see of adding messages is by throwing a ValitatorException :S.

Thanks in advance,
-Robert.

Mathias Brökelmann wrote:

use FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("id")
 
2005/11/1, Robert Parsons <[EMAIL PROTECTED]>:
  
Hi,
 
I'm after some basic design assistance here. If I have a managed bean
that represents some database entity, how can I populate that bean from
the database based on a request parameter?
 
For example, say I have a managed bean called Customer. The form for
editing the bean is 'editCustomer.faces'. If the page is accessed
directly (without any request parameters) a blank form is dispalyed
which can be used to create a new Person. (which would possibly have an
action for inserting it into the database).
 
However, if a request like 'editCustomer.faces?id=14' was issued, I want
the Customer bean to load customer number 14 from the database.
 
What is the best way of achieving this with JavaServer faces? This whole
managed mean is making my old methods of working a little difficult.
 
Thanks in advance,
Robert.
 
    
 
 
--
Mathias
 
 
  

 




Reply via email to