Thanks, this turned out to be the best solution. This way, classes do not
have to be hardcoded, but can come from an init script or the database...
Thanks again!
-- Joshua Slack
[EMAIL PROTECTED]
Guenther Wieser wrote:
> There's one easy way to load a class in java, it's called
> Class.forName(String).
> With that you can't load a servlet, but you can load a class, that
> returns you a string or whatever with the data you need.
> I personally use that to load dynamically something called a formater,
> which defines methods to get for example a table or a header with
> special outfit. The info for which formater I have to use for this page
> (or better: database content) is stored in a database, and I just create
> a new instance with
> (ProjectFormater)Class.forClass(data_base_formater_name).newInstance();
> where ProjectFormater is an interface that defines the methods for
> returning HTML code.
>
> Joshua Slack wrote:
> >
> > I am working on a servlet that interprets a template. Based on the
> > template's
> > contents, the servlet needs to call other servlets and plug in the
> > appropriate
> > data.
> >
> > For example, if the template had some line:
> > menu choices=2 choice1=front choice2=back
> >
> > This would tell the interpreting servlet to call some servlet called
> > "menu" and
> > pass it the values "choices=2 choice1=front choice2=back". The "menu"
> > servlet
> > would then return some resulting data to the interpreting servlet which
> > the
> > interpreting servlet could then send back to the client.
> >
> > Writing individual servlets to get data from databases and files,
> > manipulate
> > content, and so forth has been quite easy, but the question is, how can
> > I call a
> > servlet from inside another servlet and pass it variables? Programming
> > sources
> > are pretty vague on this, most of them referring to servlet chaining
> > which I
> > believe is not implemented in Jserv.
> >
> > Any help would be much appreciated.
> >
> > -- Joshua Slack
> > [EMAIL PROTECTED]
> >
> > ----------------------------------------------------------------
> > To subscribe: [EMAIL PROTECTED]
> > To unsubscribe: [EMAIL PROTECTED]
> > READ THE FAQ!!!! <http://java.apache.org/faq/>
> > Archives and Other: <http://java.apache.org/main/mail.html/>
> > Problems?: [EMAIL PROTECTED]
>
> --
> Guenther Wieser
> creative-it/Guenther Wieser Software KEG
> Student of Telematik at Graz University of Technology
> http://www.creative-it.com mailto:[EMAIL PROTECTED]
> -> In A World Without Walls And Fences, Who Needs Windows And Gates? <-
>
> ----------------------------------------------------------------
> To subscribe: [EMAIL PROTECTED]
> To unsubscribe: [EMAIL PROTECTED]
> READ THE FAQ!!!! <http://java.apache.org/faq/>
> Archives and Other: <http://java.apache.org/main/mail.html/>
> Problems?: [EMAIL PROTECTED]
----------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
READ THE FAQ!!!! <http://java.apache.org/faq/>
Archives and Other: <http://java.apache.org/main/mail.html/>
Problems?: [EMAIL PROTECTED]