shale-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "stephan opitz" <stephan.op...@gmail.com>
Subject language defined error messages..
Date Mon, 24 Jul 2006 14:24:42 GMT
i wrote a class which should handle all exceptions and error message
in form of FacesMessage:

package de.fhb.ShaleTest.view;

import javax.faces.application.FacesMessage;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.shale.util.Messages;

import de.fhb.ShaleTest.general.BaseViewController;
import de.fhb.ShaleTest.general.Properties;

public class MessageLang extends BaseViewController {

	private final Log log = LogFactory.getLog(this.getClass());
	
	Messages messagesRessouce = null;

	public MessageLang() {
		
		String locale = getFacesContext().getViewRoot().getLocale().toString();

		String actMessagesRessoucePath = Properties.MessagesRessoucePath;

		if (locale.equals("de") == false) {
			actMessagesRessoucePath += "_" + locale;
		}

		messagesRessouce = new Messages(actMessagesRessoucePath, this
				.getClass().getClassLoader());

	}
	
	public String getMessage (String whichMessage) {

		String message = messagesRessouce.getMessage(whichMessage);
		
		return message;
		
	}
	
	public void setFacesMessage(String whichMessage) {

		String message = messagesRessouce.getMessage(whichMessage);

		getFacesContext().addMessage(null, new FacesMessage(message));

	}
}

it works with the login like in mailreader...

problem if a have a myfaces component, which get its info from a
function - i get nullpointer...

how is this handles: if a swap from one page to another on which is
something like the myfaces datatable...

the table is defined like this

	<component jsfid="collage:dataTable" extends="t:dataTable">
		<attributes>
			...
			<set name="value" value="#{pagedSort.cars}" />
....

get its values from managed bean pagedSort and list cars...

but how i can maybe create language defined error messages... other
standard solutions available?

i have the list working and can swap but without error messages -
everything shit

Mime
View raw message