Rafa_Abe 20 de out. de 2006
Adiciona um <h:outputText> na página pra mostrar uma mensagem
Na página :
& lt ; h : outputText value = "bean.mensagem" /& gt ;
No bean :
private String mensagem ;
// getters and setters
E nesse método que vc criou vc setar um valor pra essa mensagem.
robson_vs 20 de out. de 2006
tem alguma forma para mim fazer isso e ñ perder o recurso de internacionalização???
Rafa_Abe 20 de out. de 2006
Tem sim…
Locale currentLocale = FacesContext .getCurrentInstance () .getViewRoot () .getLocale () ;
ResourceBundle labels = ResourceBundle .getBundle ( & lt ;nome do arquivo>, currentLocale);
mensagem = labels .getString ( & lt ;nome da chave>);
robson_vs 20 de out. de 2006
Cara eu fiz o seguinte
if ( departamentoVO . getNome () . trim () . length () > 1 ) {
Locale currentLocale = FacesContext . getCurrentInstance ()
. getViewRoot () . getLocale ();
ResourceBundle labels = ResourceBundle . getBundle (
"messages.properties" , currentLocale );
mensagem = labels . getString ( "textoCaractererInvalido" );
departamentoDelegate . salvar ( departamentoVO );
}
mais ñ rolou onde estou errando???
Rafa_Abe 21 de out. de 2006
robson_vs 23 de out. de 2006
Então cara é o seguinte ele ñ grava mais ñ dá mensagem nenhuma
robson_vs 23 de out. de 2006
então coloquei assim
if ( departamentoVO . getNome () . trim () . length () > 1 ) {
departamentoDelegate . salvar ( departamentoVO );
} else {
Locale currentLocale = FacesContext . getCurrentInstance ()
. getViewRoot () . getLocale ();
ResourceBundle labels = ResourceBundle . getBundle (
"messages.properties" , currentLocale );
mensagem = labels . getString ( "textoCaractererInvalido" );
}
e ta me dando esta mensagem de erro
23 / 10 / 2006 09 : 14 : 26 or g . apache . catalina . core . StandardWrapperValve invoke
SEVERE : Servlet . service () for servlet Faces Servlet threw exception
javax . faces . FacesException : Error calling action method of component with id _idJsp28 : gravarDepartamento
at or g . apache . myfaces . application . ActionListenerImpl . processAction ( ActionListenerImpl . java : 74 )
at javax . faces . component . UICommand . broadcast ( UICommand . java : 106 )
at javax . faces . component . UIViewRoot . _broadcastForPhase ( UIViewRoot . java : 94 )
at javax . faces . component . UIViewRoot . processApplication ( UIViewRoot . java : 168 )
at or g . apache . myfaces . lifecycle . LifecycleImpl . invokeApplication ( LifecycleImpl . java : 343 )
at or g . apache . myfaces . lifecycle . LifecycleImpl . execute ( LifecycleImpl . java : 86 )
at javax . faces . webapp . FacesServlet . service ( FacesServlet . java : 137 )
at or g . apache . catalina . core . ApplicationFilterChain . int ernalDoFilter ( ApplicationFilterChain . java : 252 )
at or g . apache . catalina . core . ApplicationFilterChain . doFilter ( ApplicationFilterChain . java : 173 )
at or g . apache . myfaces . webapp . filter . ExtensionsFilter . doFilter ( ExtensionsFilter . java : 144 )
at or g . apache . catalina . core . ApplicationFilterChain . int ernalDoFilter ( ApplicationFilterChain . java : 202 )
at or g . apache . catalina . core . ApplicationFilterChain . doFilter ( ApplicationFilterChain . java : 173 )
at br . com . greenline . falegreen . util . Log inFilter . doFilter ( Log inFilter . java : 32 )
at or g . apache . catalina . core . ApplicationFilterChain . int ernalDoFilter ( ApplicationFilterChain . java : 202 )
at or g . apache . catalina . core . ApplicationFilterChain . doFilter ( ApplicationFilterChain . java : 173 )
at or g . apache . catalina . core . StandardWrapperValve . invoke ( StandardWrapperValve . java : 213 )
at or g . apache . catalina . core . StandardContextValve . invoke ( StandardContextValve . java : 178 )
at or g . apache . catalina . core . StandardHostValve . invoke ( StandardHostValve . java : 126 )
at or g . apache . catalina . val ves . ErrorReportValve . invoke ( ErrorReportValve . java : 105 )
at or g . apache . catalina . core . StandardEngineValve . invoke ( StandardEngineValve . java : 107 )
at or g . apache . catalina . connector . CoyoteAdapter . service ( CoyoteAdapter . java : 148 )
at or g . apache . coyote . http11 . Http11Processor . process ( Http11Processor . java : 869 )
at or g . apache . coyote . http11 . Http11BaseProtocol$Http11ConnectionHandler . processConnection ( Http11BaseProtocol . java : 664 )
at or g . apache . to mcat . util . net . PoolTcpEndpoint . processSocket ( PoolTcpEndpoint . java : 527 )
at or g . apache . to mcat . util . net . LeaderFollowerWorkerThread . run It ( LeaderFollowerWorkerThread . java : 80 )
at or g . apache . to mcat . util . threads . ThreadPool$ Cont rolRunnable . run ( ThreadPool . java : 684 )
at java . lang . Thread . run ( Thread . java : 595 )
Caused by : javax . faces . el . EvaluationException : Exception while invoking exp ression #{ DepartamentoBean . incluirDepartamentos }
at or g . apache . myfaces . el . MethodBindingImpl . invoke ( MethodBindingImpl . java : 153 )
at or g . apache . myfaces . application . ActionListenerImpl . processAction ( ActionListenerImpl . java : 63 )
... 26 more
Caused by : java . util . MissingResourceException : Can ' t find bundle for base name messages . properties , locale pt_BR
at java . util . ResourceBundle . throwMissingResourceException ( ResourceBundle . java : 836 )
at java . util . ResourceBundle . get BundleImpl ( ResourceBundle . java : 805 )
at java . util . ResourceBundle . get Bundle ( ResourceBundle . java : 576 )
at br . com . greenline . falegreen . managedbean . DepartamentoBean . incluirDepartamentos ( DepartamentoBean . java : 35 )
at sun . reflect . NativeMethodAccessorImpl . invoke0 ( Native Method )
at sun . reflect . NativeMethodAccessorImpl . invoke ( NativeMethodAccessorImpl . java : 39 )
at sun . reflect . DelegatingMethodAccessorImpl . invoke ( DelegatingMethodAccessorImpl . java : 25 )
at java . lang . reflect . Method . invoke ( Method . java : 585 )
at or g . apache . myfaces . el . MethodBindingImpl . invoke ( MethodBindingImpl . java : 129 )
... 27 more
23 / 10 / 2006 09 : 14 : 26 javax . faces . webapp . UIComponentTag setupResponseWriter
SEVERE : Faces cont ext not found . get ResponseWriter will fail . Check if the FacesServlet has been initialized at all in your web . xml .
23 / 10 / 2006 09 : 14 : 27 or g . apache . catalina . core . ApplicationDispatcher invoke
SEVERE : Servlet . service () for servlet jsp threw exception
java . lang . NullPointerException
at javax . faces . webapp . UIComponentTag . setupResponseWriter ( UIComponentTag . java : 929 )
at javax . faces . webapp . UIComponentTag . doStartTag ( UIComponentTag . java : 310 )
at or g . apache . myfaces . taglib . core . ViewTag . doStartTag ( ViewTag . java : 70 )
at or g . apache . jsp . pageNotFound_jsp . _jspx_meth_f_view_0 ( pageNotFound_jsp . java : 117 )
at or g . apache . jsp . pageNotFound_jsp . _jspService ( pageNotFound_jsp . java : 91 )
at or g . apache . jasper . run time . HttpJspBase . service ( HttpJspBase . java : 97 )
at javax . servlet . http . HttpServlet . service ( HttpServlet . java : 802 )
at or g . apache . jasper . servlet . JspServletWrapper . service ( JspServletWrapper . java : 332 )
at or g . apache . jasper . servlet . JspServlet . serviceJspFile ( JspServlet . java : 314 )
at or g . apache . jasper . servlet . JspServlet . service ( JspServlet . java : 264 )
at javax . servlet . http . HttpServlet . service ( HttpServlet . java : 802 )
at or g . apache . catalina . core . ApplicationFilterChain . int ernalDoFilter ( ApplicationFilterChain . java : 252 )
at or g . apache . catalina . core . ApplicationFilterChain . doFilter ( ApplicationFilterChain . java : 173 )
at or g . apache . catalina . core . ApplicationDispatcher . invoke ( ApplicationDispatcher . java : 672 )
at or g . apache . catalina . core . ApplicationDispatcher . processRequest ( ApplicationDispatcher . java : 465 )
at or g . apache . catalina . core . ApplicationDispatcher . doForward ( ApplicationDispatcher . java : 398 )
at or g . apache . catalina . core . ApplicationDispatcher . for ward ( ApplicationDispatcher . java : 301 )
at or g . apache . catalina . core . StandardHostValve . custom ( StandardHostValve . java : 363 )
at or g . apache . catalina . core . StandardHostValve . throwable ( StandardHostValve . java : 212 )
at or g . apache . catalina . core . StandardHostValve . invoke ( StandardHostValve . java : 134 )
at or g . apache . catalina . val ves . ErrorReportValve . invoke ( ErrorReportValve . java : 105 )
at or g . apache . catalina . core . StandardEngineValve . invoke ( StandardEngineValve . java : 107 )
at or g . apache . catalina . connector . CoyoteAdapter . service ( CoyoteAdapter . java : 148 )
at or g . apache . coyote . http11 . Http11Processor . process ( Http11Processor . java : 869 )
at or g . apache . coyote . http11 . Http11BaseProtocol$Http11ConnectionHandler . processConnection ( Http11BaseProtocol . java : 664 )
at or g . apache . to mcat . util . net . PoolTcpEndpoint . processSocket ( PoolTcpEndpoint . java : 527 )
at or g . apache . to mcat . util . net . LeaderFollowerWorkerThread . run It ( LeaderFollowerWorkerThread . java : 80 )
at or g . apache . to mcat . util . threads . ThreadPool$ Cont rolRunnable . run ( ThreadPool . java : 684 )
at java . lang . Thread . run ( Thread . java : 595 )
23 / 10 / 2006 09 : 14 : 27 or g . apache . catalina . core . StandardHostValve custom
SEVERE : Exception Processing ErrorPage [ exceptionType = java . lang . Exception , location =/ pageNotFound . jsp ]
or g . apache . jasper . JasperException
at or g . apache . jasper . servlet . JspServletWrapper . handleJspException ( JspServletWrapper . java : 510 )
at or g . apache . jasper . servlet . JspServletWrapper . service ( JspServletWrapper . java : 393 )
at or g . apache . jasper . servlet . JspServlet . serviceJspFile ( JspServlet . java : 314 )
at or g . apache . jasper . servlet . JspServlet . service ( JspServlet . java : 264 )
at javax . servlet . http . HttpServlet . service ( HttpServlet . java : 802 )
at or g . apache . catalina . core . ApplicationFilterChain . int ernalDoFilter ( ApplicationFilterChain . java : 252 )
at or g . apache . catalina . core . ApplicationFilterChain . doFilter ( ApplicationFilterChain . java : 173 )
at or g . apache . catalina . core . ApplicationDispatcher . invoke ( ApplicationDispatcher . java : 672 )
at or g . apache . catalina . core . ApplicationDispatcher . processRequest ( ApplicationDispatcher . java : 465 )
at or g . apache . catalina . core . ApplicationDispatcher . doForward ( ApplicationDispatcher . java : 398 )
at or g . apache . catalina . core . ApplicationDispatcher . for ward ( ApplicationDispatcher . java : 301 )
at or g . apache . catalina . core . StandardHostValve . custom ( StandardHostValve . java : 363 )
at or g . apache . catalina . core . StandardHostValve . throwable ( StandardHostValve . java : 212 )
at or g . apache . catalina . core . StandardHostValve . invoke ( StandardHostValve . java : 134 )
at or g . apache . catalina . val ves . ErrorReportValve . invoke ( ErrorReportValve . java : 105 )
at or g . apache . catalina . core . StandardEngineValve . invoke ( StandardEngineValve . java : 107 )
at or g . apache . catalina . connector . CoyoteAdapter . service ( CoyoteAdapter . java : 148 )
at or g . apache . coyote . http11 . Http11Processor . process ( Http11Processor . java : 869 )
at or g . apache . coyote . http11 . Http11BaseProtocol$Http11ConnectionHandler . processConnection ( Http11BaseProtocol . java : 664 )
at or g . apache . to mcat . util . net . PoolTcpEndpoint . processSocket ( PoolTcpEndpoint . java : 527 )
at or g . apache . to mcat . util . net . LeaderFollowerWorkerThread . run It ( LeaderFollowerWorkerThread . java : 80 )
at or g . apache . to mcat . util . threads . ThreadPool$ Cont rolRunnable . run ( ThreadPool . java : 684 )
at java . lang . Thread . run ( Thread . java : 595 )
Rafa_Abe 23 de out. de 2006
não faltou dar o retorno do método?
a String de sucesso ou falha usada nas regras de navegação
robson_vs 24 de out. de 2006
Deu certo era a extenção do arquivo mesmo valeu a todos aprendi mais uma muito boa i importânte agora vakleu mesmo;