|
我在登陆页面增加一个企业注册按钮。点击之后进入企业注册页面,所有的验证都是通过框架自带的验证完成的。
信息填完之后点击立即注册跳转到success.jsp页面.
Controller代码:
@RequestMapping(params = "saveOrg")
@Transactional(propagation = Propagation.REQUIRED)
public ModelAndView saveOrg(OrganinfoEntity organinfo,
HttpServletRequest req, TSUser user) throws ParseException {
Date date = new Date();
SimpleDateFormat sim = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date date2 = (Date) sim.parseObject(sim.format(date));
String code = organinfo.getAddressCode() + organinfo.getOrgNo();
organinfo.setOrgNo(code);
organinfo.setOrgAddress(req.getParameter("orgAddress2")+ organinfo.getOrgAddress());
organinfo.setOrgDate(date2);
TSDepart tSDepart = userService.getEntity(TSDepart.class,
"402881ea424b9a5d01424b9b6aa50017");
userService.save(organinfo);
user.setOrgCode(code);
user.setTSDepart(tSDepart);
user.setPassword(PasswordUtil.encrypt(user.getUserName(),user.getPassword(), PasswordUtil.getStaticSalt()));
user.setStatus(Globals.User_Normal);
user.setActivitiSync(Short.parseShort("1"));
userService.save(user);
TSRoleUser roleUser = new TSRoleUser();
TSRole relo = userService.getEntity(TSRole.class,"402881ea424b9a5d01424b9b6b04003a");
roleUser.setTSRole(relo);
roleUser.setTSUser(user);
userService.save(roleUser);
String message1 = "注册成功";
req.setAttribute("message1", message1);
return new ModelAndView("login/success");
}
success.jsp代码:
<script type="text/javascript">
$(document).ready(function() {
var browserversion = "";
//IE8+浏览器
if ($.browser.msie) {
browserversion = "IE" + $.browser.version;
}
//谷歌浏览器
if ($.browser.webkit) {
browserversion = "Chrome" + $.browser.version;
}
//火狐浏览器
if ($.browser.mozilla) {
browserversion = "Mozilla Firefox" + $.browser.version;
}
//欧朋浏览器
if ($.browser.opera) {
browserversion = "Opera" + $.browser.version;
}
window.location.href = "loginController.do?login";
});
但是他无法跳到登陆页面?为撒子呢。 通过firefox,返回的是登陆页面的全部JSP代码,请求都是成功的。
|
-
|