2013年9月17日星期二

select attribute binding problems

Update operation on this record



	@RequestMapping(params="method=initUpdateNews")
public ModelAndView initUpdateNews(HttpServletRequest request)throws Exception{
ModelAndView view = new ModelAndView();
int i=Integer.parseInt(request.getParameter("id"));
News news =newsService.findById(i);
List<Type>types=typeService.getTypeList();
view.addObject("types",types);
view.addObject("News",news);
view.setViewName("news/updateNews");
return view;
}




[/ code]

Showing results



how to make this kind of classification defaults to the value corresponding to the record ? such that a default should display "Finance "




























------ Solution ------------------------------------ --------

  
  
same label can not be like struts do nothing directly display the corresponding value  
never used struts come forward do not know is how to get that , but the general point of view, is the background to the foreground determine whether access is to advise checked
------ For reference only - -------------------------------------
update operation on this record



	@RequestMapping(params="method=initUpdateNews")
public ModelAndView initUpdateNews(HttpServletRequest request)throws Exception{
ModelAndView view = new ModelAndView();
int i=Integer.parseInt(request.getParameter("id"));
News news =newsService.findById(i);
List<Type>types=typeService.getTypeList();
view.addObject("types",types);
view.addObject("News",news);
view.setViewName("news/updateNews");
return view;
}


jsp page


             <td><spr:select path="type.name" items="${types}" itemLabel="Name"  >
              </spr:select></td>

[/ code]

Showing results



how to make this kind of classification defaults to the value corresponding to the record ? such that a default should display "Finance "



























------ For reference only ---------------------------------- -----
saved to the background, click edit , when you compare that select to display the same like
------ For reference only ------ ---------------------------------



same label can not be like struts do nothing directly display the corresponding value
------ For reference only --------------- ------------------------

    
    
same label can not be like struts do nothing directly display the corresponding value          
never used struts come forward do not know is how to get that , but the general point of view, is the background to the foreground determine whether access is to advise checked  

3Q

没有评论:

发表评论