Rodrigo_Sasaki 9 de mai. de 2012
posta seu método remover()
lymoreira 9 de mai. de 2012
veja se está claro para entender.
public void remover ( ActionEvent ev ) throws IOException {
try {
faqBean . remove ( faqTO );
setMensagem ( MENSAGEM . getProperty ( "MA044" ));
} catch ( IOException e ){
setMensagem ( e );
}
}
public void remove ( FaqTO to ) throws IOException {
Ipptb006Faq entity = setFaq ( to );
em . getTransaction (). begin ();
em . remove ( em . find ( Ipptb006Faq . class , entity . getId ()));
em . getTransaction (). commit ();
}
private Ipptb006Faq setFaq ( FaqTO to ) throws IOException {
Ipptb006FaqPK FaqPK = new Ipptb006FaqPK ();
Ipptb006Faq Faq = new Ipptb006Faq ();
if ( to . getNuFaq () != null && ! to . getNuFaq (). equals ( 0 )) {
FaqPK . setNuFaq ( to . getNuFaq ());
FaqPK . setIcCcaUl ( to . getIcCcaUl ());
} else {
Query query = em . createNativeQuery ( "select nextval from nextval('IPPSQ006_FAQ_NU_FAQ_seq')" );
Integer numero = new Integer ( String . valueOf ( query . getSingleResult ()));
FaqPK . setNuFaq ( numero );
FaqPK . setIcCcaUl ( to . getIcCcaUl ());
}
Faq . setId ( FaqPK );
Faq . setDePergunta ( to . getDePergunta ());
Faq . setDeResposta ( to . getDeResposta ());
return Faq ;
}
Rodrigo_Sasaki 9 de mai. de 2012
fazer <f:setPropertyActionListener
target="#{faqMB.faqTO.nuFaq}"
value="#{item.nuFaq}" />não funciona?
esse valor realmente não está nulo ?
lymoreira 9 de mai. de 2012
então eu tentei das duas maneiras ele não ta setando nada, vem nulo tambem
Rodrigo_Sasaki 9 de mai. de 2012
Tente colocar seu método no action ao invés de actionListener ,
e tire o ActionEvent que ele recebe.
lymoreira 9 de mai. de 2012
então tentei fazer isso agora ele me mando uma mensagem de erro assim:
Caused by : java . lang . NullPointerException
at org . gatein . pc . portlet . impl . jsr168 . api . PortletSessionImpl . isValid ( PortletSessionImpl . java : 230 )
at org . gatein . pc . portlet . impl . jsr168 . api . PortletRequestImpl . getPortletSession ( PortletRequestImpl . java : 419 )
at org . jboss . portletbridge . context . PortletExternalContextImpl . getSessionAttribute ( PortletExternalContextImpl . java : 279 )
at org . jboss . portletbridge . context . PortletExternalContextImpl . getSessionAttribute ( PortletExternalContextImpl . java : 270 )
at org . jboss . portletbridge . context . AbstractExternalContext $ 4. getAttribute ( AbstractExternalContext . java : 364 )
at org . jboss . portletbridge . context . ContextAttributesMap . put ( ContextAttributesMap . java : 56 )
at org . jboss . portletbridge . context . ContextAttributesMap . put ( ContextAttributesMap . java : 32 )
at org . jboss . portletbridge . RequestScopeManager . saveRequestScope ( RequestScopeManager . java : 142 )
at org . jboss . portletbridge . AjaxPortletBridge . doFacesRequest ( AjaxPortletBridge . java : 647 )
at javax . portlet . faces . GenericFacesPortlet . doFacesDispatch ( GenericFacesPortlet . java : 628 )
at javax . portlet . faces . GenericFacesPortlet . doView ( GenericFacesPortlet . java : 518 )
at javax . portlet . GenericPortlet . doDispatch ( GenericPortlet . java : 354 )
at javax . portlet . faces . GenericFacesPortlet . doDispatch ( GenericFacesPortlet . java : 489 )
at javax . portlet . GenericPortlet . render ( GenericPortlet . java : 259 )
at org . gatein . pc . portlet . impl . jsr168 . PortletContainerImpl $ Invoker . doFilter ( PortletContainerImpl . java : 569 )
at org . gatein . pc . portlet . impl . jsr168 . api . FilterChainImpl . doFilter ( FilterChainImpl . java : 159 )
at org . gatein . pc . portlet . impl . jsr168 . api . FilterChainImpl . doFilter ( FilterChainImpl . java : 80 )
at org . gatein . pc . portlet . impl . jsr168 . PortletContainerImpl . dispatch ( PortletContainerImpl . java : 506 )
at org . gatein . pc . portlet . container . ContainerPortletDispatcher . invoke ( ContainerPortletDispatcher . java : 42 )
at org . gatein . pc . portlet . PortletInvokerInterceptor . invoke ( PortletInvokerInterceptor . java : 89 )
at org . gatein . pc . portlet . aspects . EventPayloadInterceptor . invoke ( EventPayloadInterceptor . java : 197 )
at org . gatein . pc . portlet . PortletInvokerInterceptor . invoke ( PortletInvokerInterceptor . java : 89 )
at org . gatein . wsrp . payload . WSRPEventPayloadInterceptor . invoke ( WSRPEventPayloadInterceptor . java : 153 )
at org . gatein . pc . portlet . PortletInvokerInterceptor . invoke ( PortletInvokerInterceptor . java : 89 )
at org . gatein . pc . portlet . aspects . RequestAttributeConversationInterceptor . invoke ( RequestAttributeConversationInterceptor . java : 119 )
at org . gatein . pc . portlet . PortletInvokerInterceptor . invoke ( PortletInvokerInterceptor . java : 89 )
at org . gatein . pc . portlet . aspects . CCPPInterceptor . invoke ( CCPPInterceptor . java : 65 )
at org . gatein . pc . portlet . PortletInvokerInterceptor . invoke ( PortletInvokerInterceptor . java : 89 )
at org . gatein . pc . bridge . BridgeInterceptor . invoke ( BridgeInterceptor . java : 49 )
at org . gatein . pc . portlet . PortletInvokerInterceptor . invoke ( PortletInvokerInterceptor . java : 89 )
at org . gatein . pc . portlet . PortletInvokerInterceptor . invoke ( PortletInvokerInterceptor . java : 89 )
at org . gatein . pc . portlet . aspects . SessionInvalidatorInterceptor . invoke ( SessionInvalidatorInterceptor . java : 55 )
at org . gatein . pc . portlet . PortletInvokerInterceptor . invoke ( PortletInvokerInterceptor . java : 89 )
at org . gatein . pc . portlet . aspects . ContextDispatcherInterceptor . access $ 001 ( ContextDispatcherInterceptor . java : 49 )
at org . gatein . pc . portlet . aspects . ContextDispatcherInterceptor $ 1. doCallback ( ContextDispatcherInterceptor . java : 123 )
at org . gatein . wci . command . CommandDispatcher $ CallbackCommand . execute ( CommandDispatcher . java : 82 )
at sun . reflect . GeneratedMethodAccessor978 . invoke ( Unknown Source )
at sun . reflect . DelegatingMethodAccessorImpl . invoke ( DelegatingMethodAccessorImpl . java : 25 )
at java . lang . reflect . Method . invoke ( Method . java : 597 )
at org . gatein . wci . command . CommandServlet . doGet ( CommandServlet . java : 135 )
at javax . servlet . http . HttpServlet . service ( HttpServlet . java : 617 )
at javax . servlet . http . HttpServlet . service ( HttpServlet . java : 717 )
at org . apache . catalina . core . ApplicationFilterChain . internalDoFilter ( ApplicationFilterChain . java : 290 )
at org . apache . catalina . core . ApplicationFilterChain . doFilter ( ApplicationFilterChain . java : 206 )
at org . apache . catalina . core . ApplicationDispatcher . invoke ( ApplicationDispatcher . java : 638 )
at org . apache . catalina . core . ApplicationDispatcher . doInclude ( ApplicationDispatcher . java : 543 )
at org . apache . catalina . core . ApplicationDispatcher . include ( ApplicationDispatcher . java : 480 )
at org . gatein . wci . command . CommandServlet . include ( CommandServlet . java : 84 )
at org . gatein . wci . command . CommandDispatcher . include ( CommandDispatcher . java : 58 )
at org . gatein . wci . tomcat . TC6ServletContainerContext . include ( TC6ServletContainerContext . java : 87 )
at org . gatein . wci . impl . DefaultServletContainer . include ( DefaultServletContainer . java : 198 )
at org . gatein . pc . portlet . impl . spi . AbstractServerContext . dispatch ( AbstractServerContext . java : 69 )
at org . gatein . pc . portlet . aspects . ContextDispatcherInterceptor . invoke ( ContextDispatcherInterceptor . java : 77 )
at org . gatein . pc . portlet . PortletInvokerInterceptor . invoke ( PortletInvokerInterceptor . java : 89 )
at org . gatein . pc . portlet . aspects . SecureTransportInterceptor . invoke ( SecureTransportInterceptor . java : 69 )
at org . gatein . pc . portlet . PortletInvokerInterceptor . invoke ( PortletInvokerInterceptor . java : 89 )
at org . gatein . pc . portlet . aspects . ValveInterceptor . invoke ( ValveInterceptor . java : 75 )
at org . gatein . pc . portlet . PortletInvokerInterceptor . invoke ( PortletInvokerInterceptor . java : 89 )
at org . gatein . pc . portlet . container . ContainerPortletInvoker . invoke ( ContainerPortletInvoker . java : 117 )
at org . gatein . pc . portlet . PortletInvokerInterceptor . invoke ( PortletInvokerInterceptor . java : 89 )
at org . gatein . pc . portlet . state . producer . ProducerPortletInvoker . invoke ( ProducerPortletInvoker . java : 231 )
at org . gatein . pc . federation . impl . FederatedPortletInvokerService . invoke ( FederatedPortletInvokerService . java : 151 )
at org . gatein . pc . federation . impl . FederatingPortletInvokerService . invoke ( FederatingPortletInvokerService . java : 211 )
at org . gatein . pc . portlet . PortletInvokerInterceptor . invoke ( PortletInvokerInterceptor . java : 89 )
at org . gatein . pc . portlet . aspects . PortletCustomizationInterceptor . invoke ( PortletCustomizationInterceptor . java : 76 )
at org . gatein . pc . portlet . PortletInvokerInterceptor . invoke ( PortletInvokerInterceptor . java : 89 )
at org . gatein . pc . portlet . aspects . ConsumerCacheInterceptor . invoke ( ConsumerCacheInterceptor . java : 162 )
at org . gatein . pc . portlet . PortletInvokerInterceptor . invoke ( PortletInvokerInterceptor . java : 89 )
at org . exoplatform . portal . webui . application . UIPortlet . invoke ( UIPortlet . java : 1039 )
at org . exoplatform . portal . webui . application . UIPortletLifecycle . processRender ( UIPortletLifecycle . java : 203 )
... 216 more
Rodrigo_Sasaki 9 de mai. de 2012
é, não entendo nada de Portlets hehehe…
mas eu uso dessa maneira que te disse, um <f:setPropertyActionListener> dentro de um a4j:commandButton
a única coisa que imagino é que esse atributo que você está enviando pode realmente estar nulo.
ou o atributo para o qual você está enviando. Vale a pena dar uma conferida.
mas vou deixar alguém que entende melhor te ajudar
PhilipeSC 9 de mai. de 2012
<a4j:keepAlive ajaxOnly=“false” beanName=“NomeDoObjeto” />
tenta por o KeepAlive, e verifica se seu objeto no managed bean está setado como request, se for é isso. e poe no seu botao do a4j o atributo AJAXSINGLE=FALSE