pessoal,
Ainda estou com dificuldades em mandar dados entre managed beans. Todos os managed beans estão com escopo de request.
Minha aplicação "começa" com a seguinte (trecho de) página:<ui:define name="core">
<h:inputHidden value="#{anamanNewStudyMB.idRegister}" />
<rich:panelBar>
<a4j:form>
<rich:column>
<rich:panel rendered="true">
<a4j:commandButton value="Selecionar classificação"
action="#{anamanNewStudyMB.selectRegister}" />
</rich:panel>
// outros <rich:panel /> com que são renderizados na seqüência de operação do sistema.
</rich:column>
</a4j:form>
</rich:panelBar>
</ui:define>
O
O problema está no momento de retornar o valor que foi selecionado corretamente na página que é acessada pelo botão "Selecionar classificação". Estou tentando mandar o valor do idRegister que preciso assim:
public void returnIdRegister() {
rIL = ars.getRegisterIdListByDesc(selectedRefDesc);
System.out.println("selectedRefDesc: " + selectedRefDesc);
for (AnamanRegister reg : rIL) {
int idReg = reg.getIdRegister();
if(rIL.size() == 1 && idReg != 0) {
System.out.println("send idReg: " + idReg);
anamanNewStudyMB.setIdRegister(idReg);
}
}
}
<a4j:commandButton
value="#{bundle['anamanButton.submit']}"
type="submit"
action="#{anamanRegisterMB.returnIdRegister}" />
selectedRefDesc: Aparelho de Anestesia
send idReg: 8
16/11/2009 18:26:33 com.sun.faces.application.ActionListenerImpl processAction
SEVERE: java.lang.NullPointerException
javax.faces.el.EvaluationException: java.lang.NullPointerException
at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:102)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
at javax.faces.component.UICommand.broadcast(UICommand.java:387)
at org.ajax4jsf.component.AjaxActionComponent.broadcast(AjaxActionComponent.java:55)
at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:324)
at org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:299)
at org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:256)
// continua ...
Caused by: java.lang.NullPointerException
at anaman.mb.AnamanRegisterMB.returnIdRegister(AnamanRegisterMB.java:481)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
// continua ...
at java.lang.Thread.run(Thread.java:619)
Caused by: javax.faces.el.EvaluationException: java.lang.NullPointerException
at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:102)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
... 28 more
Caused by: java.lang.NullPointerException
at anaman.mb.AnamanRegisterMB.returnIdRegister(AnamanRegisterMB.java:481)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
// continua ...
SEVERE: Servlet.service() for servlet Faces Servlet threw exception
java.lang.NullPointerException
at anaman.mb.AnamanRegisterMB.returnIdRegister(AnamanRegisterMB.java:481)
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:597)
at org.apache.el.parser.AstValue.invoke(AstValue.java:172)
Então, eu sei que o problema é no método returnIdRegister(),mas não sei o que é...
Obrigado desde já!
Gustavo