Passing variables from one action to another is a
frequently asked question.  The answer is to use
either hidden fields or a session object.  

The story starts with searching the database.  My
application offers options to search the database by
author, title of the article, article ID, or ..... I
have a drop-down list in my JSP for visitors to make a
selection.  By clicking on one of those options, the
property "dispatch" is set.  And the visitor fills out
the text field to set "keyValue".  With both
"dispatch" and keyValue forwarded to an "action"; say,
Action ONE, the desired articles can be retrieved from
the database.  So far so good.

What I have handled next is the "author's page" of the
web site.  An author can only view his own articles
and perform update, delete, save, ... functions.  I
use the hidden field technique to handle it.  The
property "dispatch" is arbitrarily set as "author"
(needless to say) and keyValue can be obtained by

String username = request.getRemoteUser();

And,

<html:hidden property="dispatch" value="author"/>
<html:hidden property="keyValue"
value="<%=username%>"/>

are forwarded to the same action (Action ONE) for
processing.  Again, no problem.

Now, the application has another user case -  editors.
 An editor only retrieve and view all articles in
his/her own field of specialization.  I arbitrarily
set "dispatch" as "field_of_specialization" and use
the hidden field technique:

<html:hidden property="dispatch"
value="field_of_Specialization"/>

Nonetheless, the way to get the "value" the editor's
field of specialization is from the database.  Because
editors are registered members of the web site, the
application should be able to look for his/her profile
and obtain his/her field of specialization in the
database once an editor successfully logs into the web
site.  Therefore, it takes an "action" (Action TWO)
that tells the business tier to find the "keyValue" in
the database.  And should I put the "keyValue" in a
session object.  

I have tried to handle this situation again and again
in many different ways.  I am very frustrated and need
help -- how does a user go from by clicking a button
in a JSP to go to Action TWO (get the keyValue) and
then forward this keyValue and 

<html:hidden property="dispatch"
value="field_of_Specialization"/>
 
to Action ONE for retrieving the desired articles from
the database?





__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree

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

Reply via email to