You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Joel Alejandro Espinosa Carra <jo...@cts-design.com> on 2006/02/07 23:21:48 UTC

Populate action

Hi all,

I think this is more a design question than a struts question, but I 
want to know who is the struts-way to do this.
I have a requeriment of listing some items (in my case, scientific 
papers) in a html table view.
Another requirement is that users can see diferent listing of data 
depending of theirs permissions, and the administrator can see 
everything (like always)
I want to know how much code I'm able to save if I design ONLY ONE 
action for hadle the prepopulation of the items list that will be 
displayed latter in a jsp page, or if its better to do more than one 
single action for the prepopulation of data.

My action would be like this:

public void execute(...) {
    List list = new LinkedList();
   
    if("admin".equals(request.getUserRole().toString())) {
       //go to the DAO Layer and get the list of beans for the admin role
       list = dao.getPapersForAdmin();
    }
    //and so on for the others roles
    .
    .
    .
   
} //note that I wrote this little code in my email client not in my IDE

But what can I do in the case of one user could have more than one 
option for display items, like the administrator are be able to see only 
the rejected papers but also can see all the papers.

Any ideas?

Best regards.

-- 
Ing. Joel Alejandro Espinosa Carra
CINVESTAV CTS - Centro de TecnologĂ­a de Semiconductores
Tel. +52 (33) 3770-3700 ext. 1049
http://www.cts-design.com 


-- 
Este mensaje ha sido analizado por MailScanner
en busca de virus y otros contenidos peligrosos,
y se considera que está limpio.
MailScanner agradece a transtec Computers por su apoyo.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org