Hopefully someone will be able to elaborate on this, but I don't believe you
can't use
        <jsp:useBean id="info" scope="application" class="myPackages.Info"/>
interchangablby with struts bean tags.

You should be able to use:

        <bean:define id="info" scope="application" name="host" />

then, to display:

        <bean:write name="info" property="base"/>

Also, make sure that you are putting the bean "host" into the "application"
scope in you java code.
hth

D

> -----Original Message-----
> From: Hartmut Bernecker [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, July 25, 2001 11:00 AM
> To: [EMAIL PROTECTED]
> Subject: application scope problem
>
>
> Please Help!
>
> In my Struts-Application I create at a certain point (init Method of
> myClass extends ActionServlet) a Bean for the Servlet Context.
>
> ServletContext context = getServletContext();
> Info info = (Info)context.getAttribute("host");
> if (info == null)
> {
>    info = new Info();
>    info.setBase("test");
>    context.setAttribute("host", info);
> }
>
> Later in a JSP page I have that:
>
> <jsp:useBean id="info" scope="application" class="myPackages.Info"/>
> <p>Context Bean: <bean:write name="info" scope="application"
> property="base"/></p>
>
> But I don't reach the value of the property because every time when I
> forward to that JSP-Page the Bean (Info) is created again and it's
> properties initialized with null.
>
> Any idea?
> What is wrong???
>
> Hartmut Bernecker

Reply via email to