Ext学习_表单组件6

	var f = new Ext.form.FormPanel({
		url: "../../../service/deng/test/testFormPanel",
		method: "post",
		renderTo: "b",
		title: "新增员工",
/**间距*/		style: "padding: 10px",
               frame: true,
		labelAlign: "left",
		width: 650,
		autoHeight: true,
		items: [
		   txtName,
		   txtPassword,
		   grpSex,
		   dateBirthday,
		   grpGobby,
		   chkEdu,
		   numLove,
		   areaAddress,
		   timeWork,
		   htmlIntro,
		   txtPhoto
		],
		
		buttons: [
		     btnSubmit,
		     btnReset
		]
	});
	
	
});

/**
 * 备注:
 *  在FormPanel例子中,添加了样式:
 *  .x-panel-header, .x-unselectable{
	   text-align: center;
     }
    这会使所有的面板居中,但是我只需要某个居中,所以
    修改为:
    <style type="text/css">
    yy{
	   text-align: center;
     }
   </style>
   然后在FormPanel中设置属性:
   	ctCls: "yy" 就可以居中了 
   ctCls:一个可选添加的CSS样式类,加入到组件的容器上(默认为'')。
 */
后台代码:
    @RequestMapping(value = "/testFormPanel")
    public void testFormPanel(HttpServletRequest request,HttpServletResponse response) throws Exception{
    	response.setContentType("text/html;charset=utf-8");
    	Map<String, String[]> paramsMap = request.getParameterMap();
    	Set<Entry<String, String[]>> sets = paramsMap.entrySet();
    	for(Entry<String,String[]> entry: sets){
			System.err.println(entry.getKey() + "="
					+ Arrays.asList(entry.getValue()));
    	}
    	PrintWriter out = response.getWriter();
    	System.err.println("test");
    	out.println("{success: true,msg:'服务器结果,成功!',time:'2010-07-15'}");
    	out.flush();
    	out.close();
    }

你可能感兴趣的:(ext)