I'm not sure exactly how the jsp:useBean looks for the
class you specify, but since you are initializing the
class from the ActionServlet it would be safe to
assume it is there so you don't really need the
jsp:useBean.  So you should be able to do just this.

<p>Context Bean: <bean:write name="host"
scope="application" property="base"/></p>

If you weren't sure if the bean existed, you could
check for it with the logic:present tag.

David

--- Hartmut Bernecker <[EMAIL PROTECTED]> wrote:
> 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


__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/

Reply via email to