English 中文(简体)
c: set throw 数量
原标题:String value for c:set throws NumberFormatException
  • 时间:2012-05-04 23:26:58
  •  标签:
  • jsf
  • jstl

我想要在共同财产基金中产生图象的URL,其代码如下......

<c:choose>
    <c:when test="#{cc.attrs.index == 0}">
        <c:set var="image" value="image.png" />
    </c:when>
    <c:otherwise>
        <c:set var="image" value="image1.png" />
    </c:otherwise>
</c:choose>

<img src="#{image}" />

但是,在我执政时,我收到了一份数字表:

java.lang.NumberFormatException: For input string: "image.png"
    at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1241)
    at java.lang.Double.valueOf(Double.java:504)
    at com.sun.el.lang.ELArithmetic$DoubleDelegate.coerce(ELArithmetic.java:148)
    at com.sun.el.lang.ELArithmetic.coerce(ELArithmetic.java:373)
    at com.sun.el.lang.ELArithmetic.add(ELArithmetic.java:254)
    at com.sun.el.parser.AstPlus.getValue(AstPlus.java:57)
    at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:206)
    at org.apache.myfaces.view.facelets.el.ELText$ELTextVariable.toString(ELText.java:208)
    at org.apache.myfaces.view.facelets.el.ELText$ELTextComposite.toString(ELText.java:140)
    ...

现在我的问题是: 是否真的,<条码>c:>不接受“价值”?


BTW, 当我使用参数时,例如

        <c:set var="image" value="#{cc.attrs.index}" />

一切都属于罚款,但都不是正确的。


我的天候:

  • org.apache.myfaces.core.myfaces-api 2.1.7
  • org.apache.myfaces.core.myfaces-impl 2.1.7
  • javax.el.el-api 2.2
问题回答

我将利用纯粹的联合基金解决这一问题。

<h:graphicImage value="#{(cc.attrs.index eq 0)?  image.png  :  image1.png  }" />




相关问题
JSF a4j:support with h:selectManyCheckbox

I m having trouble with a JSF selectManyCheckbox and A4J support. The purpose is to run some action when a checkbox is selected. This works perfectly in Firefox. Yet, when testing in any IE (ie6 / ie7 ...

Mojarra for JSF Encoding

Can anyone teach me how to use mojarra to encode my JSF files. I downloaded mojarra and expected some kind of jar but what i had downloaded was a folder of files i don t know what to do with

如何拦截要求终止?

在共同基金中,如果用户要求终止,就需要采取一些行动。 我需要某种拦截器,但我不知道如何这样做。 我需要帮助。 增 编

ICEFaces inputFile getting the file content without upload

Is there any way of just getting the content of the browsed file without any upload/file transfer operations? I currently use ICEFaces inputFile component but I do not need the default uploading ...

Weird behaviour of h:commandLink action (MethodExpression)

I have two JSPs where I am displaying some info from database in a h:dataTable. One of them is showing all the info, and one of them user specifically. I have showXML.jsp that shows the "XML" column ...

How to correctly use ResultSet with h:dataTable

The problem is, that after displaying the ResultSet with <h:dataTable>, the connection is left open. If I close it, it closes the ResultSet too. I m thinking about copying the ResultSet data ...

热门标签