﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-Skynet-随笔分类-struct</title><link>http://www.blogjava.net/Good-Game/category/23013.html</link><description /><language>zh-cn</language><lastBuildDate>Tue, 22 Apr 2008 07:29:34 GMT</lastBuildDate><pubDate>Tue, 22 Apr 2008 07:29:34 GMT</pubDate><ttl>60</ttl><item><title>struct 2 apps 学习（1）</title><link>http://www.blogjava.net/Good-Game/archive/2008/04/21/194561.html</link><dc:creator>G_G</dc:creator><author>G_G</author><pubDate>Mon, 21 Apr 2008 09:51:00 GMT</pubDate><guid>http://www.blogjava.net/Good-Game/archive/2008/04/21/194561.html</guid><wfw:comment>http://www.blogjava.net/Good-Game/comments/194561.html</wfw:comment><comments>http://www.blogjava.net/Good-Game/archive/2008/04/21/194561.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/Good-Game/comments/commentRss/194561.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Good-Game/services/trackbacks/194561.html</trackback:ping><description><![CDATA[
		<b>struts2-blank-2.0.11.1.war</b>
		<br />
		<br />
		<font color="#a52a2a">
				<b>web.xml:<br /></b>
		</font>
		<div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;">
				<!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>-->
				<span style="color: rgb(0, 0, 255);">&lt;?</span>
				<span style="color: rgb(255, 0, 255);">xml version="1.0" encoding="UTF-8"</span>
				<span style="color: rgb(0, 0, 255);">?&gt;</span>
				<span style="color: rgb(0, 0, 0);">
						<br />
				</span>
				<span style="color: rgb(0, 0, 255);">&lt;</span>
				<span style="color: rgb(128, 0, 0);">web-app </span>
				<span style="color: rgb(255, 0, 0);">id</span>
				<span style="color: rgb(0, 0, 255);">="WebApp_9"</span>
				<span style="color: rgb(255, 0, 0);"> version</span>
				<span style="color: rgb(0, 0, 255);">="2.4"</span>
				<span style="color: rgb(255, 0, 0);"> xmlns</span>
				<span style="color: rgb(0, 0, 255);">="http://java.sun.com/xml/ns/j2ee"</span>
				<span style="color: rgb(255, 0, 0);"> xmlns:xsi</span>
				<span style="color: rgb(0, 0, 255);">="http://www.w3.org/2001/XMLSchema-instance"</span>
				<span style="color: rgb(255, 0, 0);"> xsi:schemaLocation</span>
				<span style="color: rgb(0, 0, 255);">="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"</span>
				<span style="color: rgb(0, 0, 255);">&gt;</span>
				<span style="color: rgb(0, 0, 0);">
						<br />
						<br />    </span>
				<span style="color: rgb(0, 0, 255);">&lt;</span>
				<span style="color: rgb(128, 0, 0);">display-name</span>
				<span style="color: rgb(0, 0, 255);">&gt;</span>
				<span style="color: rgb(0, 0, 0);">Struts Blank</span>
				<span style="color: rgb(0, 0, 255);">&lt;/</span>
				<span style="color: rgb(128, 0, 0);">display-name</span>
				<span style="color: rgb(0, 0, 255);">&gt;</span>
				<span style="color: rgb(0, 0, 0);">
						<br />
						<br />    </span>
				<span style="color: rgb(0, 0, 255);">&lt;</span>
				<span style="color: rgb(128, 0, 0);">filter</span>
				<span style="color: rgb(0, 0, 255);">&gt;</span>
				<span style="color: rgb(0, 0, 0);">
						<br />        </span>
				<span style="color: rgb(0, 0, 255);">&lt;</span>
				<span style="color: rgb(128, 0, 0);">filter-name</span>
				<span style="color: rgb(0, 0, 255);">&gt;</span>
				<span style="color: rgb(0, 0, 0);">struts2</span>
				<span style="color: rgb(0, 0, 255);">&lt;/</span>
				<span style="color: rgb(128, 0, 0);">filter-name</span>
				<span style="color: rgb(0, 0, 255);">&gt;</span>
				<span style="color: rgb(0, 0, 0);">
						<br />        <br /></span>
				<span style="color: rgb(0, 128, 0);">    &lt;!--</span>
				<span style="color: rgb(0, 128, 0);"> struct 2 处理类  </span>
				<span style="color: rgb(0, 128, 0);">--&gt;<br />    &lt;!-- </span>
				<span style="color: rgb(0, 128, 0);">相应需要jar: <br />                commons-logging-1.0.4.jar</span>
				<span style="color: rgb(0, 128, 0);">
						<br />                    freemarker-2.3.8.jar<br />                    ognl-2.6.11.jar<br />                struts2-core-2.0.11.1.jar<br />                    xwork-2.0.4.jar<br />     --&gt;</span>
				<span style="color: rgb(0, 0, 255);">&lt;</span>
				<span style="color: rgb(128, 0, 0);">filter-class</span>
				<span style="color: rgb(0, 0, 255);">&gt;</span>
				<span style="color: rgb(0, 0, 0);">org.apache.struts2.dispatcher.FilterDispatcher</span>
				<span style="color: rgb(0, 0, 255);">&lt;/</span>
				<span style="color: rgb(128, 0, 0);">filter-class</span>
				<span style="color: rgb(0, 0, 255);">&gt;</span>
				<span style="color: rgb(0, 0, 0);">
				</span>
				<span style="color: rgb(0, 0, 255);">&lt;/</span>
				<span style="color: rgb(128, 0, 0);">filter</span>
				<span style="color: rgb(0, 0, 255);">&gt;<br /><br /></span>
				<span style="color: rgb(0, 0, 0);">    </span>
				<span style="color: rgb(0, 128, 0);">&lt;!--</span>
				<span style="color: rgb(0, 128, 0);">  默认覆盖</span>
				<span style="color: rgb(0, 128, 0);">全部</span>
				<span style="color: rgb(0, 128, 0);">路径  </span>
				<span style="color: rgb(0, 128, 0);">--&gt;</span>
				<span style="color: rgb(0, 0, 0);">
						<br />    </span>
				<span style="color: rgb(0, 0, 255);">&lt;</span>
				<span style="color: rgb(128, 0, 0);">filter-mapping</span>
				<span style="color: rgb(0, 0, 255);">&gt;</span>
				<span style="color: rgb(0, 0, 0);">
						<br />        </span>
				<span style="color: rgb(0, 0, 255);">&lt;</span>
				<span style="color: rgb(128, 0, 0);">filter-name</span>
				<span style="color: rgb(0, 0, 255);">&gt;</span>
				<span style="color: rgb(0, 0, 0);">struts2</span>
				<span style="color: rgb(0, 0, 255);">&lt;/</span>
				<span style="color: rgb(128, 0, 0);">filter-name</span>
				<span style="color: rgb(0, 0, 255);">&gt;</span>
				<span style="color: rgb(0, 0, 0);">
						<br />        </span>
				<span style="color: rgb(0, 0, 255);">&lt;</span>
				<span style="color: rgb(128, 0, 0);">url-pattern</span>
				<span style="color: rgb(0, 0, 255);">&gt;</span>
				<span style="color: rgb(0, 0, 0);">/*</span>
				<span style="color: rgb(0, 0, 255);">&lt;/</span>
				<span style="color: rgb(128, 0, 0);">url-pattern</span>
				<span style="color: rgb(0, 0, 255);">&gt;</span>
				<span style="color: rgb(0, 0, 0);">
						<br />    </span>
				<span style="color: rgb(0, 0, 255);">&lt;/</span>
				<span style="color: rgb(128, 0, 0);">filter-mapping</span>
				<span style="color: rgb(0, 0, 255);">&gt;</span>
				<span style="color: rgb(0, 0, 0);">
						<br />
						<br />    </span>
				<span style="color: rgb(0, 128, 0);">&lt;!--</span>
				<span style="color: rgb(0, 128, 0);"> 初始页面 </span>
				<span style="color: rgb(0, 128, 0);">--&gt;</span>
				<span style="color: rgb(0, 0, 0);">
						<br />    </span>
				<span style="color: rgb(0, 0, 255);">&lt;</span>
				<span style="color: rgb(128, 0, 0);">welcome-file-list</span>
				<span style="color: rgb(0, 0, 255);">&gt;</span>
				<span style="color: rgb(0, 0, 0);">
						<br />        </span>
				<span style="color: rgb(0, 0, 255);">&lt;</span>
				<span style="color: rgb(128, 0, 0);">welcome-file</span>
				<span style="color: rgb(0, 0, 255);">&gt;</span>
				<span style="color: rgb(0, 0, 0);">index.html</span>
				<span style="color: rgb(0, 0, 255);">&lt;/</span>
				<span style="color: rgb(128, 0, 0);">welcome-file</span>
				<span style="color: rgb(0, 0, 255);">&gt;</span>
				<span style="color: rgb(0, 0, 0);">
						<br />    </span>
				<span style="color: rgb(0, 0, 255);">&lt;/</span>
				<span style="color: rgb(128, 0, 0);">welcome-file-list</span>
				<span style="color: rgb(0, 0, 255);">&gt;</span>
				<span style="color: rgb(0, 0, 0);">
						<br />
						<br />
				</span>
				<span style="color: rgb(0, 0, 255);">&lt;/</span>
				<span style="color: rgb(128, 0, 0);">web-app</span>
				<span style="color: rgb(0, 0, 255);">&gt;</span>
				<span style="color: rgb(0, 0, 0);">
						<br />
				</span>
		</div>
		<br />
		<font color="#a52a2a">
				<b>index.html:</b>
		</font>
		<br />
		<div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;">
				<!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>-->
				<span style="color: rgb(0, 0, 0);">
						<img src="http://www.blogjava.net/images/dot.gif" />
				</span>
				<span style="color: rgb(0, 0, 255);">
				</span>
				<span style="color: rgb(0, 0, 0);">
						<img src="http://www.blogjava.net/images/dot.gif" />
						<br />
				</span>
				<span style="color: rgb(0, 0, 255);">    &lt;</span>
				<span style="color: rgb(128, 0, 0);">head</span>
				<span style="color: rgb(0, 0, 255);">&gt;</span>
				<span style="color: rgb(0, 0, 255);">
				</span>
				<span style="color: rgb(0, 0, 0);">
						<br />        </span>
				<span style="color: rgb(0, 128, 0);">&lt;!--</span>
				<span style="color: rgb(0, 128, 0);"> 利用html 跳转 </span>
				<span style="color: rgb(0, 128, 0);">--&gt;</span>
				<span style="color: rgb(0, 0, 0);">
						<br />        </span>
				<span style="color: rgb(0, 0, 255);">&lt;</span>
				<span style="color: rgb(128, 0, 0);">META </span>
				<span style="color: rgb(255, 0, 0);">HTTP-EQUIV</span>
				<span style="color: rgb(0, 0, 255);">="Refresh"</span>
				<span style="color: rgb(255, 0, 0);"> CONTENT</span>
				<span style="color: rgb(0, 0, 255);">="0;URL=example/HelloWorld.action"</span>
				<span style="color: rgb(0, 0, 255);">&gt;</span>
				<span style="color: rgb(0, 0, 0);">
						<br />
				</span>
				<span style="color: rgb(0, 0, 255);">    &lt;/</span>
				<span style="color: rgb(128, 0, 0);">head</span>
				<span style="color: rgb(0, 0, 255);">&gt;</span>
				<span style="color: rgb(0, 0, 0);">
						<br />
						<img src="http://www.blogjava.net/images/dot.gif" />
						<img src="http://www.blogjava.net/images/dot.gif" />
				</span>
		</div>
		<br />
		<font color="#a52a2a">
				<b>struct.xml</b>
		</font>
		<br />
		<div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;">
				<!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>-->
				<span style="color: rgb(0, 0, 0);">
						<img src="http://www.blogjava.net/images/dot.gif" />
						<img src="http://www.blogjava.net/images/dot.gif" />
						<br />   </span>
				<span style="color: rgb(0, 128, 0);">&lt;!--</span>
				<span style="color: rgb(0, 128, 0);"> 模块化注入  </span>
				<span style="color: rgb(0, 128, 0);">--&gt;</span>
				<span style="color: rgb(0, 0, 0);">
						<br />   </span>
				<span style="color: rgb(0, 0, 255);">&lt;</span>
				<span style="color: rgb(128, 0, 0);">include </span>
				<span style="color: rgb(255, 0, 0);">file</span>
				<span style="color: rgb(0, 0, 255);">="example.xml"</span>
				<span style="color: rgb(0, 0, 255);">/&gt;</span>
				<span style="color: rgb(0, 0, 0);">
						<br />
						<br />    </span>
				<span style="color: rgb(0, 128, 0);">&lt;!--</span>
				<span style="color: rgb(0, 128, 0);"> Add packages here </span>
				<span style="color: rgb(0, 128, 0);">--&gt;</span>
				<span style="color: rgb(0, 0, 0);">
						<br />    <img src="http://www.blogjava.net/images/dot.gif" /><img src="http://www.blogjava.net/images/dot.gif" /></span>
		</div>
		<br />
		<br />
		<br />example.xml<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">&lt;?</span><span style="color: rgb(255, 0, 255);">xml version="1.0" encoding="UTF-8" </span><span style="color: rgb(0, 0, 255);">?&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;!</span><span style="color: rgb(255, 0, 255);">DOCTYPE struts PUBLIC<br />        "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"<br />        "http://struts.apache.org/dtds/struts-2.0.dtd"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /><br /></span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">struts</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />    </span><span style="color: rgb(0, 128, 0);">&lt;!--</span><span style="color: rgb(0, 128, 0);"> 定义域空间 </span><span style="color: rgb(0, 128, 0);">--&gt;</span><span style="color: rgb(0, 0, 0);"><br />    </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">package </span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="example"</span><span style="color: rgb(255, 0, 0);"> namespace</span><span style="color: rgb(0, 0, 255);">="/example"</span><span style="color: rgb(255, 0, 0);"> extends</span><span style="color: rgb(0, 0, 255);">="struts-default"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /><br />        </span><span style="color: rgb(0, 128, 0);">&lt;!--</span><span style="color: rgb(0, 128, 0);"> 域一般访问 </span><span style="color: rgb(0, 128, 0);">--&gt;</span><span style="color: rgb(0, 0, 0);"><br />        </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">action </span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="HelloWorld"</span><span style="color: rgb(255, 0, 0);"> class</span><span style="color: rgb(0, 0, 255);">="example.HelloWorld"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />            </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">result</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">/example/HelloWorld.jsp</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">result</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />        </span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">action</span><span style="color: rgb(0, 0, 255);">&gt;<br /><font color="#006400">&lt;!--</font></span><font color="#006400">HelloWord.java（国际化） start --&gt;</font><span style="color: rgb(0, 0, 255);"><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><img id="Code_Closed_Image_172816" onclick="this.style.display='none'; Code_Closed_Text_172816.style.display='none'; Code_Open_Image_172816.style.display='inline'; Code_Open_Text_172816.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align="top" height="16" width="11" /><img id="Code_Open_Image_172816" style="display: none;" onclick="this.style.display='none'; Code_Open_Text_172816.style.display='none'; Code_Closed_Image_172816.style.display='inline'; Code_Closed_Text_172816.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" height="16" width="11" /><span id="Code_Closed_Text_172816" style="border: 1px solid rgb(128, 128, 128); background-color: rgb(255, 255, 255);"></span><span id="Code_Open_Text_172816" style="display: none;"><br /><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 128, 128);"> 1</span> <span style="color: rgb(0, 0, 255);">package</span><span style="color: rgb(0, 0, 0);"> example;<br /></span><span style="color: rgb(0, 128, 128);"> 2</span> <span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);"> 3</span> <span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 128, 0);">/**</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 128, 128);"> 4</span> <span style="color: rgb(0, 128, 0);"> * import com.opensymphony.xwork2.ActionSupport;<br /></span><span style="color: rgb(0, 128, 128);"> 5</span> <span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 128, 128);"> 6</span> <span style="color: rgb(0, 128, 0);">public class ExampleSupport extends ActionSupport {<br /></span><span style="color: rgb(0, 128, 128);"> 7</span> <span style="color: rgb(0, 128, 0);"> </span><span style="color: rgb(0, 128, 0);">*/</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);"> 8</span> <span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">class</span><span style="color: rgb(0, 0, 0);"> HelloWorld </span><span style="color: rgb(0, 0, 255);">extends</span><span style="color: rgb(0, 0, 0);"> ExampleSupport {<br /></span><span style="color: rgb(0, 128, 128);"> 9</span> <span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);">10</span> <span style="color: rgb(0, 0, 0);">    </span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">默认方法</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 128, 128);">11</span> <span style="color: rgb(0, 128, 0);"></span><span style="color: rgb(0, 0, 0);">    </span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);"> String execute() </span><span style="color: rgb(0, 0, 255);">throws</span><span style="color: rgb(0, 0, 0);"> Exception {<br /></span><span style="color: rgb(0, 128, 128);">12</span> <span style="color: rgb(0, 0, 0);">        </span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">国际化方法使用 getText( key )<br /></span><span style="color: rgb(0, 128, 128);">13</span> <span style="color: rgb(0, 128, 0);">        </span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);"> 在url中体现-&gt;&gt; HelloWorld.action?request_locale=en/es<br /></span><span style="color: rgb(0, 128, 128);">14</span> <span style="color: rgb(0, 128, 0);">        </span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">国际化配置文件文件 package.properties和package_es.properties</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 128, 128);">15</span> <span style="color: rgb(0, 128, 0);"></span><span style="color: rgb(0, 0, 0);">        setMessage(getText(MESSAGE));<br /></span><span style="color: rgb(0, 128, 128);">16</span> <span style="color: rgb(0, 0, 0);">        </span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);"> SUCCESS;<br /></span><span style="color: rgb(0, 128, 128);">17</span> <span style="color: rgb(0, 0, 0);">    }<br /></span><span style="color: rgb(0, 128, 128);">18</span> <span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);">19</span> <span style="color: rgb(0, 0, 0);">    </span><span style="color: rgb(0, 128, 0);">/**</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 128, 128);">20</span> <span style="color: rgb(0, 128, 0);">     * Provide default valuie for Message property.<br /></span><span style="color: rgb(0, 128, 128);">21</span> <span style="color: rgb(0, 128, 0);">     </span><span style="color: rgb(0, 128, 0);">*/</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);">22</span> <span style="color: rgb(0, 0, 0);">    </span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">static</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">final</span><span style="color: rgb(0, 0, 0);"> String MESSAGE </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">HelloWorld.message</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">;<br /></span><span style="color: rgb(0, 128, 128);">23</span> <span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);">24</span> <span style="color: rgb(0, 0, 0);">    </span><span style="color: rgb(0, 128, 0);">/**</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 128, 128);">25</span> <span style="color: rgb(0, 128, 0);">     * Field for Message property.<br /></span><span style="color: rgb(0, 128, 128);">26</span> <span style="color: rgb(0, 128, 0);">     </span><span style="color: rgb(0, 128, 0);">*/</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);">27</span> <span style="color: rgb(0, 0, 0);">    </span><span style="color: rgb(0, 0, 255);">private</span><span style="color: rgb(0, 0, 0);"> String message;<br /></span><span style="color: rgb(0, 128, 128);">28</span> <span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);">29</span> <span style="color: rgb(0, 0, 0);">    </span><span style="color: rgb(0, 128, 0);">/**</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 128, 128);">30</span> <span style="color: rgb(0, 128, 0);">     * Return Message property.<br /></span><span style="color: rgb(0, 128, 128);">31</span> <span style="color: rgb(0, 128, 0);">     *<br /></span><span style="color: rgb(0, 128, 128);">32</span> <span style="color: rgb(0, 128, 0);">     * </span><span style="color: rgb(128, 128, 128);">@return</span><span style="color: rgb(0, 128, 0);"> Message property<br /></span><span style="color: rgb(0, 128, 128);">33</span> <span style="color: rgb(0, 128, 0);">     </span><span style="color: rgb(0, 128, 0);">*/</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);">34</span> <span style="color: rgb(0, 0, 0);">    </span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);"> String getMessage() {<br /></span><span style="color: rgb(0, 128, 128);">35</span> <span style="color: rgb(0, 0, 0);">        </span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);"> message;<br /></span><span style="color: rgb(0, 128, 128);">36</span> <span style="color: rgb(0, 0, 0);">    }<br /></span><span style="color: rgb(0, 128, 128);">37</span> <span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);">38</span> <span style="color: rgb(0, 0, 0);">    </span><span style="color: rgb(0, 128, 0);">/**</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 128, 128);">39</span> <span style="color: rgb(0, 128, 0);">     * Set Message property.<br /></span><span style="color: rgb(0, 128, 128);">40</span> <span style="color: rgb(0, 128, 0);">     *<br /></span><span style="color: rgb(0, 128, 128);">41</span> <span style="color: rgb(0, 128, 0);">     * </span><span style="color: rgb(128, 128, 128);">@param</span><span style="color: rgb(0, 128, 0);"> message Text to display on HelloWorld page.<br /></span><span style="color: rgb(0, 128, 128);">42</span> <span style="color: rgb(0, 128, 0);">     </span><span style="color: rgb(0, 128, 0);">*/</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);">43</span> <span style="color: rgb(0, 0, 0);">    </span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">void</span><span style="color: rgb(0, 0, 0);"> setMessage(String message) {<br /></span><span style="color: rgb(0, 128, 128);">44</span> <span style="color: rgb(0, 0, 0);">        </span><span style="color: rgb(0, 0, 255);">this</span><span style="color: rgb(0, 0, 0);">.message </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> message;<br /></span><span style="color: rgb(0, 128, 128);">45</span> <span style="color: rgb(0, 0, 0);">    }<br /></span><span style="color: rgb(0, 128, 128);">46</span> <span style="color: rgb(0, 0, 0);">}</span></span></div></span><span style="color: rgb(0, 0, 255);"><font color="#006400">&lt;!--</font></span><font color="#006400">HelloWord.java（国际化） end--&gt;</font><br /><span style="color: rgb(0, 0, 255);"><br /></span><span style="color: rgb(0, 0, 0);"><br />       </span><span style="color: rgb(0, 128, 0);">&lt;!--</span><span style="color: rgb(0, 128, 0);"> （关键：action利用正则选择方法）Login(_*)  &gt;method="{1}"  </span><span style="color: rgb(0, 128, 0);">--&gt;</span><span style="color: rgb(0, 0, 0);"><br />        </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">action </span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="Login_*"</span><span style="color: rgb(255, 0, 0);"> method</span><span style="color: rgb(0, 0, 255);">="{1}"</span><span style="color: rgb(255, 0, 0);"> class</span><span style="color: rgb(0, 0, 255);">="example.Login"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />            </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">result </span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="input"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">/example/Login.jsp</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">result</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />            </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">result </span><span style="color: rgb(255, 0, 0);">type</span><span style="color: rgb(0, 0, 255);">="redirect-action"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">Menu</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">result</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />        </span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">action</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);"><font color="#006400">&lt;!-</font></span><font color="#006400"><span style="color: rgb(0, 0, 255);"></span></font><font color="#006400">- example.Login（验证框架） start --&gt;<br />java<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><img id="Code_Closed_Image_174952" onclick="this.style.display='none'; Code_Closed_Text_174952.style.display='none'; Code_Open_Image_174952.style.display='inline'; Code_Open_Text_174952.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align="top" height="16" width="11" /><img id="Code_Open_Image_174952" style="display: none;" onclick="this.style.display='none'; Code_Open_Text_174952.style.display='none'; Code_Closed_Image_174952.style.display='inline'; Code_Closed_Text_174952.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" height="16" width="11" /><span id="Code_Closed_Text_174952" style="border: 1px solid rgb(128, 128, 128); background-color: rgb(255, 255, 255);"></span><span id="Code_Open_Text_174952" style="display: none;"><br /><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 128, 128);"> 1</span> <span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">class</span><span style="color: rgb(0, 0, 0);"> Login </span><span style="color: rgb(0, 0, 255);">extends</span><span style="color: rgb(0, 0, 0);"> ExampleSupport {<br /></span><span style="color: rgb(0, 128, 128);"> 2</span> <span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);"> 3</span> <span style="color: rgb(0, 0, 0);">    </span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);"> String execute() </span><span style="color: rgb(0, 0, 255);">throws</span><span style="color: rgb(0, 0, 0);"> Exception {<br /></span><span style="color: rgb(0, 128, 128);"> 4</span> <span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);"> 5</span> <span style="color: rgb(0, 0, 0);">        </span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);"> (isInvalid(getUsername())) </span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);"> INPUT;<br /></span><span style="color: rgb(0, 128, 128);"> 6</span> <span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);"> 7</span> <span style="color: rgb(0, 0, 0);">        </span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);"> (isInvalid(getPassword())) </span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);"> INPUT;<br /></span><span style="color: rgb(0, 128, 128);"> 8</span> <span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);"> 9</span> <span style="color: rgb(0, 0, 0);">        </span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);"> SUCCESS;<br /></span><span style="color: rgb(0, 128, 128);">10</span> <span style="color: rgb(0, 0, 0);">    }<br /></span><span style="color: rgb(0, 128, 128);">11</span> <span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);">12</span> <span style="color: rgb(0, 0, 0);">    </span><span style="color: rgb(0, 0, 255);">private</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">boolean</span><span style="color: rgb(0, 0, 0);"> isInvalid(String value) {<br /></span><span style="color: rgb(0, 128, 128);">13</span> <span style="color: rgb(0, 0, 0);">        </span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);"> (value </span><span style="color: rgb(0, 0, 0);">==</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">null</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">||</span><span style="color: rgb(0, 0, 0);"> value.length() </span><span style="color: rgb(0, 0, 0);">==</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">);<br /></span><span style="color: rgb(0, 128, 128);">14</span> <span style="color: rgb(0, 0, 0);">    }</span></span></div>Login-validation.xml<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><img id="Code_Closed_Image_175040" onclick="this.style.display='none'; Code_Closed_Text_175040.style.display='none'; Code_Open_Image_175040.style.display='inline'; Code_Open_Text_175040.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align="top" height="16" width="11" /><img id="Code_Open_Image_175040" style="display: none;" onclick="this.style.display='none'; Code_Open_Text_175040.style.display='none'; Code_Closed_Image_175040.style.display='inline'; Code_Closed_Text_175040.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" height="16" width="11" /><span id="Code_Closed_Text_175040" style="border: 1px solid rgb(128, 128, 128); background-color: rgb(255, 255, 255);"></span><span id="Code_Open_Text_175040" style="display: none;"><br /><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 128, 128);"> 1</span> <span style="color: rgb(0, 0, 255);">&lt;!</span><span style="color: rgb(255, 0, 255);">DOCTYPE validators PUBLIC<br /></span><span style="color: rgb(0, 128, 128);"> 2</span> <span style="color: rgb(255, 0, 255);">        "-//OpenSymphony Group//XWork Validator 1.0.2//EN"<br /></span><span style="color: rgb(0, 128, 128);"> 3</span> <span style="color: rgb(255, 0, 255);">        "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);"> 4</span> <span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);"> 5</span> <span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">validators</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);"> 6</span> <span style="color: rgb(0, 0, 0);">    </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">field </span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="username"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);"> 7</span> <span style="color: rgb(0, 0, 0);">        </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">field-validator </span><span style="color: rgb(255, 0, 0);">type</span><span style="color: rgb(0, 0, 255);">="requiredstring"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);"> 8</span> <span style="color: rgb(0, 0, 0);">            </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">message </span><span style="color: rgb(255, 0, 0);">key</span><span style="color: rgb(0, 0, 255);">="requiredstring"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);"> 9</span> <span style="color: rgb(0, 0, 0);">        </span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">field-validator</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);">10</span> <span style="color: rgb(0, 0, 0);">    </span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">field</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);">11</span> <span style="color: rgb(0, 0, 0);">    </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">field </span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="password"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);">12</span> <span style="color: rgb(0, 0, 0);">        </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">field-validator </span><span style="color: rgb(255, 0, 0);">type</span><span style="color: rgb(0, 0, 255);">="requiredstring"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);">13</span> <span style="color: rgb(0, 0, 0);">            </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">message </span><span style="color: rgb(255, 0, 0);">key</span><span style="color: rgb(0, 0, 255);">="requiredstring"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);">14</span> <span style="color: rgb(0, 0, 0);">        </span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">field-validator</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);">15</span> <span style="color: rgb(0, 0, 0);">    </span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">field</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);">16</span> <span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">validators</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);">17</span> <span style="color: rgb(0, 0, 0);"></span></span></div><br /></font><span style="color: rgb(0, 0, 255);"><font color="#006400">&lt;!-</font></span><font color="#006400"><span style="color: rgb(0, 0, 255);"></span></font><font color="#006400">- example.Login（验证框架） end --&gt;<br /></font><font color="#006400"><br /><br /></font><span style="color: rgb(0, 0, 0);"><br />        </span><span style="color: rgb(0, 128, 0);">&lt;!--</span><span style="color: rgb(0, 128, 0);"> jsp 封包 如:Missing.action就是Missiong.jsp </span><span style="color: rgb(0, 128, 0);">--&gt;</span><span style="color: rgb(0, 0, 0);"><br />        </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">action </span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="*"</span><span style="color: rgb(255, 0, 0);"> class</span><span style="color: rgb(0, 0, 255);">="example.ExampleSupport"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />            </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">result</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">/example/{1}.jsp</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">result</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />        </span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">action</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /><br />        </span><span style="color: rgb(0, 128, 0);">&lt;!--</span><span style="color: rgb(0, 128, 0);"> Add actions here </span><span style="color: rgb(0, 128, 0);">--&gt;</span><span style="color: rgb(0, 0, 0);"><br />    </span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">package</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">struts</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span></div><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><img src ="http://www.blogjava.net/Good-Game/aggbug/194561.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Good-Game/" target="_blank">G_G</a> 2008-04-21 17:51 <a href="http://www.blogjava.net/Good-Game/archive/2008/04/21/194561.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Struts  validation 小例</title><link>http://www.blogjava.net/Good-Game/archive/2007/08/09/135434.html</link><dc:creator>G_G</dc:creator><author>G_G</author><pubDate>Thu, 09 Aug 2007 04:03:00 GMT</pubDate><guid>http://www.blogjava.net/Good-Game/archive/2007/08/09/135434.html</guid><wfw:comment>http://www.blogjava.net/Good-Game/comments/135434.html</wfw:comment><comments>http://www.blogjava.net/Good-Game/archive/2007/08/09/135434.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/Good-Game/comments/commentRss/135434.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Good-Game/services/trackbacks/135434.html</trackback:ping><description><![CDATA[
		<font color="#ff0000">
				<b>问题：</b>
		</font>当IE 禁用javascript 怎么验证数据<br /><font color="#0000ff"><b>解决：</b></font>Struts validation  框架 <br /><br />1）先 建 Form类  <font color="#800080"> extends</font><font color="#0000ff">ValidatorForm  <br />    <div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">    </span><span style="color: rgb(0, 0, 255);">private</span><span style="color: rgb(0, 0, 0);"> String name ;<br />    </span><span style="color: rgb(0, 0, 255);">private</span><span style="color: rgb(0, 0, 0);"> String pass ;    <br /></span></div><br /><font color="#000000">2) Jsp 建立<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">  </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">body</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />      </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">font </span><span style="color: rgb(255, 0, 0);">color</span><span style="color: rgb(0, 0, 255);">="red"</span><span style="color: rgb(255, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">&gt;&lt;</span><span style="color: rgb(128, 0, 0);">html:errors</span><span style="color: rgb(0, 0, 255);">/&gt;&lt;/</span><span style="color: rgb(128, 0, 0);">font</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />    </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">html:form </span><span style="color: rgb(255, 0, 0);">action</span><span style="color: rgb(0, 0, 255);">="/test"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />        name:</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">html:text </span><span style="color: rgb(255, 0, 0);">property</span><span style="color: rgb(0, 0, 255);">="name"</span><span style="color: rgb(255, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br />        pass:</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">html:text </span><span style="color: rgb(255, 0, 0);">property</span><span style="color: rgb(0, 0, 255);">="pass"</span><span style="color: rgb(255, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br />        </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">html:submit</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">submit</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">html:submit</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />    </span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">html:form</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />  </span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">body</span><span style="color: rgb(0, 0, 255);">&gt;</span></div><br />3）validator.xml建立<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">&lt;?</span><span style="color: rgb(255, 0, 255);">xml version='1.0'</span><span style="color: rgb(0, 0, 255);">?&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;!</span><span style="color: rgb(255, 0, 255);">DOCTYPE form-validation PUBLIC<br />          "-//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.0//EN"<br />          "http://jakarta.apache.org/commons/dtds/validator_1_0.dtd"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />          <br /></span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">form-validation</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />    </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">formset</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />        </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">form </span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="testForm"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />            </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">field </span><span style="color: rgb(255, 0, 0);">property</span><span style="color: rgb(0, 0, 255);">="name"</span><span style="color: rgb(255, 0, 0);"> depends</span><span style="color: rgb(0, 0, 255);">="minlength,maxlength,mask"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />                </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">msg </span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="minlength"</span><span style="color: rgb(255, 0, 0);"> key</span><span style="color: rgb(0, 0, 255);">="err.minlength"</span><span style="color: rgb(255, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">/&gt;  <br />                <font color="#008000">&lt;!-- 当 minlength错时 msg 激活 --&gt;</font><br /></span><span style="color: rgb(0, 0, 0);">                </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">msg </span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="maxlength"</span><span style="color: rgb(255, 0, 0);"> key</span><span style="color: rgb(0, 0, 255);">="err.maxlength"</span><span style="color: rgb(255, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br />                </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">arg0 </span><span style="color: rgb(255, 0, 0);">key</span><span style="color: rgb(0, 0, 255);">="${var:maxlength}"</span><span style="color: rgb(255, 0, 0);">  resource</span><span style="color: rgb(0, 0, 255);">="false"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br />                </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">arg1 </span><span style="color: rgb(255, 0, 0);">key</span><span style="color: rgb(0, 0, 255);">="${var:minlength}"</span><span style="color: rgb(255, 0, 0);"> resource</span><span style="color: rgb(0, 0, 255);">="false"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br />                </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">var</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />                    </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">var-name</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">maxlength</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">var-name</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />                    </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">var-value</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">5</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">var-value</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />                </span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">var</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />                </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">var</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />                    </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">var-name</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">minlength</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">var-name</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />                    </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">var-value</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">3</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">var-value</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />                </span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">var</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />            </span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">field</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />                <br />        </span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">form</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />    </span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">formset</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">form-validation</span><span style="color: rgb(0, 0, 255);">&gt;</span></div><br />4)ApplicationResources.properties <br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 128, 0);">#</span><span style="color: rgb(0, 128, 0);"> Resources for parameter 'com.validator.struts.ApplicationResources'</span><span style="color: rgb(0, 128, 0);"><br />#</span><span style="color: rgb(0, 128, 0);"> Project P/validator</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">err</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">minlength</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> err </span><span style="color: rgb(0, 128, 128);">min</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">3</span><span style="color: rgb(0, 0, 0);"><br />err</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">maxlength</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> err </span><span style="color: rgb(0, 128, 128);">max</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">&gt;</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">5</span></div><br /><b><font color="#008000">心得： validation  这是个难啃的骨头 要多多的接触</font></b><br /><br /></font></font><img src ="http://www.blogjava.net/Good-Game/aggbug/135434.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Good-Game/" target="_blank">G_G</a> 2007-08-09 12:03 <a href="http://www.blogjava.net/Good-Game/archive/2007/08/09/135434.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>struts </title><link>http://www.blogjava.net/Good-Game/archive/2007/04/19/111883.html</link><dc:creator>G_G</dc:creator><author>G_G</author><pubDate>Thu, 19 Apr 2007 04:01:00 GMT</pubDate><guid>http://www.blogjava.net/Good-Game/archive/2007/04/19/111883.html</guid><wfw:comment>http://www.blogjava.net/Good-Game/comments/111883.html</wfw:comment><comments>http://www.blogjava.net/Good-Game/archive/2007/04/19/111883.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/Good-Game/comments/commentRss/111883.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Good-Game/services/trackbacks/111883.html</trackback:ping><description><![CDATA[
		<p>初理解 先 在 form 中 要有 time 属性 在运行中 FORM 填充 TIME  </p>
		<div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; font-size: 13px; width: 98%; background-color: rgb(238, 238, 238);">
				<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />
				<span style="color: rgb(0, 0, 0);">        </span>
				<span style="color: rgb(0, 0, 255);">&lt;</span>
				<span style="color: rgb(128, 0, 0);">html:form </span>
				<span style="color: rgb(255, 0, 0);">action</span>
				<span style="color: rgb(0, 0, 255);">="/tAT.do"</span>
				<span style="color: rgb(0, 0, 255);">&gt;</span>
				<span style="color: rgb(0, 0, 0);">
						<br />
						<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />                        </span>
				<span style="color: rgb(0, 0, 255);">&lt;</span>
				<span style="color: rgb(128, 0, 0);">html:text </span>
				<span style="color: rgb(255, 0, 0);">property</span>
				<span style="color: rgb(0, 0, 255);">="time"</span>
				<span style="color: rgb(255, 0, 0);"> size</span>
				<span style="color: rgb(0, 0, 255);">="8"</span>
				<span style="color: rgb(255, 0, 0);"> readonly</span>
				<span style="color: rgb(0, 0, 255);">="true"</span>
				<span style="color: rgb(0, 0, 255);">/&gt;</span>
				<span style="color: rgb(0, 0, 0);">
						<br />
						<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />            </span>
				<span style="color: rgb(0, 0, 255);">&lt;/</span>
				<span style="color: rgb(128, 0, 0);">html:form</span>
				<span style="color: rgb(0, 0, 255);">&gt;</span>
		</div>
<img src ="http://www.blogjava.net/Good-Game/aggbug/111883.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Good-Game/" target="_blank">G_G</a> 2007-04-19 12:01 <a href="http://www.blogjava.net/Good-Game/archive/2007/04/19/111883.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>