thanx, but since i want to set init params for the bean this way, i'd allways have to 
run
the servlet/jsp before i can go on using my bean, right?

Scott Stirling schrieb:

> Yes, access them in a servlet or JSP and pass them to the bean in a set method.
> Here's an example from a book I've been writing with some other folks.  The only
> difference for your case is that you would have an expression set the "value"
> attribute of the setProperty tag instead of a literal String, e.g., value="<%=
> application.getInitParameter("foo") %>"
>
> <%@ page import="FirstBean" %>
>
> <jsp:useBean id="fb" class="FirstBean" />
>
> <jsp:setProperty name="fb" property="stringThing" value="Hello World" />
>
> <html>
> <head><title>First Bean JSP</title></head>
> <body>
> The value of FirstBean's stringThing property is:
>
> <br />"<jsp:getProperty name="fb" property="stringThing" />"
>
> </body>
> </html>
>
> *************************************
>
> public class FirstBean
> {
>     private String stringVar;
>
>     public String getStringThing()
>     {
>         return stringVar;
>     }
>
>     public void setStringThing(String bar)
>     {
>         stringVar = bar;
>     }
>
>     public FirstBean()
>     {
>         stringVar = "";
>     }
> }
>
> Scott Stirling
>
> > -----Original Message-----
> > From: Fabian Panthen [mailto:[EMAIL PROTECTED]]
> > Sent: Friday, August 25, 2000 4:25 PM
> > To: [EMAIL PROTECTED]
> > Subject: Bean not EJBs
> >
> >
> > Does anyone know how to access the application init parameters
> > from within a bean (no EJB that is)?
> > I tried to access it in about a million ways, no success.
> >
> > --
> >
> > Fabian Panthen
>
> ------------------------------------------------------------------------------
> Archives: http://www.egroups.com/group/jrun-interest/
> Unsubscribe: 
>http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/jrun_talk
> or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the 
>body.

--

Fabian Panthen
------------------
IT-Architekt
plenum New Media
Ein Unternehmen der plenum Gruppe
Torstra�e 134
10119 Berlin
Tel.:+49.30.24088 0
Fax: +49.30.24088 500
http://www.plenum-new-media.com


Besuchen Sie uns auf der BerlinBeta
1.9.- 3.9.2000
Haus der Kulturen der Welt
John-Foster-Dulles-Allee 10
Berlin-Tiergarten
http://www.berlinbeta.de


------------------------------------------------------------------------------
Archives: http://www.egroups.com/group/jrun-interest/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/jrun_talk
or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the 
body.

Reply via email to