struts2
wahaishun
这个作者很懒,什么都没留下…
展开
-
tomcat启动报struts2-core-2.1.6.jar!/struts-default.xml:46:178
在学习struts2中,工具myeclipse6.5构建一个简单的小例子,lib中只添加了传说中的5个包,但是在用到核心标签库的时候问题百出,首先是加了所有的.jar文件,却加载不到struts2的标签内容,问题解决又出现一个错误Unable to load configuration. - bean -jar:file:/F:/workspace/test/WebRoot/WEB-INF/...2010-04-28 20:51:28 · 162 阅读 · 0 评论 -
Struts2.x快速上手1--登录应用
1)创建web工程,设置环境A.WEB-INF/lib/ +Struts2.x需要的基本.jar B.WEB.xml <filter> <filter-name>struts2</filter-name> <filter-class>org.apache.struts2.dispatcher.Filte...2010-05-04 16:15:34 · 81 阅读 · 0 评论 -
Struts2.x快速上手2--改进Controller Action
改进Controller Action 方法一:implements Action(Interface of xwork) 1)Login.jsp---->Logon.jsp(重新提供) <form action="Logon.action" method="post">2)public class LogonAction implements Action e...2010-05-04 16:20:21 · 93 阅读 · 0 评论 -
Struts2.x快速上手3--使用Servlet API添加状态跟踪(HttpSession)
1)在LogonAction的execute方法添加: ActionContext.getContext().getSession().put("username", getUsername()); ActionContext +getSession() 注意:返回的不是HttpSession,而是一个Map的封装, Struts2.x框架的...2010-05-04 16:25:31 · 68 阅读 · 0 评论 -
Struts2.x快速上手4--对视图的改进(使用struts标签库)
目的:尽可能的消灭jsp中的Java代码1)加入标签库:<%@ taglib prefix="s" uri="/struts-tags"%> 2)logon.jsp---->logonPage.jsp<table border=1> <s:form action="Logon" method="post"> &2010-05-04 16:31:02 · 66 阅读 · 0 评论 -
Struts2.x快速上手5--i18n的支持
1)添加struts.properties在类路径下,并加入如下设置: struts.custom.i18n.resources=itcomps 注意:以下资源文件的头名字要跟这里一样2)定义资源文件 文件遵循 key=valueresource包下+itcomps_en.properties+itcomps_zh.properties内容:login.title=Pl...2010-05-04 16:39:07 · 71 阅读 · 0 评论 -
Struts2.x快速上手6--添加数据校验(编码式)
1)logon.jsp---->enroll.jsp <s:form action="enroll" method="post">2)开发EnrollAction extends ActionSupport 添加校验方法 @Override public void validate() { if(getUsername() == null || getUsername...2010-05-04 16:42:48 · 71 阅读 · 0 评论 -
Struts2.x快速上手7--声明式验证(validation.xml)
1)logon.jsp 使用struts2标记 2)在Action下添加同名的校验配置LogonAction-validation.xml<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1....2010-05-04 16:44:21 · 73 阅读 · 0 评论