页面代码:
所在地区:
Action代码:
public class MyInfoAction extends DispatchAction
{
//这是从别的页面连接到修改页面的方法,在别的页面中加入连接:
public ActionForward toInfo(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
UserForm userForm = (UserForm)request.getSession().getAttribute("userForm");
userForm.setStrUserBirsday(userForm.getUserBirsday().toLocaleString());
userForm.setDepartmentId(userForm.getDepartment().getDepartmentId());
userForm.setCityId(userForm.getCity().getCityId());
userForm.setIndustryId(userForm.getIndustry().getIndustryId());
userForm.setDutyId(userForm.getDuty().getDutyId());
userForm.setProvinceId(userForm.getProvince().getProvinceId());
userForm.setXueliId(userForm.getXueli().getXueliId());
List listIndustry = IndustryBE.queryAllIndustry();
List listXueli = XueliBE.queryAllXueli();
List listDuty = DutyBE.queryAllDuty();
List listProvice = ProviceBE.queryAllProvice();
List listCity = CityBE.queryAllCityByProvinceId(userForm.getProvince().getProvinceId());
request.setAttribute("listCity", listCity);
request.setAttribute("listProvice", listProvice);
request.setAttribute("listDuty", listDuty);
request.setAttribute("listXueli", listXueli);
request.setAttribute("listIndustry", listIndustry);
request.setAttribute("userForm", userForm);
return mapping.findForward("toInfo");
}
//这是处理修改页面当省选择改变时执行的代码,页面中连接在javascript中,见上面的页面代码
public ActionForward changeProvince(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
String provinceId = request.getParameter("provinceId");
UserForm userForm = (UserForm)form;
List listIndustry = IndustryBE.queryAllIndustry();
List listXueli = XueliBE.queryAllXueli();
List listDuty = DutyBE.queryAllDuty();
List listProvice = ProviceBE.queryAllProvice();
List listCity = CityBE.queryAllCityByProvinceId(userForm.getProvinceId());
request.setAttribute("listCity", listCity);
request.setAttribute("listProvice", listProvice);
request.setAttribute("listDuty", listDuty);
request.setAttribute("listXueli", listXueli);
request.setAttribute("listIndustry", listIndustry);
request.setAttribute("userForm", userForm);
return mapping.findForward("changeProvince");
}
}