java - JSTL fn:length() Function with byte[] -


this code in jsp file in spring web model-view-controller (mvc) framework. version of spring web model-view-controller (mvc) framework 3.2.8, deployed in weblogic server version: 12.1.2.0.0. using jstl-1.2

<c:if test="${not empty form.attachment}"> ${fn:length(form.attachment.bytes.length)} </c:if> 

where

private multipartfile attachment; 

but have error:

java.lang.numberformatexception: input string: "length"         @ java.lang.numberformatexception.forinputstring(numberformatexception.java:65)         @ java.lang.integer.parseint(integer.java:492)         @ java.lang.integer.parseint(integer.java:527)         @ javax.el.arrayelresolver.tointeger(arrayelresolver.java:378)         @ javax.el.arrayelresolver.getvalue(arrayelresolver.java:198)         @ javax.el.compositeelresolver.getvalue(compositeelresolver.java:188)         @ com.sun.el.parser.astvalue.getvalue(astvalue.java:138)         @ com.sun.el.parser.astvalue.getvalue(astvalue.java:183)         @ com.sun.el.parser.astfunction.getvalue(astfunction.java:122)         @ com.sun.el.valueexpressionimpl.getvalue(valueexpressionimpl.java:224)         @ weblogic.servlet.jsp.elhelper.evaluate(elhelper.java:32)         @ jsp_servlet._web_45_inf._jsp._manage.__managecompanybody._jsp__tag2(__managecompanybody.java:952)         @ jsp_servlet._web_45_inf._jsp._manage.__managecompanybody._jspservice(__managecompanybody.java:252)         @ weblogic.servlet.jsp.jspbase.service(jspbase.java:34)         @ weblogic.servlet.internal.stubsecurityhelper$servletserviceaction.run(stubsecurityhelper.java:280)         @ weblogic.servlet.internal.stubsecurityhelper$servletserviceaction.run(stubsecurityhelper.java:254)         @ weblogic.servlet.internal.stubsecurityhelper.invokeservlet(stubsecurityhelper.java:136)         @ weblogic.servlet.internal.servletstubimpl.execute(servletstubimpl.java:341)         @ weblogic.servlet.internal.servletstubimpl.execute(servletstubimpl.java:238)         @ weblogic.servlet.internal.requestdispatcherimpl.invokeservlet(requestdispatcherimpl.java:573)         @ weblogic.servlet.internal.requestdispatcherimpl.include(requestdispatcherimpl.java:480)         @ weblogic.servlet.jsp.pagecontextimpl.include(pagecontextimpl.java:162)         @ jsp_servlet._web_45_inf._jsp._manage.__managebody._jspservice(__managebody.java:1048)         @ weblogic.servlet.jsp.jspbase.service(jspbase.java:34)         @ weblogic.servlet.internal.stubsecurityhelper$servletserviceaction.run(stubsecurityhelper.java:280)         @ weblogic.servlet.internal.stubsecurityhelper$servletserviceaction.run(stubsecurityhelper.java:254)         @ weblogic.servlet.internal.stubsecurityhelper.invokeservlet(stubsecurityhelper.java:136)         @ weblogic.servlet.internal.servletstubimpl.execute(servletstubimpl.java:341)         @ weblogic.servlet.internal.servletstubimpl.execute(servletstubimpl.java:238)         @ weblogic.servlet.internal.requestdispatcherimpl.invokeservlet(requestdispatcherimpl.java:573)         @ weblogic.servlet.internal.requestdispatcherimpl.include(requestdispatcherimpl.java:480)         @ org.apache.taglibs.standard.tag.common.core.importsupport.acquirestring(importsupport.java:347)         @ org.apache.taglibs.standard.tag.common.core.importsupport.doendtag(importsupport.java:204)         @ jsp_servlet._web_45_inf._jsp._template.__template._jsp__tag2(__template.java:365)         @ jsp_servlet._web_45_inf._jsp._template.__template._jspservice(__template.java:247)         @ weblogic.servlet.jsp.jspbase.service(jspbase.java:34)         @ weblogic.servlet.internal.stubsecurityhelper$servletserviceaction.run(stubsecurityhelper.java:280)         @ weblogic.servlet.internal.stubsecurityhelper$servletserviceaction.run(stubsecurityhelper.java:254)         @ weblogic.servlet.internal.stubsecurityhelper.invokeservlet(stubsecurityhelper.java:136)         @ weblogic.servlet.internal.servletstubimpl.execute(servletstubimpl.java:341)         @ weblogic.servlet.internal.servletstubimpl.execute(servletstubimpl.java:238)         @ weblogic.servlet.internal.requestdispatcherimpl.invokeservlet(requestdispatcherimpl.java:573)         @ weblogic.servlet.internal.requestdispatcherimpl.forward(requestdispatcherimpl.java:272)         @ org.springframework.web.servlet.view.internalresourceview.rendermergedoutputmodel(internalresourceview.java:238)         @ org.springframework.web.servlet.view.abstractview.render(abstractview.java:264)         @ org.springframework.web.servlet.dispatcherservlet.render(dispatcherservlet.java:1208)         @ org.springframework.web.servlet.dispatcherservlet.processdispatchresult(dispatcherservlet.java:992)         @ org.springframework.web.servlet.dispatcherservlet.dodispatch(dispatcherservlet.java:939)         @ org.springframework.web.servlet.dispatcherservlet.doservice(dispatcherservlet.java:856)         @ org.springframework.web.servlet.frameworkservlet.processrequest(frameworkservlet.java:953)         @ org.springframework.web.servlet.frameworkservlet.dopost(frameworkservlet.java:855)         @ javax.servlet.http.httpservlet.service(httpservlet.java:751)         @ org.springframework.web.servlet.frameworkservlet.service(frameworkservlet.java:829)         @ javax.servlet.http.httpservlet.service(httpservlet.java:844)         @ weblogic.servlet.internal.stubsecurityhelper$servletserviceaction.run(stubsecurityhelper.java:280)         @ weblogic.servlet.internal.stubsecurityhelper$servletserviceaction.run(stubsecurityhelper.java:254)         @ weblogic.servlet.internal.stubsecurityhelper.invokeservlet(stubsecurityhelper.java:136)         @ weblogic.servlet.internal.servletstubimpl.execute(servletstubimpl.java:341)         @ weblogic.servlet.internal.tailfilter.dofilter(tailfilter.java:25)         @ weblogic.servlet.internal.filterchainimpl.dofilter(filterchainimpl.java:79)         @ cpm.tdk.iot.taglib.datagrid.export.excelexportfilter.dofilter(excelexportfilter.java:39)         @ weblogic.servlet.internal.filterchainimpl.dofilter(filterchainimpl.java:79)         @ cpm.tdk.iot.filter.characterencodingfilter.dofilter(characterencodingfilter.java:27)         @ weblogic.servlet.internal.filterchainimpl.dofilter(filterchainimpl.java:79)         @ cpm.tdk.iot.filter.eventdispatcherfilter.dofilter(eventdispatcherfilter.java:38)         @ weblogic.servlet.internal.filterchainimpl.dofilter(filterchainimpl.java:79)         @ cpm.tdk.iot.filter.requesturlfilter.dofilter(requesturlfilter.java:31)         @ weblogic.servlet.internal.filterchainimpl.dofilter(filterchainimpl.java:79)         @ cpm.tdk.iot.support.context.devicessecurityfilter.dofilter(devicessecurityfilter.java:82)         @ weblogic.servlet.internal.filterchainimpl.dofilter(filterchainimpl.java:79)         @ weblogic.servlet.internal.requesteventsfilter.dofilter(requesteventsfilter.java:27)         @ weblogic.servlet.internal.filterchainimpl.dofilter(filterchainimpl.java:79)         @ weblogic.servlet.internal.webappservletcontext$servletinvocationaction.wraprun(webappservletcontext.java:3367)         @ weblogic.servlet.internal.webappservletcontext$servletinvocationaction.run(webappservletcontext.java:3333)         @ weblogic.security.acl.internal.authenticatedsubject.doas(authenticatedsubject.java:321)         @ weblogic.security.service.securitymanager.runas(securitymanager.java:120)         @ weblogic.servlet.provider.wlssubjecthandle.run(wlssubjecthandle.java:57)         @ weblogic.servlet.internal.webappservletcontext.dosecuredexecute(webappservletcontext.java:2220)         @ weblogic.servlet.internal.webappservletcontext.securedexecute(webappservletcontext.java:2146)         @ weblogic.servlet.internal.webappservletcontext.execute(webappservletcontext.java:2124)         @ weblogic.servlet.internal.servletrequestimpl.run(servletrequestimpl.java:1564)         @ weblogic.servlet.provider.containersupportproviderimpl$wlsrequestexecutor.run(containersupportproviderimpl.java:254)         @ weblogic.work.executethread.execute(executethread.java:295)         @ weblogic.work.executethread.run(executethread.java:254) 

you need change:

fn:length(form.attachment.bytes.length) 

to:

fn:length(form.attachment.bytes) 

you want fn:length length of byte array, not length of length.


Comments

Popular posts from this blog

account - Script error login visual studio DefaultLogin_PCore.js -

xcode - CocoaPod Storyboard error: -