[jboss-user] [JBoss Seam] - Re: Questions on resourceBundle
fernando_jmt
do-not-reply at jboss.com
Mon Apr 16 12:14:41 EDT 2007
So, I think the MessageFactory class you have is not needed. You can use Seam org.jboss.seam.core.FacesMessages class instead.
Below you can see an example I have:
|
| @Name("converters")
| public class Converters {
|
| @Transactional
| public Converter getRoleConverter() {
| return new Converter() {
|
| @Transactional
| public Object getAsObject(FacesContext facesContext, UIComponent uiComponent, String string) throws ConverterException {
| Role role = ((EntityManager) Component.getInstance("entityManager")).find(Role.class, string);
| if (role != null)
| return role;
| else {
| FacesMessage message = FacesMessages.createFacesMessage(FacesMessage.SEVERITY_ERROR, "Common.error.selected_NotFound", null, "");
| throw new ConverterException(message);
| }
| }
|
| public String getAsString(FacesContext facesContext, UIComponent uiComponent, Object object) throws ConverterException {
| return ((Role) object).getName();
| }
| };
| }
|
| }
|
|
Common.error.selected_NotFound is a key in the messages.properties.
HTH.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4037626#4037626
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4037626
More information about the jboss-user
mailing list