Pessoal, venho novamente aqui pedir ajuda de vocês, pois estou criando componentes dinamicos, porem estou com problema no SelectOneMenu e SelectItem, é o seguinte tenho o seguinte metodo
ATRIBUTOS
private Class classePessoa;
private Pessoa pessoa;
private HtmlForm formulario;
private HtmlPanelGrid painel;
private HtmlPanelGrid painelPrincipal;
private List<String> pessoas;
private List<String> pessoasSelecionadas;
private List<String> operadores;
private List<SelectItem> operadoresSelectItem;
private List<String> operadoresSelecionados;
private List<String> valoresFiltro;
private String filtroTeste;
private HtmlInputSecret itxOperador;
GETTERS E SETTERS
METODO
private void criarComponentes() {
FacesContext context = FacesContext.getCurrentInstance();
ELContext elContext = context.getELContext();
Application app = context.getApplication();
ExpressionFactory expressionFactory = app.getExpressionFactory();
this.setPainel(new HtmlPanelGrid());
this.getPainel().setColumns(2);
HtmlOutputText hotTitulo = (HtmlOutputText) FacesContext.getCurrentInstance().getApplication().createComponent(HtmlOutputText.COMPONENT_TYPE);
hotTitulo.setValue("Configuração do Relatório de Pessoas");
Integer posicao = 0;
this.setFormulario(new HtmlForm());
for (Field field : this.getClassePessoa().getDeclaredFields()) {
HtmlSelectOneMenu somOperadores = new HtmlSelectOneMenu();
somOperadores.setId("som" + posicao);
UISelectItems sim = new UISelectItems();
sim.setId("sim" + posicao);
ValueExpression veSim = expressionFactory.createValueExpression(elContext, "#{mbPessoa.operadoresSelectItem}", List.class);
sim.setValueExpression("value", veSim);
somOperadores.getChildren().add(sim);
this.getOperadoresSelecionados().add(new String());
ValueExpression veSom = expressionFactory.createValueExpression(elContext, "#{mbPessoa.operadoresSelecionados.get(" + posicao + ")}", String.class);
somOperadores.setValueExpression("value", veSom);
HtmlInputText itxOperador = new HtmlInputText();
itxOperador.setId("itx" + posicao);
this.getValoresFiltro().add(new String());
ValueExpression veItx = expressionFactory.createValueExpression(elContext, "#{mbPessoa.valoresFiltro.get(" + posicao + ")}", String.class);
this.getPainel().getChildren().add(somOperadores);
this.getPainel().getChildren().add(itxOperador);
posicao = posicao + 1;
}
this.getFormulario().getChildren().add(this.getPainel());
}
e tenho a seguinte JSF
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core">
<h:head>
<title>Configurar Relatório de Pessoas</title>
</h:head>
<h:body>
<h:form binding="#{mbPessoa.formulario}">
<h:panelGrid columns="2">
<h:panelGrid >
<h:selectManyCheckbox value="#{mbPessoa.pessoasSelecionadas}" layout="pageDirection">
<f:selectItems var="pes" value="#{mbPessoa.pessoas}"/>
</h:selectManyCheckbox>
</h:panelGrid>
<h:panelGrid binding="#{mbPessoa.painel}" columns="2">
</h:panelGrid>
</h:panelGrid>
<h:commandButton value="Metodo"
action="#{mbPessoa.metodo}" />
</h:form>
</h:body>
</html>
Quando eu rodo minha aplicação funciona certinho, cria os SelectOneMenu com os items e tals, o problema é que quando eu clico no botão “Metodo” chama um metodo no meu mb que serve somente para teste, testa se esta fazendo submit e tals, porem ele nem chega chamar este metodo gera a exeção javax.el.PropertyNotWritableException: Illegal Syntax for Set Operation na hora que eu clico.
EXCEÇÃO
An Error Occurred:
javax.el.PropertyNotWritableException: Illegal Syntax for Set Operation
+- Stack Trace
javax.faces.component.UpdateModelException: javax.el.PropertyNotWritableException: Illegal Syntax for Set Operation
at javax.faces.component.UIInput.updateModel(UIInput.java:848)
at javax.faces.component.UIInput.processUpdates(UIInput.java:730)
at javax.faces.component.UIComponentBase.processUpdates(UIComponentBase.java:1109)
at javax.faces.component.UIComponentBase.processUpdates(UIComponentBase.java:1109)
at javax.faces.component.UIForm.processUpdates(UIForm.java:268)
at javax.faces.component.UIComponentBase.processUpdates(UIComponentBase.java:1109)
at javax.faces.component.UIComponentBase.processUpdates(UIComponentBase.java:1109)
at javax.faces.component.UIViewRoot.processUpdates(UIViewRoot.java:1244)
at com.sun.faces.lifecycle.UpdateModelValuesPhase.execute(UpdateModelValuesPhase.java:74)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:97)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:114)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:308)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1523)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97)
at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:332)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:233)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:165)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
at java.lang.Thread.run(Thread.java:619)
Caused by: javax.el.PropertyNotWritableException: Illegal Syntax for Set Operation
at com.sun.el.parser.AstValue.setValue(AstValue.java:187)
at com.sun.el.ValueExpressionImpl.setValue(ValueExpressionImpl.java:286)
at org.jboss.weld.el.WeldValueExpression.setValue(WeldValueExpression.java:88)
at javax.faces.component.UIInput.updateModel(UIInput.java:813)
... 35 more
+- Component Tree
<UIViewRoot id="j_id1" inView="true" locale="pt_BR" renderKitId="HTML_BASIC" rendered="true" transient="false" viewId="/index.xhtml">
<?xml version='1.0' encoding='UTF-8' ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<UIOutput id="j_idt4" inView="true" rendered="true" transient="false">
<title>Configurar Relatório de Pessoas</title>
</UIOutput>
<UIOutput id="j_idt6" inView="true" rendered="true" transient="false">
<HtmlForm enctype="application/x-www-form-urlencoded" id="j_idt7" inView="true" prependId="true" rendered="true" submitted="true" transient="false" binding="#{mbPessoa.formulario}">
<HtmlPanelGrid border="-2147483648" columns="2" id="j_idt8" inView="true" rendered="true" transient="false">
<HtmlPanelGrid border="-2147483648" columns="-2147483648" id="j_idt9" inView="true" rendered="true" transient="false">
<HtmlSelectManyCheckbox border="-2147483648" disabled="false" id="j_idt10" immediate="false" inView="true" layout="pageDirection" localValueSet="false" readonly="false" rendered="true" required="false" transient="false" valid="true">
<UISelectItems id="j_idt11" inView="true" rendered="true" transient="false"/>
</HtmlSelectManyCheckbox>
</HtmlPanelGrid>
<HtmlPanelGrid border="-2147483648" columns="2" id="j_idt12" inView="true" rendered="true" transient="false" binding="#{mbPessoa.painel}">
<HtmlSelectOneMenu disabled="false" id="som0" immediate="false" inView="true" localValueSet="true" readonly="false" rendered="true" required="false" transient="false" valid="false" value="<">
<UISelectItems id="sim0" inView="true" rendered="true" transient="false"/>
</HtmlSelectOneMenu>
<HtmlInputText disabled="false" id="itx0" immediate="false" inView="true" localValueSet="true" maxlength="-2147483648" readonly="false" rendered="true" required="false" size="-2147483648" transient="false" valid="true" value=""/>
<HtmlSelectOneMenu disabled="false" id="som1" immediate="false" inView="true" localValueSet="true" readonly="false" rendered="true" required="false" transient="false" valid="false" value="<">
<UISelectItems id="sim1" inView="true" rendered="true" transient="false"/>
</HtmlSelectOneMenu>
<HtmlInputText disabled="false" id="itx1" immediate="false" inView="true" localValueSet="true" maxlength="-2147483648" readonly="false" rendered="true" required="false" size="-2147483648" transient="false" valid="true" value=""/>
<HtmlSelectOneMenu disabled="false" id="som2" immediate="false" inView="true" localValueSet="true" readonly="false" rendered="true" required="false" transient="false" valid="false" value="<">
<UISelectItems id="sim2" inView="true" rendered="true" transient="false"/>
</HtmlSelectOneMenu>
<HtmlInputText disabled="false" id="itx2" immediate="false" inView="true" localValueSet="true" maxlength="-2147483648" readonly="false" rendered="true" required="false" size="-2147483648" transient="false" valid="true" value=""/>
<HtmlSelectOneMenu disabled="false" id="som3" immediate="false" inView="true" localValueSet="true" readonly="false" rendered="true" required="false" transient="false" valid="false" value="<">
<UISelectItems id="sim3" inView="true" rendered="true" transient="false"/>
</HtmlSelectOneMenu>
<HtmlInputText disabled="false" id="itx3" immediate="false" inView="true" localValueSet="true" maxlength="-2147483648" readonly="false" rendered="true" required="false" size="-2147483648" transient="false" valid="true" value=""/>
<HtmlSelectOneMenu disabled="false" id="som4" immediate="false" inView="true" localValueSet="true" readonly="false" rendered="true" required="false" transient="false" valid="false" value="<">
<UISelectItems id="sim4" inView="true" rendered="true" transient="false"/>
</HtmlSelectOneMenu>
<HtmlInputText disabled="false" id="itx4" immediate="false" inView="true" localValueSet="true" maxlength="-2147483648" readonly="false" rendered="true" required="false" size="-2147483648" transient="false" valid="true" value=""/>
<HtmlSelectOneMenu disabled="false" id="som5" immediate="false" inView="true" localValueSet="true" readonly="false" rendered="true" required="false" transient="false" valid="false" value="<">
<UISelectItems id="sim5" inView="true" rendered="true" transient="false"/>
</HtmlSelectOneMenu>
<HtmlInputText disabled="false" id="itx5" immediate="false" inView="true" localValueSet="true" maxlength="-2147483648" readonly="false" rendered="true" required="false" size="-2147483648" transient="false" valid="true" value=""/>
<HtmlSelectOneMenu disabled="false" id="som6" immediate="false" inView="true" localValueSet="true" readonly="false" rendered="true" required="false" transient="false" valid="false" value="<">
<UISelectItems id="sim6" inView="true" rendered="true" transient="false"/>
</HtmlSelectOneMenu>
<HtmlInputText disabled="false" id="itx6" immediate="false" inView="true" localValueSet="true" maxlength="-2147483648" readonly="false" rendered="true" required="false" size="-2147483648" transient="false" valid="true" value=""/>
</HtmlPanelGrid>
</HtmlPanelGrid>
<HtmlCommandButton action="#{mbPessoa.gerarRelatorio}" actionExpression="#{mbPessoa.gerarRelatorio}" disabled="false" id="j_idt13" immediate="false" inView="true" readonly="false" rendered="true" transient="false" type="submit" value="Gera relatorio"/>
</HtmlForm>
</UIOutput>
</html>
</UIViewRoot>
+- Scoped Variables
Request ParametersName Value
j_idt7 j_idt7
j_idt7:itx0
j_idt7:itx1
j_idt7:itx2
j_idt7:itx3
j_idt7:itx4
j_idt7:itx5
j_idt7:itx6
j_idt7:j_idt13 Gera relatorio
j_idt7:som0 <
j_idt7:som1 <
j_idt7:som2 <
j_idt7:som3 <
j_idt7:som4 <
j_idt7:som5 <
j_idt7:som6 <
View AttributesName Value
mbPessoa controle.MbPessoa@121708a
Request AttributesName Value
None
Flash AttributesName Value
None
Session AttributesName Value
None
Application AttributesName Value
csfcff com.sun.faces.context.flash.ELFlash@14960eb
PESSOAL, ALGUEM PODE ME AJUDAR, FICARIA MUITO GRATO
OBRIGADO