??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲电影一级片,久久精品亚洲精品国产欧美kt∨,水莓100在线视频http://www.aygfsteel.com/zxfahjz/category/10440.html软g开发相x面的学习zh-cnTue, 27 Feb 2007 12:23:57 GMTTue, 27 Feb 2007 12:23:57 GMT60logichttp://www.aygfsteel.com/zxfahjz/archive/2006/08/14/63510.htmlzxfzxfMon, 14 Aug 2006 09:05:00 GMThttp://www.aygfsteel.com/zxfahjz/archive/2006/08/14/63510.htmlhttp://www.aygfsteel.com/zxfahjz/comments/63510.htmlhttp://www.aygfsteel.com/zxfahjz/archive/2006/08/14/63510.html#Feedback0http://www.aygfsteel.com/zxfahjz/comments/commentRss/63510.htmlhttp://www.aygfsteel.com/zxfahjz/services/trackbacks/63510.html<logic:equal parameter="showGreen" value="true">
true
</logic:equal>

zxf 2006-08-14 17:05 发表评论
]]>
消息(错误)昄 http://www.aygfsteel.com/zxfahjz/archive/2006/06/12/52129.htmlzxfzxfMon, 12 Jun 2006 02:07:00 GMThttp://www.aygfsteel.com/zxfahjz/archive/2006/06/12/52129.htmlhttp://www.aygfsteel.com/zxfahjz/comments/52129.htmlhttp://www.aygfsteel.com/zxfahjz/archive/2006/06/12/52129.html#Feedback0http://www.aygfsteel.com/zxfahjz/comments/commentRss/52129.htmlhttp://www.aygfsteel.com/zxfahjz/services/trackbacks/52129.html
ActionMessages messages = new ActionMessages();
messages.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("userForm.insert", info.getUserName());
messages.add("activationDate", new ActionMessage("userForm.active", info.getDateLength());

如下可以昄所?/font>消息Qƈ?lt;li>它们放入一个listQ再加上可定制的header/footer
<html:messages id="message" header="errors.header" footer="errors.footer">
<li><bean:write name="message"/></li>
</html:messages>

如下可以指定只显C?font color="#ff0000">某种
message
<html:messages id="message" property="<%= org.apache.struts.action.ActionMessages.GLOBAL_MESSAGE %>">
<li><bean:write name="message"/></li>
</html:messages>

<html:messages id="message" property="activationDate">
<li><bean:write name="message"/></li>
</html:messages>

把Messages换成Errors是错误昄Qؓ了简便,l常一?lt;html:errors/>了事

zxf 2006-06-12 10:07 发表评论
]]>
web.xml元素介绍http://www.aygfsteel.com/zxfahjz/archive/2006/04/27/43478.htmlzxfzxfThu, 27 Apr 2006 01:49:00 GMThttp://www.aygfsteel.com/zxfahjz/archive/2006/04/27/43478.htmlhttp://www.aygfsteel.com/zxfahjz/comments/43478.htmlhttp://www.aygfsteel.com/zxfahjz/archive/2006/04/27/43478.html#Feedback0http://www.aygfsteel.com/zxfahjz/comments/commentRss/43478.htmlhttp://www.aygfsteel.com/zxfahjz/services/trackbacks/43478.html
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
    version="2.4">

</web-app>

其它的元素都攑֜<web-app></web-app>之中?br />
<discription></discription> 是对站台的描q?br /><display-name></display-name> 定义站台的名U?br /><distributable/> 是指定该站台是否可分布式处理

<context-param></context-param> 用来讑֮web站台的环境参敎ͼ它包含两个子元素Q?br />    <param-name></param-name> 用来指定参数的名U?br />    <param-value></param-value> 用来讑֮参数?br />
比如Q?/span>
<context-param>
    <param-name>my_param</param-name>
    <param-value>hello</param-value>
</context-param>

在此讑֮的参敎ͼ可以在servlet中用 getServletContext().getInitParameter("my_param") 来取?br />

<filter></filter> 是用来声明filter的相兌定,它包含以下子元素Q?br />    <filter-name></filter-name> q当然就是指定filter的名?br />    <filter-class></filter-class> q是用来定义filter的类的名U?br />    <init-param></init-param> 用来定义参数Q它有两个子元素Q?br />        <param-name></param-name> 用来指定参数的名U?br />        <param-value></param-value> 用来讑֮参数?br />
比如Q?/span>
<filter>
        <filter-name>setCharacterEncoding</filter-name>
        <filter-class>com.myTest.setCharacterEncodingFilter</filter-class>
        <init-param>
            <param-name>encoding</param-name>
            <param-value>GB2312</param-value>
        </init-param>
</filter>

?/span><filter></filter>同时使用的是<filter-mapping></filter-mapping> 用来定义filter所对应的URLQ它有两个子元素Q?br />    <filter-name></filter-name> 指定filter的名?br />    <url-pattern></url-pattern> 指定filter所对应的URL

比如Q?/span>
<filter-mapping>
        <filter-name>setCharacterEncoding</filter-name>
        <url-pattern>/*</url-pattern>
</filter-mapping>


<listener></listener> 用来讑֮Listener接口Q它的主要子元素?br />    <listener-class></listener-class> 定义Listener的类名称

比如Q?/span>
<listener>
   
<listener-class>com.myTest.ContextListener</listener-class>

</listener>

<servlet></servlet> 用来声明一个servlet的数据,主要有以下子元素Q?br />    <servlet-name>
</servlet-name> 指定servlet的名U?br />    <servlet-class></servlet-class> 指定servlet的类名称
    <jsp-file></jsp-file> 指定web站台中的某个JSP|页的完整\?br />    <init-param></init-param> 用来定义参数Q和前面?lt;init-param>差不?br />
同样Q与<servlet></servlet>一起用的?lt;servlet-mapping></servlet-mapping> 用来定义servlet所对应的URLQ包含两个子元素Q?br />    <servlet-name></servlet-name> 指定servlet的名U?br />    <url-pattern></url-pattern> 指定servlet所对应的URL

比如Q?/span>
<servlet>
        <servlet-name>ShoppingServlet</servlet-name>
        <servlet-class>com.myTest.ShoppingServlet</servlet-class>
</servlet>
   
<servlet-mapping>
        <servlet-name>ShoppingServlet</servlet-name>
        <url-pattern>/shop/ShoppingServlet</url-pattern>
</servlet-mapping>

<session-config></session-config> 用来定义web站台中的session参数Q包含一个子元素Q?/span>
    <session-timeout></session-timeout> 用来定义q个web站台所有session的有效期限,单位为分?/span>

<mime-mapping></mime-mapping> 定义某一个扩展名和某一个MIME Type做对映,包含两个子元素:
    <extension></extension> 扩展名的名称
    <mime-type></mime-type> MIME格式

比如Q?br /><mime-mapping>
    <extension>doc</extension>
    <mime-type>application/vnd.ms-word</mime-type>

</mime-mapping>
<mime-mapping>
    <extension>xls</extension>
    <mime-type>application/vnd.ms-excel</mime-type>

</mime-mapping>

<welcome-file-list></welcom-file-list> 用来定义首页的列单,包含一个子元素Q?/span>
    <welcome-file></welcome-file> 指定首页的文件名U?/span>

比如Q?br /><welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>index.html</welcome-file>

</welcom-file-list>

<error-page></error-page> 用来处理错误代码或异常的面Q有三个子元素:
    <error-code></error-code> 指定错误代码
    <exception-type></exception-type> 指定一个JAVA异常cd
    <location></location> 指定在web站台内的相关资源路径

比如Q?br /><error-page>
    <error-code>404</error-code>
    <location>/error404.jsp</location>

</error-page>
<error-page>
    <exception-type>java.lang.Exception</exception-type>

    <location>/exception.jsp</location>
</error-page>

<taglib></taglib> 用来讑֮JSP|页所用到的Tag Library路径Q有两个子元素:
    <taglib-uri></taglib-uri> 定义TLD文g的URIQ在JSP|页中用taglib指o便可取得该URI的TLD文g
    <taglib-location></taglib-location> 指定TLD文g相对于web站台的存放位|?br />
比如Q?/span>
<taglib>
      <taglib-uri>myTaglib</taglib-uri>
      <taglib-location>/WEB-INF/tlds/MyTaglib.tld</taglib-location>
</taglib>


<resource-ref></resource-ref> 定义利用JNDI取得站台可利用的资源Q有五个子元素:
    <description></description> 资源说明
    <rec-ref-name></rec-ref-name> 资源名称
    <res-type></res-type> 资源U类
    <res-auth></res-auth> 资源l由Application或Container来许?br />    <res-sharing-scope></res-sharing-scope> 资源是否可以׃nQ有Shareable和Unshareable两个|默认?/span>
Shareable

比如Q配|数据库q接池就可在此配|:
<resource-ref>
        <description>JNDI JDBC DataSource of shop</description>
        <res-ref-name>jdbc/sample_db</res-ref-name>
        <res-type>javax.sql.DataSource</res-type>
        <res-auth>Container</res-auth>
</resource-ref>


zxf 2006-04-27 09:49 发表评论
]]>
STRUTS 获取|页的根目录实际地址http://www.aygfsteel.com/zxfahjz/archive/2006/04/20/42089.htmlzxfzxfThu, 20 Apr 2006 01:40:00 GMThttp://www.aygfsteel.com/zxfahjz/archive/2006/04/20/42089.htmlhttp://www.aygfsteel.com/zxfahjz/comments/42089.htmlhttp://www.aygfsteel.com/zxfahjz/archive/2006/04/20/42089.html#Feedback0http://www.aygfsteel.com/zxfahjz/comments/commentRss/42089.htmlhttp://www.aygfsteel.com/zxfahjz/services/trackbacks/42089.htmlString realpath = this.servlet.getServletContext().getRealPath("/");

zxf 2006-04-20 09:40 发表评论
]]>
struts select选择?/title><link>http://www.aygfsteel.com/zxfahjz/archive/2006/04/19/41829.html</link><dc:creator>zxf</dc:creator><author>zxf</author><pubDate>Wed, 19 Apr 2006 02:33:00 GMT</pubDate><guid>http://www.aygfsteel.com/zxfahjz/archive/2006/04/19/41829.html</guid><wfw:comment>http://www.aygfsteel.com/zxfahjz/comments/41829.html</wfw:comment><comments>http://www.aygfsteel.com/zxfahjz/archive/2006/04/19/41829.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/zxfahjz/comments/commentRss/41829.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/zxfahjz/services/trackbacks/41829.html</trackback:ping><description><![CDATA[<html:optionsCollection name="xxxActionForm" property="xxxVector"/><br />xxxActionForm.getXxxVector();xxxActionForm.setXxxVector()<br />Vector xxxVector = new Vector();<br />xxxVector.add(new LabelValueBean(label,value));<img src ="http://www.aygfsteel.com/zxfahjz/aggbug/41829.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/zxfahjz/" target="_blank">zxf</a> 2006-04-19 10:33 <a href="http://www.aygfsteel.com/zxfahjz/archive/2006/04/19/41829.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>利用Token机制解决重复重复提交问题http://www.aygfsteel.com/zxfahjz/archive/2006/04/12/40686.htmlzxfzxfWed, 12 Apr 2006 09:05:00 GMThttp://www.aygfsteel.com/zxfahjz/archive/2006/04/12/40686.htmlhttp://www.aygfsteel.com/zxfahjz/comments/40686.htmlhttp://www.aygfsteel.com/zxfahjz/archive/2006/04/12/40686.html#Feedback0http://www.aygfsteel.com/zxfahjz/comments/commentRss/40686.htmlhttp://www.aygfsteel.com/zxfahjz/services/trackbacks/40686.html 利用Token机制解决重复重复提交问题

利用Token解决重复重复提交:
Struts利用同步令牌(Token)的方式来解决Web应用中重复提交的问题,其机制是在form表单中增加一个隐藏的?保存当前令牌?然后在程序中判断此o牌值是否合?
org.apache.struts.action.ActioncL供了相关操作Token的方?
1、isTokenValieҎ:
判断存储在当前用户会话中的o牌值和h参数中的令牌值是否匹?如果匚w,q回true,反之q回false.只要W合下列情况之一?׃q回false:
不存在HttpSession对象;
在session范围内没有保存o牌?
在请求参C没有令牌?
存储在当前用户session范围内的令牌值和h参数中的令牌g匚w.
2、resetTokenҎ:
从当前session范围内删除o牌属?
3、saveTokenҎ:
创徏一个新的o?q把它保存在当前session范围?如果HttpSession不存?首先创Z个HttpSession对象.

如何利用上述Ҏ应用令牌机制解决重复提交问题:
以用h册ؓ?
在用戯求newUser.jsp之前,首先把请求{发到PrepareAction,PrepareAction 调用saveTokenҎ,创徏一个新的o?q将令牌g存在当前HttpSession?新创建的),PrepareAction接着把请求{发给newUser.jsp.

newUser.jsp中的<html:form>标签自动判断在session范围内是否存在Token,如果存在,p动在表单中生成一个包含Token信息的隐藏字D?例如:
<input type="hidden" name="org.apache.struts.taglib.html.TOKEN" value="....">

在用h交表单后,由InsertUserAction处理h.在InsertUserAction?调用isTokenValidҎ,判断当前用户会话中的令牌值和h参数中的令牌值是否匹?如果匚w,p用resetTokenҎ,删除Token,然后执行插入数据操作.如果不匹?q回相关错误提示,q行相关操作.

OK.q可以有效放|重复提交了.

如何在不使用Struts的前提下利用令牌机制解决重复提交问题:
Struts的o牌机制有几个要点可以让我们在普通的JSP/Servlet中解决重复提交问?
1、提供几个操作Token的相x?
关键有三?
resetToken(HttpServletRequest request)-->重置令牌?
saveToken(HttpServletRequest request)-->保存令牌?
isTokenValid(HttpServletRequest request)-->o牌是否合?

2、在form表单中增加隐藏域,保存当前令牌?

3、在执行持久性数据操作之前调用相x法判断当前o牌是否合?之后在进行相x?

Ҏ是相同的,只是实现的方式不太一?

truts1.1 API关于几个Token操作Ҏ的说?

protected  boolean isTokenValid(javax.servlet.http.HttpServletRequest request)
          Return true if there is a transaction token stored in the user's current session, and the value submitted as a request parameter with this action matches it.

protected  boolean isTokenValid(javax.servlet.http.HttpServletRequest request, boolean reset)
          Return true if there is a transaction token stored in the user's current session, and the value submitted as a request parameter with this action matches it.

protected  void resetToken(javax.servlet.http.HttpServletRequest request)
          Reset the saved transaction token in the user's session.

protected  void saveToken(javax.servlet.http.HttpServletRequest request)
          Save a new transaction token in the user's current session, creating a new session if necessary.



zxf 2006-04-12 17:05 发表评论
]]>
表单重复提交http://www.aygfsteel.com/zxfahjz/archive/2006/04/11/40490.htmlzxfzxfTue, 11 Apr 2006 08:52:00 GMThttp://www.aygfsteel.com/zxfahjz/archive/2006/04/11/40490.htmlhttp://www.aygfsteel.com/zxfahjz/comments/40490.htmlhttp://www.aygfsteel.com/zxfahjz/archive/2006/04/11/40490.html#Feedback0http://www.aygfsteel.com/zxfahjz/comments/commentRss/40490.htmlhttp://www.aygfsteel.com/zxfahjz/services/trackbacks/40490.html  
  public ActionForward add(ActionMapping mapping, ActionForm form,
  
  HttpServletRequest request, HttpServletResponse response)
  
  //前面的处理省?br />  
  saveToken(request);
  
  return mapping.findForward("add");
  
  }在Action的insertҎ中,我们Ҏ表单中的Tokeng服务器端的Token值比较,如下所C:
  
  public ActionForward insert(ActionMapping mapping, ActionForm form,
  
  HttpServletRequest request, HttpServletResponse response)
  
  if (isTokenValid(request, true)) {
  
  // 表单不是重复提交
  
  //q里是保存数据的代码
  
  } else {
  
  //表单重复提交
  
  saveToken(request);
  
  //其它的处理代?br />  
  }
  
  }

zxf 2006-04-11 16:52 发表评论
]]>
html:messages 标签用法之一http://www.aygfsteel.com/zxfahjz/archive/2006/04/07/39878.htmlzxfzxfFri, 07 Apr 2006 09:26:00 GMThttp://www.aygfsteel.com/zxfahjz/archive/2006/04/07/39878.htmlhttp://www.aygfsteel.com/zxfahjz/comments/39878.htmlhttp://www.aygfsteel.com/zxfahjz/archive/2006/04/07/39878.html#Feedback0http://www.aygfsteel.com/zxfahjz/comments/commentRss/39878.htmlhttp://www.aygfsteel.com/zxfahjz/services/trackbacks/39878.htmlerrors.add("ExistLoginName",new ActionMessage("admin.user.jsp.existlogin",this.loginName));

<html:messages id="ExistLoginName" property="ExistLoginName" message="true">
<script language="javascript" type="text/javascript">
alert("<bean:write name="ExistLoginName"/>");
</script>
</html:messages>

zxf 2006-04-07 17:26 发表评论
]]>
վ֩ģ壺 ̶| | | | ֣| | | | | | Դ| ƴ| | ƽɽ| ƽ| | | | | | | | | | | ɫ| | | | ¡| ʡ| е| | | | | | | | | Һ|