Re: How to dynamically initialize form:select ?

2000-11-30 Thread Pierre Métras

Hi Michael,

> Or in other words: does struts allow for some convenient means
> to initialize a page upon creation ?  Some kind of PreAction ?

I add a similar problem and requested for such a feature.

Now, in Struts 1.0, you can use the ActionForm.reset(mapping, request) to
fill your form with some values, before auto-population by Struts. Based on
the request parameters or the mapping, you can detect if it's a first time
initialization and do what you want. What can be disturbing is that Struts
always comes after you and replaces your values with the request parameters
values, but you shouldn't be concerned when you want initialization.

If you're using version 0.5, bad luck! I did the move to 1.0 for that
reason...

Pierre Métras




Q: How to dynamically initialize form:select ?

2000-11-30 Thread Michael Gerdau

Hi !

I'm slowly becoming familiar with struts.

I'm now faced with the following problem:
I have a form in the middle of my application which among other
things sports a dynamically populated form:select.

>From what I've read in the documentation I'm supposed to read the
appropriate information upon Logon (or while navigating along the
pages) and store in beans added as attributes to the session/request.

While this certainly works I'm not yet fully convinced I'll like
this for two reasons.
1) While the user moves along the dynamic info might change without
   it actually being used. This imposes IMO unnecessary load on the
   underlying DB which could and should be avoided.
2) For convenience and useability reasons the user can navigate the
   pages through some menus realized in JavaScript. While clicking
   his way through the decisiontree there is no interaction with the
   Servlet Engine.
   Eventually the user will come to a point where a full blown
   ActionForm/Action part is required which now need initialization
   according to the navigation done prior.

Is there a way to achieve this other than creating some general
helper-beans that solve this ?

Or in other words: does struts allow for some convenient means
to initialize a page upon creation ?  Some kind of PreAction ?

Thank you,
Michael