Hey Guys, i am very new to Spring so please don't jump at me and get mad if my question is not to worthy :).
I have this big problem in my application that i been trying to solve for over 2 weeks.
I AM USING spring 2.5 so please don't give me answers for 3.0
First problem 1) Using two models
Second Problem 2) Using check boxes
Third Problem 3) Using MultiActionController (its a problem because i can't find many examples and most of the examples are SimpleFormController)
Fourth Problem 4) Please don't send me to a link and tell me to read because i been reading crazy things over these two weeks and still can't find my sloution.
so here is the example of which i am trying to do
Code:one model will store all information of zzz public class ZZZ private long id; private String name; (getters and setters) and i have another model YYY that has this public class YYY private long id; Set<ZZZ> zzzs; (getters and setters)
and then i have the DAOs as follows
My ControllerCode:public class YYYDAOImpl implements YYYDAO { private HibernateTemplate hibernateTemplate; public HibernateTemplate getHibernateTemplate() { return hibernateTemplate; } public void setHibernateTemplate(HibernateTemplate hibernateTemplate) { this.hibernateTemplate = hibernateTemplate; } public void saveYYY(YYY yyy) { // TODO Auto-generated method stub hibernateTemplate.saveOrUpdate(YYY); } @SuppressWarnings("unchecked") public List<ZZZ> getZZZ() { return hibernateTemplate.find("from ZZZ"); } }
so here is what i am trying to doCode:public class YYYController extends MultiActionController { private YYYDAO yyyDAO; (setters and getters) protected ModelAndView List(HttpServletRequest request,HttpServletResponse response) { List<ZZZ> zzzs = yyyDAO.getZZZ(); ModelMap modelMap = new ModelMap(); modelMap.addAttribute("zzzs", zzzs); return new ModelAndView("list.htm"); } protected ModelAndView save(HttpServletRequest request,HttpServletResponse response) { saveOrUpdate(YYY); return new ModelAndView("list.htm"); }
jsp
so i am listing from one model and i want to save into a different model soCode:<body> i am using a displaytag table by the way <form:form method="post" action="save" commandName="ZZZ"> <display:table id="zzz" name="{ZZZ}"> <display:column title="Select"> <input type="checkbox" name="selected"/> </display:column> <display:column property="name"/> </display:table> <input type="submit" value="Save"/> </form:form> </body>
1)how do you pass a list to the controller
2)how to send selected value to the controller
3) HOW to do this task?
all my configurations are working great and i am suing spring 2.5 so please stick to the version when supplying help !
Please help and know you are dealing with a newbie


Reply With Quote