Hebert_Coelho 16 de jan. de 2013
Você ta falando que o método vai retornar String: List<String> getReqs
Mas tenta acessar o cara como se fosse objeto:<h:dataTable value="#{requisicaoBean.reqs}" var="req"
Sério, e você nem ta acessando req… Ta bem bagunçado seu código…
tiago_ 16 de jan. de 2013
Hebert Coelho:
Você ta falando que o método vai retornar String: List<String> getReqs
Mas tenta acessar o cara como se fosse objeto:<h:dataTable value="#{requisicaoBean.reqs}" var="req"
Sério, e você nem ta acessando req… Ta bem bagunçado seu código…
Ok hebert… Como vc acessaria ele no dataTable ? Acessar como se fosse String.
Hebert_Coelho 16 de jan. de 2013
tiago__:
Hebert Coelho:
Você ta falando que o método vai retornar String: List<String> getReqs
Mas tenta acessar o cara como se fosse objeto:<h:dataTable value="#{requisicaoBean.reqs}" var="req"
Sério, e você nem ta acessando req… Ta bem bagunçado seu código…
Ok hebert… Como vc acessaria ele no dataTable ? Acessar como se fosse String.
Apenas com #{req}. <— é uma string, apenas um valor.
No seu código tem #{requisicao.codigo} #{requisicao.dataHora} e #{item.nome}
tiago_ 16 de jan. de 2013
Hebert Coelho:
tiago__:
Hebert Coelho:
Você ta falando que o método vai retornar String: List<String> getReqs
Mas tenta acessar o cara como se fosse objeto:<h:dataTable value="#{requisicaoBean.reqs}" var="req"
Sério, e você nem ta acessando req… Ta bem bagunçado seu código…
Ok hebert… Como vc acessaria ele no dataTable ? Acessar como se fosse String.
Apenas com #{req}. <— é uma string, apenas um valor.
No seu código tem #{requisicao.codigo} #{requisicao.dataHora} e #{item.nome}
Cara, entendi mais ou menos… Desculpa a ignorância. Vc poderia modificar o meu codigo da pagina p
eu visualizar melhor o q vc quer dizer ?
...
<h:dataTable value= "#{requisicaoBean.reqs}" var= "req" rules= "rows" cellpadding= "5" >
<f:facet name= "caption" >
<br />
</f:facet>
<f:facet name= "header" > Minhas Requisições </f:facet>
<f:facet name= "footer" > Final da listagem</f:facet>
<h:column>
<f:facet name= "header" > Código Req.</f:facet>
<h:outputText value= "#{requisicao.codigo}" />
</h:column>
<h:column>
<f:facet name= "header" > Data</f:facet>
#{requisicao.dataHora}
</h:column>
<h:column>
<f:facet name= "header" > Item</f:facet>
#{item.nome}
</h:column>
<h:column>
<f:facet name= "header" > Qntd. Solicitada</f:facet>
#{itemRequisicao.quantidadeSolicitada}
...
tiago_ 16 de jan. de 2013
com o #{req} ele retornou os objeto:
[Ljava.lang.Object;@5b9a82ee [Ljava.lang.Object;@5b9a82ee
[Ljava.lang.Object;@7d0a063d [Ljava.lang.Object;@7d0a063d
[Ljava.lang.Object;@1d1fceed [Ljava.lang.Object;@1d1fceed
[Ljava.lang.Object;@134a388b [Ljava.lang.Object;@134a388b
[Ljava.lang.Object;@6dc63791 [Ljava.lang.Object;@6dc63791
[Ljava.lang.Object;@706a48e4 [Ljava.lang.Object;@706a48e4
Entendi… Tenho q retornar String.
E agora ? O q fazer ?
rof20004 16 de jan. de 2013
[ Ljava . lang . Object ; @5 b9a82ee [ Ljava . lang . Object ; @5 b9a82ee
[ Ljava . lang . Object ; @7 d0a063d [ Ljava . lang . Object ; @7 d0a063d
[ Ljava . lang . Object ; @1 d1fceed [ Ljava . lang . Object ; @1 d1fceed
[ Ljava . lang . Object ; @134 a388b [ Ljava . lang . Object ; @134 a388b
[ Ljava . lang . Object ; @6 dc63791 [ Ljava . lang . Object ; @6 dc63791
[ Ljava . lang . Object ; @706 a48e4 [ Ljava . lang . Object ; @706 a48e4
Sobreescreva os metodos HashCode e Equals na sua classe Requisicao ( a sua entity)
tiago_ 17 de jan. de 2013
rof20004:
[Ljava.lang.Object;@5b9a82ee [Ljava.lang.Object;@5b9a82ee
[Ljava.lang.Object;@7d0a063d [Ljava.lang.Object;@7d0a063d
[Ljava.lang.Object;@1d1fceed [Ljava.lang.Object;@1d1fceed
[Ljava.lang.Object;@134a388b [Ljava.lang.Object;@134a388b
[Ljava.lang.Object;@6dc63791 [Ljava.lang.Object;@6dc63791
[Ljava.lang.Object;@706a48e4 [Ljava.lang.Object;@706a48e4
Sobreescreva os metodos HashCode e Equals na sua classe Requisicao ( a sua entity)
Ja esta:
@Override
public int hashCode () {
final int prime = 31 ;
int result = 1 ;
result = prime * result + (( codigo == null ) ? 0 : codigo . hashCode ());
result = prime * result
+ (( dataHora == null ) ? 0 : dataHora . hashCode ());
result = prime * result + (( status == null ) ? 0 : status . hashCode ());
result = prime * result + (( usuario == null ) ? 0 : usuario . hashCode ());
result = prime
* result
+ (( usuarioLogadoSistema == null ) ? 0 : usuarioLogadoSistema
. hashCode ());
return result ;
}
@Override
public boolean equals ( Object obj ) {
if ( this == obj )
return true ;
if ( obj == null )
return false ;
if ( getClass () != obj . getClass ())
return false ;
Requisicao other = ( Requisicao ) obj ;
if ( codigo == null ) {
if ( other . codigo != null )
return false ;
} else if ( ! codigo . equals ( other . codigo ))
return false ;
if ( dataHora == null ) {
if ( other . dataHora != null )
return false ;
} else if ( ! dataHora . equals ( other . dataHora ))
return false ;
if ( status == null ) {
if ( other . status != null )
return false ;
} else if ( ! status . equals ( other . status ))
return false ;
if ( usuario == null ) {
if ( other . usuario != null )
return false ;
} else if ( ! usuario . equals ( other . usuario ))
return false ;
if ( usuarioLogadoSistema == null ) {
if ( other . usuarioLogadoSistema != null )
return false ;
} else if ( ! usuarioLogadoSistema . equals ( other . usuarioLogadoSistema ))
return false ;
return true ;
}
rof20004 17 de jan. de 2013
< h : outputText value = "#{requisicao.codigo}" />
onde tiver esse codigo, troque a palavra requisicao por req, faça esse teste por favor.
tiago_ 17 de jan. de 2013
rof20004:
<h:outputText value="#{requisicao.codigo}" />
onde tiver esse codigo, troque a palavra requisicao por req, faça esse teste por favor.
fiz o teste e deu erro:
/pages/restrito/nova_requisicao.xhtml @45 ,59 value="#{req.codigo}": Property ‘codigo’ not found on type java.lang.String
javax . el . PropertyNotFoundException : / pages / restrito / nova_requisicao . xhtml @45 , 59 value = "#{req.codigo}" : Property ‘ codigo ’ not found on type java . lang . String
at com . sun . faces . facelets . el . TagValueExpression . getValue ( TagValueExpression . java : 108 )
at javax . faces . component . ComponentStateHelper . eval ( ComponentStateHelper . java : 190 )
at javax . faces . component . ComponentStateHelper . eval ( ComponentStateHelper . java : 178 )
at javax . faces . component . UIOutput . getValue ( UIOutput . java : 164 )
at com . sun . faces . renderkit . html_basic . HtmlBasicInputRenderer . getValue ( HtmlBasicInputRenderer . java : 201 )
at com . sun . faces . renderkit . html_basic . HtmlBasicRenderer . getCurrentValue ( HtmlBasicRenderer . java : 351 )
at com . sun . faces . renderkit . html_basic . HtmlBasicRenderer . encodeEnd ( HtmlBasicRenderer . java : 160 )
at javax . faces . component . UIComponentBase . encodeEnd ( UIComponentBase . java : 879 )
at com . sun . faces . renderkit . html_basic . HtmlBasicRenderer . encodeRecursive ( HtmlBasicRenderer . java : 308 )
at com . sun . faces . renderkit . html_basic . TableRenderer . renderRow ( TableRenderer . java : 376 )
at com . sun . faces . renderkit . html_basic . TableRenderer . encodeChildren ( TableRenderer . java : 157 )
at javax . faces . component . UIComponentBase . encodeChildren ( UIComponentBase . java : 849 )
at javax . faces . component . UIComponent . encodeAll ( UIComponent . java : 1643 )
at javax . faces . render . Renderer . encodeChildren ( Renderer . java : 164 )
at javax . faces . component . UIComponentBase . encodeChildren ( UIComponentBase . java : 849 )
at javax . faces . component . UIComponent . encodeAll ( UIComponent . java : 1643 )
at javax . faces . component . UIComponent . encodeAll ( UIComponent . java : 1646 )
at javax . faces . component . UIComponent . encodeAll ( UIComponent . java : 1646 )
at com . sun . faces . application . view . FaceletViewHandlingStrategy . renderView ( FaceletViewHandlingStrategy . java : 389 )
at com . sun . faces . application . view . MultiViewHandler . renderView ( MultiViewHandler . java : 127 )
at com . sun . faces . lifecycle . RenderResponsePhase . execute ( RenderResponsePhase . java : 117 )
at com . sun . faces . lifecycle . Phase . doPhase ( Phase . java : 97 )
at com . sun . faces . lifecycle . LifecycleImpl . render ( LifecycleImpl . java : 135 )
at javax . faces . webapp . FacesServlet . service ( FacesServlet . java : 311 )
at org . apache . catalina . core . ApplicationFilterChain . internalDoFilter ( ApplicationFilterChain . java : 305 )
at org . apache . catalina . core . ApplicationFilterChain . doFilter ( ApplicationFilterChain . java : 210 )
at requisicao . web . filter . ConexaoHibernateFilter . doFilter ( ConexaoHibernateFilter . java : 32 )
at org . apache . catalina . core . ApplicationFilterChain . internalDoFilter ( ApplicationFilterChain . java : 243 )
at org . apache . catalina . core . ApplicationFilterChain . doFilter ( ApplicationFilterChain . java : 210 )
at org . springframework . security . web . FilterChainProxy$VirtualFilterChain . doFilter ( FilterChainProxy . java : 344 )
at org . springframework . security . web . access . intercept . FilterSecurityInterceptor . invoke ( FilterSecurityInterceptor . java : 110 )
at org . springframework . security . web . access . intercept . FilterSecurityInterceptor . doFilter ( FilterSecurityInterceptor . java : 84 )
at org . springframework . security . web . FilterChainProxy$VirtualFilterChain . doFilter ( FilterChainProxy . java : 356 )
at org . springframework . security . web . access . ExceptionTranslationFilter . doFilter ( ExceptionTranslationFilter . java : 98 )
at org . springframework . security . web . FilterChainProxy$VirtualFilterChain . doFilter ( FilterChainProxy . java : 356 )
at org . springframework . security . web . session . SessionManagementFilter . doFilter ( SessionManagementFilter . java : 95 )
at org . springframework . security . web . FilterChainProxy$VirtualFilterChain . doFilter ( FilterChainProxy . java : 356 )
at org . springframework . security . web . authentication . AnonymousAuthenticationFilter . doFilter ( AnonymousAuthenticationFilter . java : 79 )
at org . springframework . security . web . FilterChainProxy$VirtualFilterChain . doFilter ( FilterChainProxy . java : 356 )
at org . springframework . security . web . servletapi . SecurityContextHolderAwareRequestFilter . doFilter ( SecurityContextHolderAwareRequestFilter . java : 55 )
at org . springframework . security . web . FilterChainProxy$VirtualFilterChain . doFilter ( FilterChainProxy . java : 356 )
at org . springframework . security . web . savedrequest . RequestCacheAwareFilter . doFilter ( RequestCacheAwareFilter . java : 36 )
at org . springframework . security . web . FilterChainProxy$VirtualFilterChain . doFilter ( FilterChainProxy . java : 356 )
at org . springframework . security . web . authentication . AbstractAuthenticationProcessingFilter . doFilter ( AbstractAuthenticationProcessingFilter . java : 188 )
at org . springframework . security . web . FilterChainProxy$VirtualFilterChain . doFilter ( FilterChainProxy . java : 356 )
at org . springframework . security . web . authentication . logout . LogoutFilter . doFilter ( LogoutFilter . java : 106 )
at org . springframework . security . web . FilterChainProxy$VirtualFilterChain . doFilter ( FilterChainProxy . java : 356 )
at org . springframework . security . web . context . SecurityContextPersistenceFilter . doFilter ( SecurityContextPersistenceFilter . java : 80 )
at org . springframework . security . web . FilterChainProxy$VirtualFilterChain . doFilter ( FilterChainProxy . java : 356 )
at org . springframework . security . web . FilterChainProxy . doFilter ( FilterChainProxy . java : 150 )
at org . springframework . web . filter . DelegatingFilterProxy . invokeDelegate ( DelegatingFilterProxy . java : 237 )
at org . springframework . web . filter . DelegatingFilterProxy . doFilter ( DelegatingFilterProxy . java : 167 )
at org . apache . catalina . core . ApplicationFilterChain . internalDoFilter ( ApplicationFilterChain . java : 243 )
at org . apache . catalina . core . ApplicationFilterChain . doFilter ( ApplicationFilterChain . java : 210 )
at org . apache . catalina . core . StandardWrapperValve . invoke ( StandardWrapperValve . java : 225 )
at org . apache . catalina . core . StandardContextValve . invoke ( StandardContextValve . java : 123 )
at org . apache . catalina . authenticator . AuthenticatorBase . invoke ( AuthenticatorBase . java : 472 )
at org . apache . catalina . core . StandardHostValve . invoke ( StandardHostValve . java : 168 )
at org . apache . catalina . valves . ErrorReportValve . invoke ( ErrorReportValve . java : 98 )
at org . apache . catalina . valves . AccessLogValve . invoke ( AccessLogValve . java : 927 )
at org . apache . catalina . core . StandardEngineValve . invoke ( StandardEngineValve . java : 118 )
at org . apache . catalina . connector . CoyoteAdapter . service ( CoyoteAdapter . java : 407 )
at org . apache . coyote . http11 . AbstractHttp11Processor . process ( AbstractHttp11Processor . java : 1001 )
at org . apache . coyote . AbstractProtocol$AbstractConnectionHandler . process ( AbstractProtocol . java : 585 )
at org . apache . tomcat . util . net . JIoEndpoint$SocketProcessor . run ( JIoEndpoint . java : 312 )
at java . util . concurrent . ThreadPoolExecutor$Worker . runTask ( ThreadPoolExecutor . java : 886 )
at java . util . concurrent . ThreadPoolExecutor$Worker . run ( ThreadPoolExecutor . java : 908 )
at java . lang . Thread . run ( Thread . java : 662 )
Hebert_Coelho 17 de jan. de 2013
Cara, isso não vai funcionar enquanto sua lista estiver retornando String. Você tem que retornar uma lista de objeto requisição.
Esse post mostra como fazer um dataTable com objetos: Aplicação Web Completa Tomcat JSF Primefaces JPA Hibernate
Novamente, você está querendo fazr um dataTable em cima de String. Isso não vai funcinoar…
tiago_ 17 de jan. de 2013
Cara, isso não vai funcionar enquanto sua lista estiver retornando String. Você tem que retornar uma lista de objeto requisição.
Esse post mostra como fazer um dataTable com objetos: Aplicação Web Completa Tomcat JSF Primefaces JPA Hibernate
Novamente, você está querendo fazr um dataTable em cima de String. Isso não vai funcinoar…
Entendi… Entao eu tenho q fazer um List do tipo Requisicao. E nao do tipo String.
Vou modificar aqui e depois eu posto. So n sei pq vc n me flw isso antes… rs
rof20004 17 de jan. de 2013
Eita, nem vi que tava retornando string, malz… boa sorte.
tiago_ 18 de jan. de 2013
Cara, isso não vai funcionar enquanto sua lista estiver retornando String. Você tem que retornar uma lista de objeto requisição.
Esse post mostra como fazer um dataTable com objetos: Aplicação Web Completa Tomcat JSF Primefaces JPA Hibernate
Novamente, você está querendo fazr um dataTable em cima de String. Isso não vai funcinoar…
Hebert, mudei o codigo:
public List < Requisicao > listarTodasRequisicoesUsuario ( String login ) {
String hql = "select u.nome, r.dataHora, ir.quantidadeSolicitada, i.nome from ItemRequisicao ir inner join " +
"ir.item as i inner join ir.requisicao as r inner " +
"join r.usuario as u where u.login = :login" ;
Query consulta = this .session .createQuery ( hql ) ;
consulta .setString ( "login" , contextoBean .getUsuarioLogado () .getLogin ()) ;
return consulta .list () ;
}
public List < Requisicao > getReqs () {
RequisicaoRN requisicaoRN = new RequisicaoRN ();
String login = contextoBean . getUsuarioLogado (). getLogin ();
this . reqs = requisicaoRN . listarTodasRequisicoesUsuario ( login );
return this . reqs ;
}
...
<h:dataTable value= "#{requisicaoBean.reqs}" var= "req" rules= "rows" cellpadding= "5" >
<f:facet name= "caption" >
<br />
</f:facet>
<f:facet name= "header" > Minhas Requisições </f:facet>
<f:facet name= "footer" > Final da listagem</f:facet>
<h:column>
<f:facet name= "header" > Usuario</f:facet>
<h:outputText value= "#{req.usuario}" />
</h:column>
<h:column>
<f:facet name= "header" > Data</f:facet>
#{req.dataHora}
</h:column>
<h:column>
<f:facet name= "header" > Item</f:facet>
#{req.nome}
</h:column>
<h:column>
<f:facet name= "header" > Qntd. Solicitada</f:facet>
#{req.quantidadeSolicitada}
</h:column>
</h:dataTable>
...
Ta dando esse erro:
For input string: “usuario”
java . lang . NumberFormatException : For input string : “ usuario ”
at java . lang . NumberFormatException . forInputString ( NumberFormatException . java : 48 )
at java . lang . Integer . parseInt ( Integer . java : 449 )
at java . lang . Integer . parseInt ( Integer . java : 499 )
at javax . el . ArrayELResolver . coerce ( ArrayELResolver . java : 166 )
at javax . el . ArrayELResolver . getValue ( ArrayELResolver . java : 46 )
at javax . el . CompositeELResolver . getValue ( CompositeELResolver . java : 67 )
at com . sun . faces . el . FacesCompositeELResolver . getValue ( FacesCompositeELResolver . java : 71 )
at com . sun . el . parser . AstValue . getValue ( AstValue . java : 116 )
at com . sun . el . parser . AstValue . getValue ( AstValue . java : 163 )
at com . sun . el . ValueExpressionImpl . getValue ( ValueExpressionImpl . java : 219 )
at com . sun . faces . facelets . el . TagValueExpression . getValue ( TagValueExpression . java : 106 )
at javax . faces . component . ComponentStateHelper . eval ( ComponentStateHelper . java : 190 )
at javax . faces . component . ComponentStateHelper . eval ( ComponentStateHelper . java : 178 )
at javax . faces . component . UIOutput . getValue ( UIOutput . java : 164 )
at com . sun . faces . renderkit . html_basic . HtmlBasicInputRenderer . getValue ( HtmlBasicInputRenderer . java : 201 )
at com . sun . faces . renderkit . html_basic . HtmlBasicRenderer . getCurrentValue ( HtmlBasicRenderer . java : 351 )
at com . sun . faces . renderkit . html_basic . HtmlBasicRenderer . encodeEnd ( HtmlBasicRenderer . java : 160 )
at javax . faces . component . UIComponentBase . encodeEnd ( UIComponentBase . java : 879 )
at com . sun . faces . renderkit . html_basic . HtmlBasicRenderer . encodeRecursive ( HtmlBasicRenderer . java : 308 )
at com . sun . faces . renderkit . html_basic . TableRenderer . renderRow ( TableRenderer . java : 376 )
at com . sun . faces . renderkit . html_basic . TableRenderer . encodeChildren ( TableRenderer . java : 157 )
at javax . faces . component . UIComponentBase . encodeChildren ( UIComponentBase . java : 849 )
at javax . faces . component . UIComponent . encodeAll ( UIComponent . java : 1643 )
at javax . faces . render . Renderer . encodeChildren ( Renderer . java : 164 )
at javax . faces . component . UIComponentBase . encodeChildren ( UIComponentBase . java : 849 )
at javax . faces . component . UIComponent . encodeAll ( UIComponent . java : 1643 )
at javax . faces . component . UIComponent . encodeAll ( UIComponent . java : 1646 )
at javax . faces . component . UIComponent . encodeAll ( UIComponent . java : 1646 )
at com . sun . faces . application . view . FaceletViewHandlingStrategy . renderView ( FaceletViewHandlingStrategy . java : 389 )
at com . sun . faces . application . view . MultiViewHandler . renderView ( MultiViewHandler . java : 127 )
at com . sun . faces . lifecycle . RenderResponsePhase . execute ( RenderResponsePhase . java : 117 )
at com . sun . faces . lifecycle . Phase . doPhase ( Phase . java : 97 )
at com . sun . faces . lifecycle . LifecycleImpl . render ( LifecycleImpl . java : 135 )
at javax . faces . webapp . FacesServlet . service ( FacesServlet . java : 311 )
at org . apache . catalina . core . ApplicationFilterChain . internalDoFilter ( ApplicationFilterChain . java : 305 )
at org . apache . catalina . core . ApplicationFilterChain . doFilter ( ApplicationFilterChain . java : 210 )
at requisicao . web . filter . ConexaoHibernateFilter . doFilter ( ConexaoHibernateFilter . java : 32 )
at org . apache . catalina . core . ApplicationFilterChain . internalDoFilter ( ApplicationFilterChain . java : 243 )
at org . apache . catalina . core . ApplicationFilterChain . doFilter ( ApplicationFilterChain . java : 210 )
at org . springframework . security . web . FilterChainProxy$VirtualFilterChain . doFilter ( FilterChainProxy . java : 344 )
at org . springframework . security . web . access . intercept . FilterSecurityInterceptor . invoke ( FilterSecurityInterceptor . java : 110 )
at org . springframework . security . web . access . intercept . FilterSecurityInterceptor . doFilter ( FilterSecurityInterceptor . java : 84 )
at org . springframework . security . web . FilterChainProxy$VirtualFilterChain . doFilter ( FilterChainProxy . java : 356 )
at org . springframework . security . web . access . ExceptionTranslationFilter . doFilter ( ExceptionTranslationFilter . java : 98 )
at org . springframework . security . web . FilterChainProxy$VirtualFilterChain . doFilter ( FilterChainProxy . java : 356 )
at org . springframework . security . web . session . SessionManagementFilter . doFilter ( SessionManagementFilter . java : 95 )
at org . springframework . security . web . FilterChainProxy$VirtualFilterChain . doFilter ( FilterChainProxy . java : 356 )
at org . springframework . security . web . authentication . AnonymousAuthenticationFilter . doFilter ( AnonymousAuthenticationFilter . java : 79 )
at org . springframework . security . web . FilterChainProxy$VirtualFilterChain . doFilter ( FilterChainProxy . java : 356 )
at org . springframework . security . web . servletapi . SecurityContextHolderAwareRequestFilter . doFilter ( SecurityContextHolderAwareRequestFilter . java : 55 )
at org . springframework . security . web . FilterChainProxy$VirtualFilterChain . doFilter ( FilterChainProxy . java : 356 )
at org . springframework . security . web . savedrequest . RequestCacheAwareFilter . doFilter ( RequestCacheAwareFilter . java : 36 )
at org . springframework . security . web . FilterChainProxy$VirtualFilterChain . doFilter ( FilterChainProxy . java : 356 )
at org . springframework . security . web . authentication . AbstractAuthenticationProcessingFilter . doFilter ( AbstractAuthenticationProcessingFilter . java : 188 )
at org . springframework . security . web . FilterChainProxy$VirtualFilterChain . doFilter ( FilterChainProxy . java : 356 )
at org . springframework . security . web . authentication . logout . LogoutFilter . doFilter ( LogoutFilter . java : 106 )
at org . springframework . security . web . FilterChainProxy$VirtualFilterChain . doFilter ( FilterChainProxy . java : 356 )
at org . springframework . security . web . context . SecurityContextPersistenceFilter . doFilter ( SecurityContextPersistenceFilter . java : 80 )
at org . springframework . security . web . FilterChainProxy$VirtualFilterChain . doFilter ( FilterChainProxy . java : 356 )
at org . springframework . security . web . FilterChainProxy . doFilter ( FilterChainProxy . java : 150 )
at org . springframework . web . filter . DelegatingFilterProxy . invokeDelegate ( DelegatingFilterProxy . java : 237 )
at org . springframework . web . filter . DelegatingFilterProxy . doFilter ( DelegatingFilterProxy . java : 167 )
at org . apache . catalina . core . ApplicationFilterChain . internalDoFilter ( ApplicationFilterChain . java : 243 )
at org . apache . catalina . core . ApplicationFilterChain . doFilter ( ApplicationFilterChain . java : 210 )
at org . apache . catalina . core . StandardWrapperValve . invoke ( StandardWrapperValve . java : 225 )
at org . apache . catalina . core . StandardContextValve . invoke ( StandardContextValve . java : 123 )
at org . apache . catalina . authenticator . AuthenticatorBase . invoke ( AuthenticatorBase . java : 472 )
at org . apache . catalina . core . StandardHostValve . invoke ( StandardHostValve . java : 168 )
at org . apache . catalina . valves . ErrorReportValve . invoke ( ErrorReportValve . java : 98 )
at org . apache . catalina . valves . AccessLogValve . invoke ( AccessLogValve . java : 927 )
at org . apache . catalina . core . StandardEngineValve . invoke ( StandardEngineValve . java : 118 )
at org . apache . catalina . connector . CoyoteAdapter . service ( CoyoteAdapter . java : 407 )
at org . apache . coyote . http11 . AbstractHttp11Processor . process ( AbstractHttp11Processor . java : 1001 )
at org . apache . coyote . AbstractProtocol$AbstractConnectionHandler . process ( AbstractProtocol . java : 585 )
at org . apache . tomcat . util . net . JIoEndpoint$SocketProcessor . run ( JIoEndpoint . java : 310 )
at java . util . concurrent . ThreadPoolExecutor$Worker . runTask ( ThreadPoolExecutor . java : 886 )
at java . util . concurrent . ThreadPoolExecutor$Worker . run ( ThreadPoolExecutor . java : 908 )
at java . lang . Thread . run ( Thread . java : 662 )
rof20004 18 de jan. de 2013
Esse usuario (req.usuario) é o que ? String, numero ? O erro informa que esta passando uma string, quando precisa receber um numero.
tiago_ 21 de jan. de 2013
Entao cara… Eh string ! Mudei para: #{req.usuario.nome}. Nao ta dando erro, mas ta retornando assim:
http://s9.postimage.org/yo63ctl33/data_Table.png
tiago_ 22 de jan. de 2013
Hebert, mudei meu codigo. Um colega meu da faculdade ta tentando me ajudar, fizemos o seguinte:
Criamos essa classe:
public class NovaRequisicaoModel implements Serializable {
private static final long serialVersionUID = - 1625084105340262275L ;
private String nomeUsuario ;
private String dataHora ;
private int quantidadeSolicitada ;
private String nomeItem ;
...
}
@SuppressWarnings ( "unchecked" )
public List < NovaRequisicaoModel > listarTodasRequisicoesUsuario ( String login ) {
String hql = "select u.nome, r.dataHora, ir.quantidadeSolicitada, i.nome from ItemRequisicao ir inner join " +
"ir.item as i inner join ir.requisicao as r inner " +
"join r.usuario as u where u.login = :login" ;
Query consulta = this . session . createQuery ( hql );
consulta . setString ( "login" , contextoBean . getUsuarioLogado (). getLogin ());
return consulta . list ();
}
O Bean:
public List < NovaRequisicaoModel > getNovaRequisicaoModel () {
RequisicaoRN requisicaoRN = new RequisicaoRN ();
String login = contextoBean . getUsuarioLogado (). getLogin ();
novaRequisicaoModel = requisicaoRN . listarTodasRequisicoesUsuario ( login );
return novaRequisicaoModel ;
}
public void setNovaRequisicaoModel ( List < NovaRequisicaoModel > novaRequisicaoModel ) {
this . novaRequisicaoModel = novaRequisicaoModel ;
}
public void setReq ( String req ) {
this . req = req ;
}
public String getReq () {
return req ;
}
pagina:
...
<h:dataTable value= "#{requisicaoBean.novaRequisicaoModel}" var= "req" rules= "rows" cellpadding= "5" paginator= "true" dynamic= "true" >
<f:facet name= "caption" >
<br />
</f:facet>
<f:facet name= "header" > Minhas Requisições </f:facet>
<f:facet name= "footer" > Final da listagem</f:facet>
<h:column>
<f:facet name= "header" > Usuario</f:facet>
<h:outputText value= "#{req.nomeUsuario}" />
</h:column>
<h:column>
<f:facet name= "header" > Data</f:facet>
#{req.dataHora}
</h:column>
<h:column>
<f:facet name= "header" > Item</f:facet>
#{req.nomeItem}
</h:column>
<h:column>
<f:facet name= "header" > Qntd. Solicitada</f:facet>
#{req.quantidadeSolicitada}
</h:column>
</h:dataTable>
</h:form>
</ui:define>
</ui:composition>
</html>
E o erro:
:oops:
For input string: “nomeUsuario”
java . lang . NumberFormatException : For input string : “ nomeUsuario ”
at java . lang . NumberFormatException . forInputString ( NumberFormatException . java : 48 )
at java . lang . Integer . parseInt ( Integer . java : 449 )
at java . lang . Integer . parseInt ( Integer . java : 499 )
at javax . el . ArrayELResolver . coerce ( ArrayELResolver . java : 166 )
at javax . el . ArrayELResolver . getValue ( ArrayELResolver . java : 46 )
at javax . el . CompositeELResolver . getValue ( CompositeELResolver . java : 67 )
at com . sun . faces . el . FacesCompositeELResolver . getValue ( FacesCompositeELResolver . java : 71 )
at com . sun . el . parser . AstValue . getValue ( AstValue . java : 116 )
at com . sun . el . parser . AstValue . getValue ( AstValue . java : 163 )
at com . sun . el . ValueExpressionImpl . getValue ( ValueExpressionImpl . java : 219 )
at com . sun . faces . facelets . el . TagValueExpression . getValue ( TagValueExpression . java : 106 )
at javax . faces . component . ComponentStateHelper . eval ( ComponentStateHelper . java : 190 )
at javax . faces . component . ComponentStateHelper . eval ( ComponentStateHelper . java : 178 )
at javax . faces . component . UIOutput . getValue ( UIOutput . java : 164 )
at com . sun . faces . renderkit . html_basic . HtmlBasicInputRenderer . getValue ( HtmlBasicInputRenderer . java : 201 )
at com . sun . faces . renderkit . html_basic . HtmlBasicRenderer . getCurrentValue ( HtmlBasicRenderer . java : 351 )
at com . sun . faces . renderkit . html_basic . HtmlBasicRenderer . encodeEnd ( HtmlBasicRenderer . java : 160 )
at javax . faces . component . UIComponentBase . encodeEnd ( UIComponentBase . java : 879 )
at com . sun . faces . renderkit . html_basic . HtmlBasicRenderer . encodeRecursive ( HtmlBasicRenderer . java : 308 )
at com . sun . faces . renderkit . html_basic . TableRenderer . renderRow ( TableRenderer . java : 376 )
at com . sun . faces . renderkit . html_basic . TableRenderer . encodeChildren ( TableRenderer . java : 157 )
at javax . faces . component . UIComponentBase . encodeChildren ( UIComponentBase . java : 849 )
at javax . faces . component . UIComponent . encodeAll ( UIComponent . java : 1643 )
at javax . faces . render . Renderer . encodeChildren ( Renderer . java : 164 )
at javax . faces . component . UIComponentBase . encodeChildren ( UIComponentBase . java : 849 )
at javax . faces . component . UIComponent . encodeAll ( UIComponent . java : 1643 )
at javax . faces . component . UIComponent . encodeAll ( UIComponent . java : 1646 )
at javax . faces . component . UIComponent . encodeAll ( UIComponent . java : 1646 )
at com . sun . faces . application . view . FaceletViewHandlingStrategy . renderView ( FaceletViewHandlingStrategy . java : 389 )
at com . sun . faces . application . view . MultiViewHandler . renderView ( MultiViewHandler . java : 127 )
at com . sun . faces . lifecycle . RenderResponsePhase . execute ( RenderResponsePhase . java : 117 )
at com . sun . faces . lifecycle . Phase . doPhase ( Phase . java : 97 )
at com . sun . faces . lifecycle . LifecycleImpl . render ( LifecycleImpl . java : 135 )
at javax . faces . webapp . FacesServlet . service ( FacesServlet . java : 311 )
at org . apache . catalina . core . ApplicationFilterChain . internalDoFilter ( ApplicationFilterChain . java : 305 )
at org . apache . catalina . core . ApplicationFilterChain . doFilter ( ApplicationFilterChain . java : 210 )
at requisicao . web . filter . ConexaoHibernateFilter . doFilter ( ConexaoHibernateFilter . java : 32 )
at org . apache . catalina . core . ApplicationFilterChain . internalDoFilter ( ApplicationFilterChain . java : 243 )
at org . apache . catalina . core . ApplicationFilterChain . doFilter ( ApplicationFilterChain . java : 210 )
at org . springframework . security . web . FilterChainProxy$VirtualFilterChain . doFilter ( FilterChainProxy . java : 344 )
at org . springframework . security . web . access . intercept . FilterSecurityInterceptor . invoke ( FilterSecurityInterceptor . java : 110 )
at org . springframework . security . web . access . intercept . FilterSecurityInterceptor . doFilter ( FilterSecurityInterceptor . java : 84 )
at org . springframework . security . web . FilterChainProxy$VirtualFilterChain . doFilter ( FilterChainProxy . java : 356 )
at org . springframework . security . web . access . ExceptionTranslationFilter . doFilter ( ExceptionTranslationFilter . java : 98 )
at org . springframework . security . web . FilterChainProxy$VirtualFilterChain . doFilter ( FilterChainProxy . java : 356 )
at org . springframework . security . web . session . SessionManagementFilter . doFilter ( SessionManagementFilter . java : 95 )
at org . springframework . security . web . FilterChainProxy$VirtualFilterChain . doFilter ( FilterChainProxy . java : 356 )
at org . springframework . security . web . authentication . AnonymousAuthenticationFilter . doFilter ( AnonymousAuthenticationFilter . java : 79 )
at org . springframework . security . web . FilterChainProxy$VirtualFilterChain . doFilter ( FilterChainProxy . java : 356 )
at org . springframework . security . web . servletapi . SecurityContextHolderAwareRequestFilter . doFilter ( SecurityContextHolderAwareRequestFilter . java : 55 )
at org . springframework . security . web . FilterChainProxy$VirtualFilterChain . doFilter ( FilterChainProxy . java : 356 )
at org . springframework . security . web . savedrequest . RequestCacheAwareFilter . doFilter ( RequestCacheAwareFilter . java : 36 )
at org . springframework . security . web . FilterChainProxy$VirtualFilterChain . doFilter ( FilterChainProxy . java : 356 )
at org . springframework . security . web . authentication . AbstractAuthenticationProcessingFilter . doFilter ( AbstractAuthenticationProcessingFilter . java : 188 )
at org . springframework . security . web . FilterChainProxy$VirtualFilterChain . doFilter ( FilterChainProxy . java : 356 )
at org . springframework . security . web . authentication . logout . LogoutFilter . doFilter ( LogoutFilter . java : 106 )
at org . springframework . security . web . FilterChainProxy$VirtualFilterChain . doFilter ( FilterChainProxy . java : 356 )
at org . springframework . security . web . context . SecurityContextPersistenceFilter . doFilter ( SecurityContextPersistenceFilter . java : 80 )
at org . springframework . security . web . FilterChainProxy$VirtualFilterChain . doFilter ( FilterChainProxy . java : 356 )
at org . springframework . security . web . FilterChainProxy . doFilter ( FilterChainProxy . java : 150 )
at org . springframework . web . filter . DelegatingFilterProxy . invokeDelegate ( DelegatingFilterProxy . java : 237 )
at org . springframework . web . filter . DelegatingFilterProxy . doFilter ( DelegatingFilterProxy . java : 167 )
at org . apache . catalina . core . ApplicationFilterChain . internalDoFilter ( ApplicationFilterChain . java : 243 )
at org . apache . catalina . core . ApplicationFilterChain . doFilter ( ApplicationFilterChain . java : 210 )
at org . apache . catalina . core . StandardWrapperValve . invoke ( StandardWrapperValve . java : 225 )
at org . apache . catalina . core . StandardContextValve . invoke ( StandardContextValve . java : 123 )
at org . apache . catalina . authenticator . AuthenticatorBase . invoke ( AuthenticatorBase . java : 472 )
at org . apache . catalina . core . StandardHostValve . invoke ( StandardHostValve . java : 168 )
at org . apache . catalina . valves . ErrorReportValve . invoke ( ErrorReportValve . java : 98 )
at org . apache . catalina . valves . AccessLogValve . invoke ( AccessLogValve . java : 927 )
at org . apache . catalina . core . StandardEngineValve . invoke ( StandardEngineValve . java : 118 )
at org . apache . catalina . connector . CoyoteAdapter . service ( CoyoteAdapter . java : 407 )
at org . apache . coyote . http11 . AbstractHttp11Processor . process ( AbstractHttp11Processor . java : 1001 )
at org . apache . coyote . AbstractProtocol$AbstractConnectionHandler . process ( AbstractProtocol . java : 585 )
at org . apache . tomcat . util . net . JIoEndpoint$SocketProcessor . run ( JIoEndpoint . java : 312 )
at java . util . concurrent . ThreadPoolExecutor$Worker . runTask ( ThreadPoolExecutor . java : 886 )
at java . util . concurrent . ThreadPoolExecutor$Worker . run ( ThreadPoolExecutor . java : 908 )
at java . lang . Thread . run ( Thread . java : 662 )