I'm trying do this in a .jsp:

<jsp:useBean id="myBean" scope="application" class="package.myBean">
<jsp:setProperty name="myBean" property="someValue"
        value="<%=application.getAttribute("package.someValue")%>"/>
</jsp:useBean>

But upon compilation I get this exception:

org.apache.jasper.compiler.ParseException: /local/doc-root/test.jsp(1,104)
Attribute package.someValue has no value
        at
org.apache.jasper.compiler.JspReader.parseAttributeValue(JspReader.java:499)
        at
org.apache.jasper.compiler.JspReader.parseTagAttributes(JspReader.java:615)
        at org.apache.jasper.compiler.Parser$SetProperty.accept(Parser.java:722)
        at org.apache.jasper.compiler.Parser.parse(Parser.java:1077)

I have defined the attribute by overriding the JspServlet in my web.xml.
Doing this works fine:

<jsp:useBean id="myBean" scope="application" class="package.myBean"/>
<% myBean.setSomeValue(<%=application.getAttribute("package.someValue")%>);
%>

Can anyone explain why it doesn't work?  Should it work?

Thanks,
Dave

Reply via email to