This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Values in Struts JSP page

 
Anurag Mishra
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a JSP page and I have a ActionClass which is called by controller(Action Servlet) when user select a option.

Now I am getting list of Users from a Stateless bean's method
getUserList(String Role) in say bean userBean.

Now I am getting the reference of userBean in my ActionClass and calling the
method getUserList(String Role) which returns me an arrayof User's and some of its properties in this way


Now if I want to Use these Roles (rolesList) in my JSP do I need to set the roleList in session and then only I can access in the JSP session.

Or is there some other way to do this.

thanks
Anurag
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are a great number of ways to handle this. The best method depends on what that roleList is.
Do all users have the same list?,
How many pages/jsps need access to the list?,
etc.
 
Anurag Mishra
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
there is
only one page which needs to handle the roleList.

And different Users will be having different Role lists.

I have one more question is there some other Place apart from ActionClass from where I can get the reference of my EJB and call the method??


thanks in Advance
 
Anurag Mishra
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,

Please reply to this post.

thanks
Anurag
 
Kinjal Sonpal
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Anurag Mishra:
there is only one page which needs to handle the roleList. And different Users will be having different Role lists.


The most common approach, that I've seen so far, is to put the Array as an accessible property of the Form Bean. The population of this property would be done by the Action class. Since form bean instance would at most be in session scope, these lists would remain different per session/user.

I have one more question is there some other Place apart from ActionClass from where I can get the reference of my EJB and call the method??
Purists say that putting any logic which is even remotely related to business requirements, should not be part of the Action code. However, I found it too cumbersome to create one more layer/facade, since my application is really not massive. Most Actions in my code are implementing Sequence diagrams related to the UI logic.

HTH.

Thanks and Regards,
Kinjal Sonpal
 
Anurag Mishra
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Kinjal,

Thanks for your reply
Can you Explain what you mean by
Most Actions in my code are implementing Sequence diagrams related to the UI logic.

Please just explain so I can implement this in an efficient way.

thanks in advance
Anurag
 
Kinjal Sonpal
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Anurag Mishra:
Can you Explain what you mean by
Most Actions in my code are implementing Sequence diagrams related to the UI logic.
Anurag, I'm sorry for ambigous statement like this.

A typical execute(or equivalent) method in an Action class of mine would have something like this :
Fetch validated user input from FormBean, construct VOs, push VOs thru' XyzManager for business processing(XyzManager will push data to the back-end by using XyzDataManager), fetch x or updated data from XyzManager, put them into the FormBean, forward to relevent mapping.

While designing the application, our (so-called) architect had develeloped several use-cases and corresponding sequence diagrams to explain the flow of data and control. At that time the decision to use struts was not in sight. These are the sequence diagrams that my Action classes are implementing.

I hope I'm being clearer here. I'm not having a very detailed understanding of Designing and architecting lingo and principles.

Let me know about your views.

Thanks and regards,
Kinjal Sonpal
[ June 04, 2004: Message edited by: Kinjal Sonpal ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic