jsf 中的动态绑定
我在 JSF 页面中遇到动态绑定问题 我正在使用 JSF 1.1
我想要的只是管理器具有动态的管理器名称
<%String manger="ManagerName";%>
上面的代码只是一个片段,它将作为
jsf 文件中的请求参数代码
<h:inputText id="street1" value="#{address.street1}"
binding = "#{<%=manager%>.billingStreet}"
/>
出现这是错误我正在得到的
enter code here
Caused by: org.apache.commons.el.parser.ParseException: Encountered "<" at line 1, column 3.
Was expecting one of:
<INTEGER_LITERAL> ...
<FLOATING_POINT_LITERAL> ...
<STRING_LITERAL> ...
"true" ...
"false" ...
"null" ...
"(" ...
"-" ...
"not" ...
"!" ...
"empty" ...
<IDENTIFIER> ...
at org.apache.commons.el.parser.ELParser.generateParseException(ELParser.java:1895)
at org.apache.commons.el.parser.ELParser.jj_consume_token(ELParser.java:1779)
at org.apache.commons.el.parser.ELParser.Expression(ELParser.java:124)
at org.apache.commons.el.parser.ELParser.AttrValueExpression(ELParser.java:96)
at org.apache.commons.el.parser.ELParser.ExpressionString(ELParser.java:43)
at org.apache.myfaces.el.ELParserHelper.parseExpression(ELParserHelper.java:83)
... 49 more
I am having an issue with Dynamic Binding in JSF page I am using JSF 1.1
All I want is manager to have the Manager Name Dynamic
<%String manger="ManagerName";%>
The above code is just an Snippet it would come as a request parameter
code from the jsf file
<h:inputText id="street1" value="#{address.street1}"
binding = "#{<%=manager%>.billingStreet}"
/>
This is the error which I am getting currenlty
enter code here
Caused by: org.apache.commons.el.parser.ParseException: Encountered "<" at line 1, column 3.
Was expecting one of:
<INTEGER_LITERAL> ...
<FLOATING_POINT_LITERAL> ...
<STRING_LITERAL> ...
"true" ...
"false" ...
"null" ...
"(" ...
"-" ...
"not" ...
"!" ...
"empty" ...
<IDENTIFIER> ...
at org.apache.commons.el.parser.ELParser.generateParseException(ELParser.java:1895)
at org.apache.commons.el.parser.ELParser.jj_consume_token(ELParser.java:1779)
at org.apache.commons.el.parser.ELParser.Expression(ELParser.java:124)
at org.apache.commons.el.parser.ELParser.AttrValueExpression(ELParser.java:96)
at org.apache.commons.el.parser.ELParser.ExpressionString(ELParser.java:43)
at org.apache.myfaces.el.ELParserHelper.parseExpression(ELParserHelper.java:83)
... 49 more
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您不能混合使用 scriptlet
<% %>
和 EL${ }
。使用其中之一。由于它来自请求参数,因此只需在 EL 中将其作为
${param.name}
访问即可。如果 bean 在请求范围内,那么您可以通过${requestScope[param.name]}
访问它。因此:对于会话作用域 bean,请使用
#{sessionScope}
代替。与问题无关,这种设计/方法有味道。
You can't mix scriptlets
<% %>
and EL${ }
. Use the one or the other.Since it comes from a request parameter, just access it as
${param.name}
in EL. If the bean is in the request scope, then you can then access it by${requestScope[param.name]}
. So:For a session scoped bean, use
#{sessionScope}
instead.Unrelated to the problem/question, this design/approach smells.