Light  Rain serena

«September 2025»
123456
78910111213
14151617181920
21222324252627
282930


公告

期待

超级好友 Rachel


我的分类(专题)

首页(262)
知识积累(40)
乐瑟温柔(108)
经验杂谈(20)
良辰吉日(2)
杂七杂八(57)
天景共赏(10)
感触文字(23)


最新日志
sunshine girl
过云雨
summer whisper
边走边唱
岛歌
不必在乎我是谁
如果有来生
Fing Fing 下
大明宫
我没有魅力

最新回复
回复:边界类、控制类、实体类
回复:边界类、控制类、实体类
回复:边界类、控制类、实体类
回复:《极地特快》插曲《When Chr
回复:边界类、控制类、实体类
回复:不必在乎我是谁
回复:边界类、控制类、实体类
回复:如果有来生
回复:Fing Fing 下
回复:我没有魅力

留言板
签写新留言

老大&老师,我想你.....
好文好多阿
886电台 好听
cai
您的子域名已开通
hi
祝福
祝福

你好

统计
blog名称:小雨
日志总数:262
评论数量:1273
留言数量:15
访问次数:4673499
建立时间:2005年1月8日

链接

有事?
音乐,永不厌倦
宁静的心情驿站
我的声音
TIPOblog
tipo bbs
appleVB
网页设计
英语学习2
英语学习3
FLASH
网络书籍
网络电台



我的博客朋友
最有技术的blog
xenium
花差花差
瓜少
span
a lai
琦少
陈少
v
阿当
http://www.ypb.cc/
痞子若鱼
另一个同行
年轻人bcims

 




W3CHINA Blog首页    管理页面    写新日志    退出

[知识积累]有验证返回消息的 struts
小雨 发表于 2007/12/8 16:51:57

1 资源文件MessageResources.properties #   Licensed to the Apache Software Foundation (ASF) under one or more#   contributor license agreements.  See the NOTICE file distributed with#   this work for additional information regarding copyright ownership.#   The ASF licenses this file to You under the Apache License, Version 2.0#   (the "License"); you may not use this file except in compliance with#   the License.  You may obtain a copy of the License at##       http://www.apache.org/licenses/LICENSE-2.0##   Unless required by applicable law or agreed to in writing, software#   distributed under the License is distributed on an "AS IS" BASIS,#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.#   See the License for the specific language governing permissions and#   limitations under the License. # -- Standard Errors --errors.header=<ul>errors.prefix=<li class="error">errors.suffix=</li>errors.footer=</ul> # -- Struts Validator Error Messages --errors.required={0} is required.# mask 实际上是invalid的错误消息 是由validator-rules.xml设定的errors.invalid={0} is invalid. # -- buttons --button.submit=Submit # -- prompts --prompt.logName=Nameprompt.passWord=pass Wordprompt.mask=mask 2 validation.xml <?xml version="1.0" encoding="ISO-8859-1" ?><!--    Licensed to the Apache Software Foundation (ASF) under one or more    contributor license agreements.  See the NOTICE file distributed with    this work for additional information regarding copyright ownership.    The ASF licenses this file to You under the Apache License, Version 2.0    (the "License"); you may not use this file except in compliance with    the License.  You may obtain a copy of the License at            http://www.apache.org/licenses/LICENSE-2.0       Unless required by applicable law or agreed to in writing, software    distributed under the License is distributed on an "AS IS" BASIS,    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.    See the License for the specific language governing permissions and    limitations under the License.--> <!DOCTYPE form-validation PUBLIC     "-//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.3.0//EN"     "http://jakarta.apache.org/commons/dtds/validator_1_3_0.dtd"> <form-validation> <!--     This is a minimal Validator form file with a couple of examples.-->     <global>         <!-- An example global constant        <constant>            <constant-name>postalCode</constant-name>            <constant-value>^\d{5}\d*$</constant-value>        </constant>        end example-->     </global>     <formset>         <!-- An example form -->        <form name="simpleForm">            <field                property="logName"                depends="required">                    <arg key="prompt.logName"/>            </field>                    <field property="passWord" depends="mask,required">               <arg key="prompt.mask" />    <var>     <var-name>mask</var-name>     <var-value>^\d{5}\d*$</var-value>    </var>    </field>        </form>    </formset></form-validation> 3validator-rules.xml <?xml version="1.0" encoding="ISO-8859-1" ?><!--    Licensed to the Apache Software Foundation (ASF) under one or more    contributor license agreements.  See the NOTICE file distributed with    this work for additional information regarding copyright ownership.    The ASF licenses this file to You under the Apache License, Version 2.0    (the "License"); you may not use this file except in compliance with    the License.  You may obtain a copy of the License at            http://www.apache.org/licenses/LICENSE-2.0       Unless required by applicable law or agreed to in writing, software    distributed under the License is distributed on an "AS IS" BASIS,    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.    See the License for the specific language governing permissions and    limitations under the License.--> <!DOCTYPE struts-config PUBLIC          "-//Apache Software Foundation//DTD Struts Configuration 1.3//EN"          "http://struts.apache.org/dtds/struts-config_1_3.dtd"> <struts-config>      <form-beans>        <form-bean name="simpleForm" type="org.cjea.Struts.example.RegUserForm"/>                 </form-beans>    <action-mappings>        <action path="/RegUser"                type="org.cjea.Struts.example.RegUserAction"                name="simpleForm"                scope="request"                input="/index.jsp"                validate="true">            <forward name="success" path="/html-good.jsp"/>            <forward name="fails" path="/html-error.jsp"/>        </action>    </action-mappings>    <message-resources parameter="org.MessageResources" />     <plug-in className="org.apache.struts.validator.ValidatorPlugIn">        <set-property property="pathnames"                      value="/WEB-INF/validator-rules.xml,                             /WEB-INF/validation.xml" />    </plug-in> </struts-config>  

阅读全文(3628) | 回复(1) | 编辑 | 精华

回复:有验证返回消息的 struts
小雨发表评论于2007/12/10 14:52:54

资源文件中的中文问题http://www.huuoo.com/thread-15346-1-1.html  native2ascii -encoding gbk MessageResources.properties temp.properties native2ascii 工具在jdk\bin目录下 这里将根据MessageResources.properties输出了一个临时文件temp.properties,然后把MessageResources.properties中的文件内容替换为这个临时文件的内容就可以了。( M4

个人主页 | 引用回复 | 主人回复 | 返回 | 编辑 | 删除

» 1 »

发表评论:
昵称:
密码:
主页:
标题:
验证码:  (不区分大小写,请仔细填写,输错需重写评论内容!)
站点首页 | 联系我们 | 博客注册 | 博客登陆

Sponsored By W3CHINA
W3CHINA Blog 0.8 Processed in 0.313 second(s), page refreshed 144768461 times.
《全国人大常委会关于维护互联网安全的决定》  《计算机信息网络国际联网安全保护管理办法》
苏ICP备05006046号