Thank you for the very useful and constructive
feedbacks.

I think I am going for the first method that you
suggested - create a user bean and store it in a 
session object at login.  My concern is that I use
container managed authentication at login.  After the
container does its job, is there any way other than
using an Action that delegates the business tier to
search the database and obtain the value of
field_of_specialization?  If an action has to be
involved at this point to form a session object, does
it suffer the the disadvantage of being overwritten if
the user has more than one browser window opened?

In regard to the two-action approach that you
discussed toward the end of your message, I
encountered some problems.  If you would take a look
at the problem -  I provide a buttion in editor's
page, which is a JSP tile:

<req:isUserInRole role="editor">
<html:form action="/do/editor/Category">
<html:submit>View Articles</html:submit>
</html:form>
</req:isUserInRole>

If the button is clicked, I attempt to use an Action
(via the path /editor/Category) to search the database
for the field_of_specialization.  However, I got this
message in the browser:

[ServletException in:/article/content/menu.jsp] Cannot
retrieve mapping for action /do/editor/Category'

and in my struts-config.xml

<action 
    path="/editor/Category"
   
type="org.apache.artimus.article.EditorViewAction">
    <forward
        name="success"
        path="/menu/Find"/>
</action>
 
-Caroline
--- Adam Hardy <[EMAIL PROTECTED]>
wrote:
> On 11/06/2003 08:26 AM Caroline Jen wrote:
> > Passing variables from one action to another is a
> > frequently asked question.  The answer is to use
> > either hidden fields or a session object.  
> > 
> [snip...]
> > 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.  
> 
> One method that I use is to create a user bean and
> store that in the 
> session at login. This bean could include your
> editor's field of 
> specialization, so that you don't need an extra
> action.
> 
> Secondly, you could drop the Action One by
> incorporating the field of 
> specialization as a part of one SQL statement, so
> that you never 
> actually extract the field of specialization from
> the DB. I.e. something 
> like this:
> 
> SELECT article_title, article_text FROM app_user,
> article
> WHERE app_user.user_name = ?
> AND app_user.field_of_specialization =
> article.field_of_specialization
> 
> Alternatively if you still want to do 2 actions, I
> have seen people 
> handle it in various ways: (1) get the
> action-forward in your action and 
> modify the path to add a query_string with your
> keyValue on it (2) put 
> the keyValue in a cookie (3) as you said, put it in
> the session. 2 & 3 
> have the disadvantage that they could be overwritten
> if the user has 
> more than one browser window open.
> 
> HTH
> Adam
> 
> -- 
> struts 1.1 + tomcat 5.0.12 + java 1.4.2
> Linux 2.4.20 RH9
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 



__________________________________
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