【发布时间】:2014-06-21 11:06:51
【问题描述】:
下面是我在JSF+Spring项目中的代码,请帮我解决这个问题
谢谢
这是我在 xhtml 文件中的 jsf 代码
我也试过@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)
已编辑
我加了
<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({rich:element('samType')}.value,{rich:element('samValue')}.value)}"不同。您确定运行时使用第一个清单中显示的文件吗? -
@OlegEstekhin : 亲爱的朋友,我编辑了代码。请告诉我从 inputtext 字段返回值的方法