actually you talk about different things:

- IsLoggedIn-Check
Why don't you put this into a separat tag ?

- Prepopulation of forms
We had the same problem and our solution was to extend the
org.apache.struts.taglib.html.FormTag and overwrite its doStartTag()-method.
In this method we get the form out of the pageContext and if it's a Form
which implements our own PrepopInterface, we call its method "prepopulate()"

cheers,
dirk

-----Ursprüngliche Nachricht-----
Von: Derek Clayton [mailto:[EMAIL PROTECTED]]
Gesendet: Mittwoch, 21. November 2001 20:52
An: Struts Users Mailing List
Betreff: prepopulating, initializing and securing a form


I have a form which I want to prepopulate with some general data (eg. a list
or provinces) from a database along with some user specific data again from
a database (eg. user name).  The form is also secure so I want the user to
be "logged in" to access it.

So I have set up:

Page.jsp - the view containing the form
PageForm.java - extends ActionForm
PageAction.java - extends Action and set in mapping as pageAction.do

In PageAction I check for a session attribute which tells me whether or not
the user is logged in.  If the user is not logged in I forward them to a
login sequence.

The problem is when I call pageAction.do the PageAction is never called.
The reset() and validate() methods on PageForm are called but then Page.jsp
is displayed without ever having called PageAction's perform() and therefore
never doing security authentication.

So no security validation occurs.  I have no opportunity to prepopulate the
form.  I did cheat in a way by having reset() set the general data but I
still need a way to prepulate the personal data that I want pre-filled on
the form *once* when it's first displayed and then allow the user to change
from then on.  So if they change their name on the form, for example, but
make an error on the form then when the form is redisplayed it doesn't reset
the name back to what's in the database but instead shows the changed name.

In my mapping I have the input attribute set to Page.jsp.  Perhaps I'm
misusing this attribute.

Thanks for any and all help.

Derek




--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to