Re: Questions regarding action and form interaction - thanks Ted!

2002-01-09 Thread Michael Witt

First:

Apologies for sending this email directly to the list instead of replying.  
I am not getting emails from the list and I don't know why (I've sent a 
query to struts-user-owner)

To see the original message, go to:
http://www.mail-archive.com/struts-user%40jakarta.apache.org/msg20541.html

Ted Husted wrote:

2) My initial plan was to forward back to the list form after the
update is complete.  I initially assumed that the action for this form
would be executed again, but it's not.  So, I always get a blank form.
Is there a way to get this action to run again?  If I click the link in
my navigation bar to go to this page, the action does run again.

You'd have to forward back to the Action. The Actions fun the forms, not
the other way around.

Thank you very much Ted, for your response on this, it worked.

Mike



_
MSN Photos is the easiest way to share and print your photos: 
http://photos.msn.com/support/worldwide.aspx


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




Questions regarding action and form interaction

2002-01-06 Thread Michael Witt

Hello,

I'm fairly new to struts (used over the pass 3 or so weeks) and I have
a question that I'm hoping someone here might know the answer to.
I've looked in the archives and don't believe that I've seen this same
set of problems there, but if I've just missed it, please redirect me.

Here's the problem:

I have two pages which I'll call, for this explanation: list and edit.

The list page presents a list of possible records with a html:link on
each in order to edit that record.  When one of these links is clicked,
it goes to the edit page where the record is displayed for editing.

I have one form bean, which I'll call editform which stores the
information on the edit page.  I've put some functionality into the
constructor for this form bean to populate some select/option fields
with valid options (for example, years to choose from) because I wanted
to be able to drive this programmatically so that the year list always
shows a proper range.

I have three actions, which I'll call listaction, editaction and
updateaction.

The purpose of the listaction is to the load all records from the
database and display them in a list with html:link's for each record
and setting a parameter for each with the records id.  This form has no
name or input.

The purpose of the editaction is to receive the id parameter from the
list form, select the record from the database and populate the form.
This action does not validate and its name is the editform and its
input is the editform.

The pupose of the update action is assemble the information off of the
edit form and either update or insert a record into the database.  This
action does validate and its name is the editform and its input is also
the edit form.

Now for my questions:

1) Am I handling the form bean correctly by tying it to two actions,
one to load it and the other to process it?
2) My initial plan was to forward back to the list form after the
update is complete.  I initially assumed that the action for this form
would be executed again, but it's not.  So, I always get a blank form.
Is there a way to get this action to run again?  If I click the link in
my navigation bar to go to this page, the action does run again.
3) If I have an error, either validating or otherwise, I would like to
go back to the editform again with the record still filled in.  But, I
always get a handlePageException caused by a NullPointerException
which seems to have something to do with my select/options (because I
see in the stack trace:

org.apache.struts.taglib.html.OptionsTag.getIterator...).

Thanks in advance for any help you can give,

Mike Witt


_
Chat with friends online, try MSN Messenger: http://messenger.msn.com


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