You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Abraham Kang <ab...@infogain.com> on 2001/04/06 01:20:31 UTC

Problems with

I was wondering if anyone could explain why "lname" variable is not defined
in the following JSP page:


        <bean:define id="lname" value="<%=Keys.SHOW_USER_TASKS%>"
type="java.lang.String" toScope="page"/>
        <bean:define id="lvalue" name="<%=Keys.USERNAME%>"
type="java.lang.String" toScope="page"/>

        <bean:write name="lvalue"/>

        <% out.println(lname); %>

Does anyone know why I am getting this error?


G:\Struts\wlpiApp\WEB-INF\_tmp_war_wlpiApp\jsp_servlet\_workliststruts.java:
397: Undefined variable: lname
    probably occurred due to an error in /worklistStruts.jsp line 56:
    <% out.println(lname); %>

Thanks,
Abraham

Re: Problems with

Posted by Martin Cooper <ma...@tumbleweed.com>.
Did you remember the taglib directive at the top of your JSP? That is, you
need:

<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>

Otherwise, your <bean:define> and <bean:write> tags will be silently
ignored. Annoying, but true. :-}

--
Martin Cooper


----- Original Message -----
From: "Abraham Kang" <ab...@infogain.com>
To: <st...@jakarta.apache.org>
Sent: Thursday, April 05, 2001 4:20 PM
Subject: Problems with <bean:define>


> I was wondering if anyone could explain why "lname" variable is not
> defined in the following JSP page:
>
>
>         <bean:define id="lname" value="<%=Keys.SHOW_USER_TASKS%>"
> type="java.lang.String" toScope="page"/>
>         <bean:define id="lvalue" name="<%=Keys.USERNAME%>"
> type="java.lang.String" toScope="page"/>
>
>         <bean:write name="lvalue"/>
>
>         <% out.println(lname); %>
>
> Does anyone know why I am getting this error?
>
>
> G:\Struts\wlpiApp\WEB-INF\_tmp_war_wlpiApp\jsp_servlet\_workliststruts.j
> ava:397: Undefined variable: lname
>     probably occurred due to an error in /worklistStruts.jsp line 56:
>     <% out.println(lname); %>
>
> Thanks,
> Abraham
>