- 浏览: 46379 次
- 性别:
- 来自: 北京
文章分类
最新评论
-
airdream:
toeo 写道
# public class BaseActi ...
spring+hibernate+struts 自己总结出的方法。 -
toeo:
# public class BaseAction exten ...
spring+hibernate+struts 自己总结出的方法。 -
foxwise:
开源吧
Tapestry+Ibatis+Spring+ajax+css 写的Digg网站。效果不错! -
airdream:
tapestry 的缺点吧,但5.0改进了,没研究的
Tapestry+Ibatis+Spring+ajax+css 写的Digg网站。效果不错! -
airdream:
个人做的
Tapestry+Ibatis+Spring+ajax+css 写的Digg网站。效果不错!
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts-config (View Source for full doctype...)>
<data-sources />
<form-bean name="userForm" type="user.UserForm" />
<form-bean name="cardForm" type="card.CardForm" />
</form-beans>
<global-exceptions />
<global-forwards />
- <action attribute="userForm" input="/login.jsp" name="userForm" path="/user" scope="request" type="user.UserAction" validate="false">
<forward name="mainPage" path="/main.jsp" />
<forward name="Login" path="/login.jsp" />
</action>
- <action attribute="cardForm" input="/card/insert.jsp" name="cardForm" path="/card" scope="request" type="card.CardAction" validate="false">
<forward name="queryPage" path="/card/query.jsp" />
<forward name="Login" path="/login.jsp" />
</action>
</action-mappings>
<message-resources parameter="card.ApplicationResources" />
</struts-config>
<?xml version="1.0" encoding="UTF-8" ?>
- <web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.4" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<param-name>debug</param-name>
<param-value>3</param-value>
</init-param>
<param-name>detail</param-name>
<param-value>3</param-value>
</init-param>
<load-on-startup>0</load-on-startup>
</servlet>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
</web-app>
<!DOCTYPE form-validation (View Source for full doctype...)>
- <!--
This file contains the default Struts Validator pluggable validator
definitions. It should be placed somewhere under /WEB-INF and
referenced in the struts-config.xml under the plug-in element
for the ValidatorPlugIn.
<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
<set-property property="pathnames" value="/WEB-INF/validator-rules.xml,
/WEB-INF/validation.xml"/>
</plug-in>
These are the default error messages associated with
each validator defined in this file. They should be
added to your projects ApplicationResources.properties
file or you can associate new ones by modifying the
pluggable validators msg attributes in this file.
# Struts Validator Error Messages
errors.required={0} is required.
errors.minlength={0} can not be less than {1} characters.
errors.maxlength={0} can not be greater than {1} characters.
errors.invalid={0} is invalid.
errors.byte={0} must be a byte.
errors.short={0} must be a short.
errors.integer={0} must be an integer.
errors.long={0} must be a long.
errors.float={0} must be a float.
errors.double={0} must be a double.
errors.date={0} is not a date.
errors.range={0} is not in the range {1} through {2}.
errors.creditcard={0} is an invalid credit card number.
errors.email={0} is an invalid e-mail address.
-->
<script></script>
- <validator name="required" classname="org.apache.struts.validator.FieldChecks" method="validateRequired" methodParams="java.lang.Object, org.apache.commons.validator.ValidatorAction, org.apache.commons.validator.Field, org.apache.struts.action.ActionErrors, javax.servlet.http.HttpServletRequest" msg="errors.required">
- <![CDATA[
function validateRequired(form) {
var isValid = true;
var focusField = null;
var i = 0;
var fields = new Array();
oRequired = new required();
for (x in oRequired) {
var field = form[oRequired[x][0]];
if (field.type == 'text' ||
field.type == 'textarea' ||
field.type == 'file' ||
field.type == 'select-one' ||
field.type == 'radio' ||
field.type == 'password') {
var value = '';
// get field's value
if (field.type == "select-one") {
var si = field.selectedIndex;
if (si >= 0) {
value = field.options[si].value;
}
} else {
value = field.value;
}
if (trim(value).length == 0) {
if (i == 0) {
focusField = field;
}
fields[i++] = oRequired[x][1];
isValid = false;
}
}
}
if (fields.length > 0) {
focusField.focus();
alert(fields.join('\n'));
}
return isValid;
}
// Trim whitespace from left and right sides of s.
function trim(s) {
return s.replace( /^\s*/, "" ).replace( /\s*$/, "" );
}
]]>
<script></script>
</javascript>
</validator>
<validator name="requiredif" classname="org.apache.struts.validator.FieldChecks" method="validateRequiredIf" methodParams="java.lang.Object, org.apache.commons.validator.ValidatorAction, org.apache.commons.validator.Field, org.apache.struts.action.ActionErrors, org.apache.commons.validator.Validator, javax.servlet.http.HttpServletRequest" msg="errors.required" />
- <validator name="minlength" classname="org.apache.struts.validator.FieldChecks" method="validateMinLength" methodParams="java.lang.Object, org.apache.commons.validator.ValidatorAction, org.apache.commons.validator.Field, org.apache.struts.action.ActionErrors, javax.servlet.http.HttpServletRequest" depends="" msg="errors.minlength">
- <![CDATA[
function validateMinLength(form) {
var isValid = true;
var focusField = null;
var i = 0;
var fields = new Array();
oMinLength = new minlength();
for (x in oMinLength) {
var field = form[oMinLength[x][0]];
if (field.type == 'text' ||
field.type == 'textarea') {
var iMin = parseInt(oMinLength[x][2]("minlength"));
if ((trim(field.value).length > 0) && (field.value.length < iMin)) {
if (i == 0) {
focusField = field;
}
fields[i++] = oMinLength[x][1];
isValid = false;
}
}
}
if (fields.length > 0) {
focusField.focus();
alert(fields.join('\n'));
}
return isValid;
}
]]>
<script></script>
</javascript>
</validator>
- <validator name="maxlength" classname="org.apache.struts.validator.FieldChecks" method="validateMaxLength" methodParams="java.lang.Object, org.apache.commons.validator.ValidatorAction, org.apache.commons.validator.Field, org.apache.struts.action.ActionErrors, javax.servlet.http.HttpServletRequest" depends="" msg="errors.maxlength">
- <![CDATA[
function validateMaxLength(form) {
var isValid = true;
var focusField = null;
var i = 0;
var fields = new Array();
oMaxLength = new maxlength();
for (x in oMaxLength) {
var field = form[oMaxLength[x][0]];
if (field.type == 'text' ||
field.type == 'textarea') {
var iMax = parseInt(oMaxLength[x][2]("maxlength"));
if (field.value.length > iMax) {
if (i == 0) {
focusField = field;
}
fields[i++] = oMaxLength[x][1];
isValid = false;
}
}
}
if (fields.length > 0) {
focusField.focus();
alert(fields.join('\n'));
}
return isValid;
}
]]>
<script></script>
</javascript>
</validator>
- <validator name="mask" classname="org.apache.struts.validator.FieldChecks" method="validateMask" methodParams="java.lang.Object, org.apache.commons.validator.ValidatorAction, org.apache.commons.validator.Field, org.apache.struts.action.ActionErrors, javax.servlet.http.HttpServletRequest" depends="" msg="errors.invalid">
- <![CDATA[
function validateMask(form) {
var isValid = true;
var focusField = null;
var i = 0;
var fields = new Array();
oMasked = new mask();
for (x in oMasked) {
var field = form[oMasked[x][0]];
if ((field.type == 'text' ||
field.type == 'textarea') &&
(field.value.length > 0)) {
if (!matchPattern(field.value, oMasked[x][2]("mask"))) {
if (i == 0) {
focusField = field;
}
fields[i++] = oMasked[x][1];
isValid = false;
}
}
}
if (fields.length > 0) {
focusField.focus();
alert(fields.join('\n'));
}
return isValid;
}
function matchPattern(value, mask) {
return mask.exec(value);
}
]]>
<script></script>
</javascript>
</validator>
- <validator name="byte" classname="org.apache.struts.validator.FieldChecks" method="validateByte" methodParams="java.lang.Object, org.apache.commons.validator.ValidatorAction, org.apache.commons.validator.Field, org.apache.struts.action.ActionErrors, javax.servlet.http.HttpServletRequest" depends="" msg="errors.byte" jsFunctionName="ByteValidations">
- <![CDATA[
function validateByte(form) {
var bValid = true;
var focusField = null;
var i = 0;
var fields = new Array();
oByte = new ByteValidations();
for (x in oByte) {
var field = form[oByte[x][0]];
if (field.type == 'text' ||
field.type == 'textarea' ||
field.type == 'select-one' ||
field.type == 'radio') {
var value = '';
// get field's value
if (field.type == "select-one") {
var si = field.selectedIndex;
if (si >= 0) {
value = field.options[si].value;
}
} else {
value = field.value;
}
if (value.length > 0) {
if (!isAllDigits(value)) {
bValid = false;
if (i == 0) {
focusField = field;
}
fields[i++] = oByte[x][1];
} else {
var iValue = parseInt(value);
if (isNaN(iValue) || !(iValue >= -128 && iValue <= 127)) {
if (i == 0) {
focusField = field;
}
fields[i++] = oByte[x][1];
bValid = false;
}
}
}
}
}
if (fields.length > 0) {
focusField.focus();
alert(fields.join('\n'));
}
return bValid;
}
]]>
<script></script>
</javascript>
</validator>
- <validator name="short" classname="org.apache.struts.validator.FieldChecks" method="validateShort" methodParams="java.lang.Object, org.apache.commons.validator.ValidatorAction, org.apache.commons.validator.Field, org.apache.struts.action.ActionErrors, javax.servlet.http.HttpServletRequest" depends="" msg="errors.short" jsFunctionName="ShortValidations">
- <![CDATA[
function validateShort(form) {
var bValid = true;
var focusField = null;
var i = 0;
var fields = new Array();
oShort = new ShortValidations();
for (x in oShort) {
var field = form[oShort[x][0]];
if (field.type == 'text' ||
field.type == 'textarea' ||
field.type == 'select-one' ||
field.type == 'radio') {
var value = '';
// get field's value
if (field.type == "select-one") {
var si = field.selectedIndex;
if (si >= 0) {
value = field.options[si].value;
}
} else {
value = field.value;
}
if (value.length > 0) {
if (!isAllDigits(value)) {
bValid = false;
if (i == 0) {
focusField = field;
}
fields[i++] = oShort[x][1];
} else {
var iValue = parseInt(value);
if (isNaN(iValue) || !(iValue >= -32768 && iValue <= 32767)) {
if (i == 0) {
focusField = field;
}
fields[i++] = oShort[x][1];
bValid = false;
}
}
}
}
}
if (fields.length > 0) {
focusField.focus();
alert(fields.join('\n'));
}
return bValid;
}
]]>
<script></script>
</javascript>
</validator>
- <validator name="integer" classname="org.apache.struts.validator.FieldChecks" method="validateInteger" methodParams="java.lang.Object, org.apache.commons.validator.ValidatorAction, org.apache.commons.validator.Field, org.apache.struts.action.ActionErrors, javax.servlet.http.HttpServletRequest" depends="" msg="errors.integer" jsFunctionName="IntegerValida
相关推荐
根据给定文件的信息来看,这段文字实际上是在描述K线图的相关知识,并非“struts配置”。但是为了满足您的需求,我会基于这段描述进行一个错误纠正并生成与“struts配置”相关的知识点。以下是对“struts配置”的...
本资料“struts配置大全(1、2全)”涵盖了Struts 1和Struts 2两个版本的核心配置,以及与Spring MVC的整合配置,旨在帮助开发者深入理解并熟练掌握Struts框架的配置方法。 **Struts 1配置** Struts 1的配置主要集中...
struts配置文件,用于创建springmvc与struts工程的配置文件,集合加数组获得后台的空间空间空间 空间 空间空了
通过Struts配置文件,我们可以定义各个Action和它们对应的处理方法。 在配置简单的Struts应用时,主要涉及以下几个步骤: 1. **添加依赖**:确保你的项目包含了Struts2的核心库。这通常通过在Maven或Gradle的依赖...
以下是对“多个struts配置文件使用”这一主题的详细解析。 ### 一、Struts框架概述 Struts是一个开源的MVC(Model-View-Controller)框架,用于构建可扩展的企业级Java Web应用程序。它提供了一种结构化的方式来...
2. `<init-param>`:在这里,我们设置`ActionServlet`的初始化参数,特别是`config`参数,它指定了`struts-config.xml`的路径,这是Struts配置文件的位置。 3. `<welcome-file-list>`:不能直接将Struts的Action...
本文将深入探讨Struts配置文件的细节,包括`web.xml`和`struts-config.xml`。 首先,`web.xml`是每个Web应用程序的标准部署描述符,它是基于XML的文件,用于向Web容器(如Tomcat)提供关于应用如何运行的信息。`web...
### Struts配置文件详解 #### 一、Struts配置文件的重要性与作用 Struts框架作为Java Web开发领域中的一种流行MVC(Model-View-Controller)框架,它提供了一种结构化的方式来构建Web应用程序。在Struts框架中,`...
7. **Struts配置文件:** `struts-config.xml`是Struts框架的核心配置文件,它定义了表单Bean、Action、Forward等组件。每个元素对应`org.apache.struts.config`包中的类,如`ModuleConfig`是核心类,它存储了整个...
详细讲解了Struts如何配置,适合刚刚接触Struts的开发者来配置环境
Struts配置文件是该框架的核心组成部分,它定义了请求如何被处理、视图如何与控制器交互等关键信息。在这篇详尽的讲解中,我们将深入探讨Struts配置文件的关键元素和作用。 1. **struts-config.xml文件**:这是...
**多个Struts配置文件**: Struts2支持多个配置文件,可以通过`<include>`标签来导入其他配置文件,这样可以使配置更加模块化,方便管理和维护。 **Action的调用方式**: Struts2支持基于注解的Action配置,可以...
struts-config.xml拆分,超级简单
### Struts配置文件详解 #### 一、概述 Struts框架是Java Web开发中的一个重要工具,它使用MVC(Model-View-Controller)设计模式来组织应用逻辑,从而提高代码的可维护性和可读性。Struts框架的核心是通过两个XML...
在本"J2EE Struts配置实例程序"中,我们将深入探讨Struts2的配置与基本操作。 一、Struts2概述 Struts2是Apache软件基金会的开源项目,它是Struts1的升级版,提供了更强大的功能和更好的性能。Struts2的核心设计...