Thanks, As you said, subclassing the EmployeeAction gives the perfect solution, or Can I use lazy getter which also avoids to declare an instance variable, List<LabelValue> skillList; in Action ?
Kannan Ekanath wrote: > > If I get it right, the EmployeeAction is used in different > requests/contexts > and on success redirects to a variety of jsps. Of these only two jsps need > this list and you dont want to fetch them until you need it? > 1) The idea of getter sounds good. Struts calls getter only when you have > the s:select tag. Dont see a problem with it myself. > 2) I would subclass the EmployeeAction for the two jsps and put the > prepare > call while skipping the rest. > > > 2009/7/6 Dhanakumar <dhana.a...@gmail.com> > >> >> Hi , Can you explain whether the following approach is good or not. >> >> Here, I need to show drop downs only for 2 JSP pages, but prepare method >> is >> invoked for every request, doing un-necessary fetching of drop down list >> from DAO. >> >> public class EmployeeAction extends ActionSupport implements Preparable { >> >> List<LabelValue> skillList; >> >> public void prepare() { >> // instead of getting the skillList in prepare method, can >> we >> put this code in getter method,which is like a lazy getter, invoked only >> when skillList is given as input <s:select tag. >> skillList = lookupManager.getDropDownList(65L); >> } >> >> // like as follows. >> public List<LabelValue> getSkillList() { >> return lookupManager.getDropDownList(65L); >> } >> } >> -- >> View this message in context: >> http://www.nabble.com/Use-of-Preparable-Interface-for-Action-classes.-tp24351903s2369p24351903.html >> Sent from the AppFuse - User mailing list archive at Nabble.com. >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: users-unsubscr...@appfuse.dev.java.net >> For additional commands, e-mail: users-h...@appfuse.dev.java.net >> >> > > > -- > Regards, > Kannan Ekanath > > -- View this message in context: http://www.nabble.com/Use-of-Preparable-Interface-for-Action-classes.-tp24351903s2369p24353520.html Sent from the AppFuse - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@appfuse.dev.java.net For additional commands, e-mail: users-h...@appfuse.dev.java.net