各位高手帮看一下,本人看了很久都看不明白
解决方案 »
- rest cxf osgi servicemix问题
- 有关javaee的一个小问题,希望大家指导指导...帮帮看是什么错误,谢谢...
- 关于发生异常后的处理
- 不同页面提交不同form到一个action的方法,return时怎么区分转向哪个页面?
- STRUTS中如何提交一个table中的多行数据?
- 接口
- 能帮我解决这个问题的我给他168分...祝他一路发...
- cmp查询简单问题
- error : This JDBC 2.0 method is not implemented 该怎么处理!
- 在开发EJB时,我用了 Enterprise JavaBean Wizard,共有三步,前两步一切正常,到了第三步,我点击“ Finish ”(此按钮可用),程序就停在那儿,迟迟没有响应。急啥我也?
- pet store 源码谁有,给小弟一份
- 关于连接的释放
Locale locale = getLocale(request);
MessageResources messages = getResources(request); ---这部分好象是去本地资源的吧,用于国际化版本的通用。
User user = null; // Validate the request parameters specified by the user
ActionErrors errors = new ActionErrors();
String username = (String) ???(String)PropertyUtils.getSimpleProperty(form, "username") 这句好像是取值,有点不太了解?特别是这个PropertyUtils.getSimpleProperty不懂是什么意思?
PropertyUtils.getSimpleProperty(form, "username");
String password = (String)
PropertyUtils.getSimpleProperty(form, "password");
UserDatabase database = (UserDatabase)
servlet.getServletContext().getAttribute(Constants.DATABASE_KEY); ---Cnstants.DATABASE_KEY是个常量,查一下struts的api,有个Constants类的。
if (database == null)
errors.add(ActionErrors.GLOBAL_ERROR,
new ActionError("error.database.missing")); ---保存错误消息。 else {
user = getUser(database, username);
if ((user != null) && !user.getPassword().equals(password))
user = null;
if (user == null)
errors.add(ActionErrors.GLOBAL_ERROR,
new ActionError("error.password.mismatch"));
} // Report any errors we have discovered back to the original form
if (!errors.isEmpty()) { --非空说明上面有了错误,下面就不是空了,就要处理错误
saveErrors(request, errors);
return (mapping.getInputForward());
} // Save our logged-in user in the session
HttpSession session = request.getSession(); --取得当前用户Session
session.setAttribute(Constants.USER_KEY, user); --设Session属性,Constants.USER_KEY就是一个常量字符串.
if (log.isDebugEnabled()) { ---可以在配置文件中定义Debug是否打开,如果打开的话,就打印log
log.debug("LogonAction: User '" + user.getUsername() +
"' logged on in session " + session.getId());
}