下面显示了我在JSF+Spring项目中的代码。请帮我解决这个问题
感谢这是我的JSF代码在XHTML文件我尝试了@form/@this也。但是同样的结果
错误是输入文本没有提交到控制器
<a4j:region id="panel-region">
<f:facet name="header">
<h:outputText value="SAM Selector"/>
</f:facet>
<rich:panel style="clear:both;" header="Search SAM" styleClass="col" id="panelSamSearch">
<ui:decorate template="/jsf/templates/two_columns.xhtml">
<ui:define name="left_label">*Search By</ui:define>
<ui:define name="left_field">
<h:selectOneMenu value="#{pOSController.samType}" id="samType">
<f:selectItem itemValue="a" itemLabel=""/>
<f:selectItem itemValue="samUid" itemLabel="SAM UID"/>
<f:selectItem itemValue="samDid" itemLabel="SAM DID"/>
<f:selectItem itemValue="status" itemLabel="Status"/>
</h:selectOneMenu>
</ui:define>
<ui:define name="right_label">
<h:inputText value="#{pOSController.samValue}" id="samValue"/>
</ui:define>
<ui:define name="right_field">
<a4j:commandButton id="samBtnSearch" value="Search" execute="lp"
action="#{pOSController.loadSamPosTagging(rich:element('samType').value,rich:element('samValue').value)}"
render="#{rich:clientId('dataTableSamView')}"/>
</ui:define>
</ui:decorate>
</rich:panel>
这里显示了我的错误
May 05, 2014 1:13:41 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [Faces Servlet] in context with path [/cms-web] threw exception [/jsf/popups/samPosTagginPopup.xhtml @29,230 action="#{pOSController.loadSamPosTagging({rich:element('samType')}.value,{rich:element('samValue')}.value)}" Failed to parse the expression [#{pOSController.loadSamPosTagging({rich:element('samType')}.value,{rich:element('samValue')}.value)}]] with root cause
org.apache.el.parser.ParseException: Encountered " <ILLEGAL_CHARACTER> "{ "" at line 1, column 35.
Was expecting one of:
<INTEGER_LITERAL> ...
<FLOATING_POINT_LITERAL> ...
<STRING_LITERAL> ...
"true" ...
"false" ...
"null" ...
"(" ...
")" ...
"!" ...
"not" ...
"empty" ...
"-" ...
<IDENTIFIER> ...
at org.apache.el.parser.ELParser.generateParseException(ELParser.java:2217)
at org.apache.el.parser.ELParser.jj_consume_token(ELParser.java:2099)
at org.apache.el.parser.ELParser.MethodParameters(ELParser.java:1153)
at org.apache.el.parser.ELParser.ValueSuffix(ELParser.java:1047)
at org.apache.el.parser.ELParser.Value(ELParser.java:980)
i added
<a4j:commandButton id="samBtnSearch" value="Search" execute="lp" action="#{pOSController.loadSamPosTagging(rich:component('samType'),rich:component('samValue'))}" render="#{rich:clientId('dataTableSamView')}" />
则字符串如下所示。它没有传递字段的值。只是我传递返回的名称:-)document.getElementById('frmMasPosTagging:dataTablePosView:0:samType')
换行
action="{pOSController.loadSamPosTagging(rich:element('samType').value,rich:element('samValue').value)}"
action="{pOSController.loadSamPosTagging()}
值"samType"one_answers"samValue"可以在控制器中访问,因为它们被映射到支持bean,并且支持bean将被更新。所以不需要从UI发送值我假设pOSController有'samType'和'samValue'的getter和setter