锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲婷婷综合色高清在线,亚洲不卡中文字幕,亚洲激情视频在线观看http://www.tkk7.com/hhhaaawwwkkk/category/36693.html瀛︿範絎旇 鍔姏濂嬫枟 zh-cnFri, 02 Apr 2010 02:56:31 GMTFri, 02 Apr 2010 02:56:31 GMT60JFreeChart鑷垜鎬葷粨http://www.tkk7.com/hhhaaawwwkkk/archive/2010/03/31/317022.html鍚戝墠璧扮殑铻冭煿鍚戝墠璧扮殑铻冭煿Wed, 31 Mar 2010 03:31:00 GMThttp://www.tkk7.com/hhhaaawwwkkk/archive/2010/03/31/317022.htmlhttp://www.tkk7.com/hhhaaawwwkkk/comments/317022.htmlhttp://www.tkk7.com/hhhaaawwwkkk/archive/2010/03/31/317022.html#Feedback0http://www.tkk7.com/hhhaaawwwkkk/comments/commentRss/317022.htmlhttp://www.tkk7.com/hhhaaawwwkkk/services/trackbacks/317022.html闃呰鍏ㄦ枃

鍚戝墠璧扮殑铻冭煿 2010-03-31 11:31 鍙戣〃璇勮
]]>
struts綾誨瀷杞崲http://www.tkk7.com/hhhaaawwwkkk/archive/2009/06/11/281478.html鍚戝墠璧扮殑铻冭煿鍚戝墠璧扮殑铻冭煿Thu, 11 Jun 2009 07:03:00 GMThttp://www.tkk7.com/hhhaaawwwkkk/archive/2009/06/11/281478.htmlhttp://www.tkk7.com/hhhaaawwwkkk/comments/281478.htmlhttp://www.tkk7.com/hhhaaawwwkkk/archive/2009/06/11/281478.html#Feedback0http://www.tkk7.com/hhhaaawwwkkk/comments/commentRss/281478.htmlhttp://www.tkk7.com/hhhaaawwwkkk/services/trackbacks/281478.htmlstruts綾誨瀷杞崲錛氭湁涓ょ鏂規硶(a)瀹炵幇HttpServlet鎺ュ彛錛?b)瀹炵幇PlugIn鎺ュ彛錛?br /> converter_index.jsp(杈撳叆欏甸潰)
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  
<head>
    
<title>My JSP 'converter_index.jsp' starting page</title>
  
</head>
  
<body>
    
<form action="typeconvert.do" method="post">
    
<table>
        
<tr>
            
<td>intValue:</td><td><input type="text" name="intValue"/></td>
        
</tr>
        
<tr>
            
<td>doubleValue:</td><td><input type="text" name="doubleValue"/></td>
        
</tr>
        
<tr>
            
<td>booleanValue:</td><td><input type="text" name="booleanValue"/></td>
        
</tr>
        
<tr>
            
<td>sqlValue:</td><td><input type="text" name="sqlValue"/></td>
        
</tr>
        
<tr>
            
<td>utilDateValue:</td><td><input type="text" name="utilDateValue"/></td>
        
</tr>
        
<tr>
            
<td>submit:</td><td><input type="submit" name="submit"/></td>
        
</tr>
    
</table>    
    
</form>
  
</body>
</html>
converter_success.jsp(鐢ㄤ簬鏄劇ず)
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="com.eplugger.struts.form.TypeConvertActionForm" %>
<%@ page isELIgnored="false" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  
<head>
    
<title>My JSP 'converter_success.jsp' starting page</title>
  
</head>
  
<body>
        EL琛ㄨ揪寮忓彇鍊鹼細
<br>
      intValue:${typeConvertForm.intValue }
<br>
      doubleValue:${typeConvertForm.doubleValue }
<br>
      booleanValue:${typeConvertForm.booleanValue }
<br>
      java.sql.DateValue:${typeConvertForm.sqlValue }
<br>
      java.util.DateValue:${typeConvertForm.utilDateValue }
<br>
      jsp鍙栧鹼細
<br>
      
<% 
      TypeConvertActionForm tcaf 
=(TypeConvertActionForm) request.getAttribute("typeConvertForm");
      
%>
      
<%
          out.print(tcaf.getIntValue());
      
%><br>
      
<%
          out.print(tcaf.getDoubleValue());
      
%><br>
      
<%
          out.print(tcaf.getBooleanValue());
      
%><br>
      
<%
          out.print(tcaf.getSqlValue());
      
%><br>
       
<%
          out.print(tcaf.getUtilDateValue());
      
%><br>
  
</body>
</html>
TypeConverterAction.java(鍙綔璺寵漿)
package com.eplugger.struts.action;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
public class TypeConvertAction extends Action {
    @Override
    
public ActionForward execute(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response)
            
throws Exception {
        
return mapping.findForward("success");
    }
}
TypeConverterActionForm.java錛堟帴鏀墮〉闈紶鏉ョ殑鍊鹼級
package com.eplugger.struts.form;

import org.apache.struts.action.ActionForm;

public class TypeConvertActionForm extends ActionForm {
    
private int intValue;
    
private double doubleValue;
    
private boolean booleanValue;
    
private java.sql.Date sqlValue;
    
private java.util.Date utilDateValue;
    
    
public int getIntValue() {
        
return intValue;
    }
    
public void setIntValue(int intValue) {
        
this.intValue = intValue;
    }
    
public double getDoubleValue() {
        
return doubleValue;
    }
    
public void setDoubleValue(double doubleValue) {
        
this.doubleValue = doubleValue;
    }
    
public boolean getBooleanValue() {
        
return booleanValue;
    }
    
public void setBooleanValue(boolean booleanValue) {
        
this.booleanValue = booleanValue;
    }
    
public java.sql.Date getSqlValue() {
        
return sqlValue;
    }
    
public void setSqlValue(java.sql.Date sqlValue) {
        
this.sqlValue = sqlValue;
    }
    
public java.util.Date getUtilDateValue() {
        
return utilDateValue;
    }
    
public void setUtilDateValue(java.util.Date utilDateValue) {
        
this.utilDateValue = utilDateValue;
    }
}
UtilDateConverter.java錛堝浼犳潵鐨凷tring綾誨瀷鐨勬暟鎹繘琛岃漿鎹級
package com.eplugger.struts;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.apache.commons.beanutils.Converter;


public class UtilDateConverter implements Converter {

    
public Object convert(Class type, Object value) {
        System.out.println(
"value="+value);
        
if(value==null){
            
return value;
        }
        Date date
=null;
        
if(value instanceof String){
            SimpleDateFormat sdf 
= new SimpleDateFormat("yyy-mm-dd");
            
try{
                date 
= sdf.parse((String)value);
            }
catch(ParseException e){
                e.printStackTrace();
            }
        }
        
return date;
    }
}
涓ょ鏂規硶涓婇潰鐨勯兘涓鏍楓備笅闈㈢殑灝辨槸涓ょ鏂規硶鐨勫尯鍒簡
涓嬮潰濡傛灉鐢℉ttpServlet浠g爜濡備笅錛?br /> UtilDateConverterInitWithServlet.java
package com.eplugger.struts.converter;
import java.util.Date;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import org.apache.commons.beanutils.ConvertUtils;
import com.eplugger.struts.UtilDateConverter; 
/**
 * 娉ㄥ唽java.util.date杞崲鍣?br />  
*/
public class UtilDateConverterInitWithServlet extends HttpServlet {
    @Override
    
public void init() throws ServletException {
        ConvertUtils.register(
new UtilDateConverter(), Date.class);
    }
    
}
鐢ㄨ繖涓柟娉曞繀欏誨湪web.xml涓姞涓婇厤緗?br />
    <servlet>
        
<servlet-name>UtilDateConverterInitWithServlet</servlet-name>
        
<servlet-class>com.eplugger.struts.converter.UtilDateConverterInitWithServlet</servlet-class>
        
<load-on-startup>3</load-on-startup>
    
</servlet>
濡傛灉鐢≒lugIn鏂規硶浠g爜錛?br />
package com.eplugger.struts.converter;
import java.util.Date;
import javax.servlet.ServletException;
import org.apache.commons.beanutils.ConvertUtils;
import org.apache.struts.action.ActionServlet;
import org.apache.struts.action.PlugIn;
import org.apache.struts.config.ModuleConfig;
import com.eplugger.struts.UtilDateConverter;

public class UtilDateConverterInitWithPlugIn implements PlugIn {
    
public void destroy() {
    }
    
public void init(ActionServlet servlet, ModuleConfig config)
            
throws ServletException {
        ConvertUtils.register(
new UtilDateConverter(), Date.class);
    }
}
Struts-config.xml(濡傛灉鐢≒lugIn鏂規硶蹇呴』鍦ㄦ渶鍚庡姞涓?lt;plug-in className="com.eplugger.struts.converter.UtilDateConverterInitWithPlugIn"/>)
<?xml version="1.0" encoding="gb2312"?>
<!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="fileupload" type="com.eplugger.struts.form.FileUploadActionForm"/>
        
<form-bean name="blankfield" type="com.eplugger.struts.form.BlankFieldActionForm"/>
        
<form-bean name="typeConvertForm" type="com.eplugger.struts.form.TypeConvertActionForm"/>
    
</form-beans>

    
<action-mappings>
        
        
<action path="/typeconvert"
                type
="com.eplugger.struts.action.TypeConvertAction"
                name
="typeConvertForm"
                scope
="request"
        
>
            
<forward name="success" path="/converter_success.jsp"/>
        
</action>
    
</action-mappings>
    
<plug-in className="com.eplugger.struts.converter.UtilDateConverterInitWithPlugIn"/>
</struts-config>



鍚戝墠璧扮殑铻冭煿 2009-06-11 15:03 鍙戣〃璇勮
]]>
struts涓┖瀛楃涓睧L琛ㄨ揪寮忓拰jsp鎺ュ彈鐨勬晥鏋?/title><link>http://www.tkk7.com/hhhaaawwwkkk/archive/2009/06/11/281380.html</link><dc:creator>鍚戝墠璧扮殑铻冭煿</dc:creator><author>鍚戝墠璧扮殑铻冭煿</author><pubDate>Thu, 11 Jun 2009 02:12:00 GMT</pubDate><guid>http://www.tkk7.com/hhhaaawwwkkk/archive/2009/06/11/281380.html</guid><wfw:comment>http://www.tkk7.com/hhhaaawwwkkk/comments/281380.html</wfw:comment><comments>http://www.tkk7.com/hhhaaawwwkkk/archive/2009/06/11/281380.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/hhhaaawwwkkk/comments/commentRss/281380.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/hhhaaawwwkkk/services/trackbacks/281380.html</trackback:ping><description><![CDATA[鍦ㄨ〃鍗曚腑娌℃湁input杈撳叆鍩燂紝jsp鑴氭湰鎺ユ敹鍒扮殑鍊間負null錛孍L琛ㄨ揪寮忔帴鍙楀埌寰楀兼槸絀轟覆錛? <div>濡傛灉琛ㄥ崟涓湁input杈撳叆鍩熶絾娌℃湁緇欏鹼紝jsp鑴氭湰鍜孍L琛ㄨ揪寮忔帴鍙楃殑鍊奸兘鏄┖涓詫紱</div> <img src ="http://www.tkk7.com/hhhaaawwwkkk/aggbug/281380.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/hhhaaawwwkkk/" target="_blank">鍚戝墠璧扮殑铻冭煿</a> 2009-06-11 10:12 <a href="http://www.tkk7.com/hhhaaawwwkkk/archive/2009/06/11/281380.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>struts鏂囦歡涓婁紶錛堢畝鍗曞疄渚嬶級http://www.tkk7.com/hhhaaawwwkkk/archive/2009/06/10/281314.html鍚戝墠璧扮殑铻冭煿鍚戝墠璧扮殑铻冭煿Wed, 10 Jun 2009 13:57:00 GMThttp://www.tkk7.com/hhhaaawwwkkk/archive/2009/06/10/281314.htmlhttp://www.tkk7.com/hhhaaawwwkkk/comments/281314.htmlhttp://www.tkk7.com/hhhaaawwwkkk/archive/2009/06/10/281314.html#Feedback0http://www.tkk7.com/hhhaaawwwkkk/comments/commentRss/281314.htmlhttp://www.tkk7.com/hhhaaawwwkkk/services/trackbacks/281314.html     2涓猨sp鏂囦歡uploadIndex.jsp鍜寀ploadSuccess.jsp鏂囦歡錛汧ileUploadAction.java錛汧ileUploadActionForm.java錛泂truts-config.xml錛泈eb.xml錛?br />     
1銆乽ploadIndex.jsp 娉ㄦ剰錛歠orm涓璵ethod="post" 錛沞nctype="multipart/form-data"
<%@ page language="java" pageEncoding="gb2312"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  
<head>
    
<title>嫻嬭瘯Strust鏂囦歡涓婁紶</title>
  
</head>
  
<body>
      
<form action="fileupload.do" method="post" enctype="multipart/form-data" >
          
<table>
              鏍囬錛?/span><input type="text" name="title"/>
              
<input type="file" name="myfile"/>
              
<input type="submit" value="涓婁紶"/>
          
</table>
    
</form>    
  
</body>
</html>
2銆乽ploadSuccess.jsp
 1 <%@ page language="java" pageEncoding="gb2312"%>
 2 <%@ page isELIgnored="false" %>
 3 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 4 <html>
 5   <head>
 6     <title>uploadSuccess.jsp</title>
 7   </head>
 8   <body>
 9     鏂囦歡鏍囬錛?{fileupload.title }<br>
10     鏂囦歡鍚嶏細${fileupload.myfile.fileName }<br>
11     鏂囦歡澶у皬錛?{fileupload.myfile.fileSize}<br>
12   </body>
13 </html>
14 
3銆丗ileUploadActionForm.java
 1 package com.eplugger.struts.form;
 2 import org.apache.struts.action.ActionForm;
 3 import org.apache.struts.upload.FormFile;
 4 public class FileUploadActionForm extends ActionForm {
 5     private String title;
 6     private FormFile myfile;  //娉ㄦ剰錛氫笂浼犳枃浠剁殑綾誨瀷蹇呴』鏄疐ormFile錛涘畠鏄痵truts鎻愪緵鐨勶紱
 7     public String getTitle() {
 8         return title;
 9     }
10     public void setTitle(String title) {
11         this.title = title;
12     }
13     public FormFile getMyfile() {
14         return myfile;
15     }
16     public void setMyfile(FormFile myfile) {
17         this.myfile = myfile;
18     }
19 }
20 
4銆丗ileUploadAction.java
package com.eplugger.struts.action;

import java.io.FileOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.upload.FormFile;
import com.eplugger.struts.form.FileUploadActionForm;

public class FileUploadAction extends Action {
    @Override
    
public ActionForward execute(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response)
            
throws Exception {
        
//鑾峰緱form
        FileUploadActionForm fpaf =(FileUploadActionForm)form;
        
//鑾峰緱閫氳繃form浼犳潵鐨則itle鍊鹼紱
        String title = fpaf.getTitle();
        
//鑾峰緱閫氳繃form浼犳潵鐨勬枃浠訛紱娉ㄦ剰綾誨瀷蹇呴』鏄疐ormFile錛?/span>
        FormFile myFile = fpaf.getMyfile();
        
if(myFile != null ){
            
//鍒涘緩鏂囦歡杈撳嚭鐨勮礬寰?/span>
            FileOutputStream fos= new  FileOutputStream("e:\\"+myFile.getFileName());
            
//杈撳嚭錛堜竴涓猙ayt[]鏁扮粍錛?/span>
            fos.write(myFile.getFileData());
            
//鎶婂唴瀛樹腑鐨勬枃浠跺彉鎴愮墿鐞嗙殑
            fos.flush();
            
//鍏抽棴
            fos.close();
        }
        request.setAttribute(
"title","title");
        
return mapping.findForward("success");
    }
}
5銆乻truts-config.xml
<?xml version="1.0" encoding="gb2312"?>
<!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="fileupload" type="com.eplugger.struts.form.FileUploadActionForm"/>
    
</form-beans>
    
<action-mappings>
        
<action path="/fileupload"
                type
="com.eplugger.struts.action.FileUploadAction"
                name
="fileupload"
                scope
="request"
        
>
        
<forward name="success" path="/uploadSuccess.jsp"/>
        
</action>
    
</action-mappings>
    <controller maxFileSize="10M"/>

</struts-config>
6.web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" 
    xmlns
="http://java.sun.com/xml/ns/javaee" 
    xmlns:xsi
="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation
="http://java.sun.com/xml/ns/javaee 
    http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
>
  
<welcome-file-list>
    
<welcome-file>index.jsp</welcome-file>
  
</welcome-file-list>
  
  
<servlet>
        
<servlet-name>action</servlet-name>
        
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
          
<!-- Default -->
        
<init-param>
            
<param-name>config</param-name>
            
<param-value>/WEB-INF/struts-config.xml</param-value>
        
</init-param>
        
<init-param>
            
<param-name>debug</param-name>
            
<param-value>2</param-value>
        
</init-param>
        
<init-param>
            
<param-name>detail</param-name>
            
<param-value>2</param-value>
        
</init-param>
        
<load-on-startup>2</load-on-startup>
    
</servlet>

    
<servlet-mapping>
        
<servlet-name>action</servlet-name>
        
<url-pattern>*.do</url-pattern>
    
</servlet-mapping>
</web-app>

鏈鍚庤涓涓嬶紝鍏充簬鏂囦歡鐨勫ぇ灝忕瓑鍙傛暟閮藉彲浠ュ啀struts-config.xml鏂囦歡涓殑<controller  />涓厤緗紝鍙互閰嶇疆鐨勫睘鎬у彲浠ュ弬鑰僺truts-core-1.3.10.jar涓殑org.apache.struts.resources.struts-config_1_3.dtd
涓昏鍐呭濡備笅錛?br />

<!-- The "controller" element describes the ControllerConfig bean
     [org.apache.struts.config.ControllerConfig] that encapsulates
     a module's runtime configuration. The following
     attributes are defined:

     bufferSize      The size of the input buffer used when processing
                     file uploads.
                     [4096]

     catalog         Name of the catalog to use when processing requests
                     for this module.
                     [struts]

     className       Fully qualified Java class name of the
                     ControllerConfig subclass for this controller object.
                     If specified, the object must be a subclass of the
                     default class.
                     ["org.apache.struts.config.ControllerConfig"]

     command         Name of the command to execute to process a request.
                     [servlet-standard]

     contentType     Default content type (and optional character encoding) to
                     be set on each response. May be overridden by the Action,
                     JSP, or other resource to which the request is forwarded.
                     ["text/html"]

     forwardPattern  Replacement pattern defining how the "path" attribute of a
                     <forward> element is mapped to a context-relative URL when
                     it starts with a slash (and when the contextRelative
                     property is false). This value may consist of any
                     combination of the following:
                     - "$M" - Replaced by the module prefix of this module
                     - "$P" - Replaced by the "path" attribute of the  selected
                     "forward" element
                     - "$$" - Causes a literal dollar sign to be rendered
                     - "$x" - (Where "x" is any character not defined above)
                     Silently swallowed, reserved for future use
                     If not specified, the default forwardPattern is "$M$P",
                     which is consistent with the previous behavior of
                     forwards.  Since Struts 1.1.  ["$M$P"]

     inputForward    Set to "true" if you want the "input" attribute of
                     <action> elements to be the name of a local or global
                     ActionForward, which will then be used to calculate the
                     ultimate URL. Set to "false" (the default) to treat the
                     "input" parameter of <action> elements as a
                     module-relative path to the resource
                     to be used as the input form. Since Struts 1.1.
                     [false]

     locale          Set to "true" if you want a Locale object stored in the
                     user's session if not already present.
                     [true]

     maxFileSize     The maximum size (in bytes) of a file to be accepted as a
                     file upload.  Can be expressed as a number followed by a
                     "K", "M", or "G", which are interpreted to mean kilobytes,
                     megabytes, or gigabytes, respectively.
                     ["250M"]

     memFileSize     The maximum size (in bytes) of a file whose contents will
                     be retained in memory after uploading. Files larger than
                     this threshold will be written to some alternative storage
                     medium, typically a hard disk. Can be expressed as a number
                     followed by a "K", "M", or "G", which are interpreted to
                     mean kilobytes, megabytes, or gigabytes, respectively.
                     ["256K"]

     multipartClass  The fully qualified Java class name of the multipart
                     request handler class to be used with this module.
                     ["org.apache.struts.upload.CommonsMultipartRequestHandler"]

     nocache         Set to "true" if you want the controller to add HTTP
                     headers for defeating caching to every response from
                     this module.  [false]

     pagePattern     Replacement pattern defining how the "page" attribute of
                     custom tags using it is mapped to a context-relative URL
                     of the corresponding resource.  This value may consist of
                     any combination of the following:
                     - "$M" - Replaced by the module prefix of this module
                     - "$P" - Replaced by the value of the "page" attribute
                     - "$$" - Causes a literal dollar sign to be rendered
                     - "$x" - (Where "x" is any character not defined above)
                              Silently swallowed, reserved for future use
                     If not specified, the default forwardPattern is
                     "$M$P", which is consistent with previous hard coded
                     behavior of URL evaluation for "page" attributes.
                     ["$M$P"]

     processorClass  The fully qualified Java class name of the
                     RequestProcessor subclass to be used with this module.
                     ["org.apache.struts.chain.ComposableRequestProcessor"]

     tempDir         Temporary working directory to use when processing
                     file uploads.
                     [{Directory provided by servlet container}]

-->



鍚戝墠璧扮殑铻冭煿 2009-06-10 21:57 鍙戣〃璇勮
]]>
struts涓姩鎬佽〃鍗曪紙DynaActionForm錛夌殑浣跨敤(瓚呯畝鍗曚緥瀛?http://www.tkk7.com/hhhaaawwwkkk/archive/2009/06/07/280446.html鍚戝墠璧扮殑铻冭煿鍚戝墠璧扮殑铻冭煿Sun, 07 Jun 2009 09:16:00 GMThttp://www.tkk7.com/hhhaaawwwkkk/archive/2009/06/07/280446.htmlhttp://www.tkk7.com/hhhaaawwwkkk/comments/280446.htmlhttp://www.tkk7.com/hhhaaawwwkkk/archive/2009/06/07/280446.html#Feedback0http://www.tkk7.com/hhhaaawwwkkk/comments/commentRss/280446.htmlhttp://www.tkk7.com/hhhaaawwwkkk/services/trackbacks/280446.html    涓昏鍔熻兘鏄湪欏甸潰涓婅緭鍏sername鍜宲assword鎻愪氦錛岀劧鍚庡湪鍙︿竴涓〉闈㈡樉紺恒?br /> 1.鎵闇瑕佺殑鍖呭氨鏄痵truts鐨刲ib鍖咃紱
2.鎵娑夊強閬撳痙鏂囦歡鏈夛細web.xml錛泂truts_config.xml錛涗袱涓〉闈紙index.jsp銆乨yna_actionform.jsp錛夛紱涓涓猘ction(DynaAction.java)錛?br /> 3.榪欑鍔ㄦ佺殑DynaActionForm鏄皢Form緇х畫浼犻掋傝繚鑳屼簡鍒嗗眰鐨勮鍒欙紙灝戠敤錛夛紱
web.xml 榪欎釜鏂囦歡娌′粈涔堢殑鍒殑銆?br />

 1<?xml version="1.0" encoding="UTF-8"?>
 2<web-app version="2.5" 
 3    xmlns="http://java.sun.com/xml/ns/javaee" 
 4    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
 5    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
 6    http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
 7  <welcome-file-list>
 8    <welcome-file>index.jsp</welcome-file>
 9  </welcome-file-list>
10  
11  <servlet>
12        <servlet-name>action</servlet-name>
13        <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
14          <!-- Default -->
15        <init-param>
16            <param-name>config</param-name>
17            <param-value>/WEB-INF/struts-config.xml</param-value>
18        </init-param>
19        <init-param>
20            <param-name>debug</param-name>
21            <param-value>2</param-value>
22        </init-param>
23        <init-param>
24            <param-name>detail</param-name>
25            <param-value>2</param-value>
26        </init-param>
27        <load-on-startup>2</load-on-startup>
28    </servlet>
29
30    <servlet-mapping>
31        <servlet-name>action</servlet-name>
32        <url-pattern>*.do</url-pattern>
33    </servlet-mapping>
34</web-app>
35

struts_config.xml 鍔ㄦ佺殑Form灝辨槸鍦ㄨ繖閲岄厤緗殑
 1<?xml version="1.0" encoding="gb2312"?>
 2<!DOCTYPE struts-config PUBLIC
 3        "-//Apache Software Foundation//DTD Struts Configuration 1.3//EN"
 4        "http://struts.apache.org/dtds/struts-config_1_3.dtd">
 5
 6<struts-config>
 7    <form-beans>
 8        <form-bean name="dynaFrom" type="org.apache.struts.action.DynaActionForm">
 9            <form-property name="username" type="java.lang.String"/>
10            <form-property name="age" type="java.lang.Integer"/>
11        </form-bean>
12    </form-beans>
13    
14    <action-mappings>
15        <action path="/danaform"
16                type="com.eplugger.struts.action.DynaAction"
17                name="dynaFrom"
18                scope="request"
19        >
20            <forward name="success" path="/dyna_actionform.jsp"/>
21        </action>
22    </action-mappings>
23</struts-config>
24

DynaAction.java娉ㄦ剰榪欎釜鏂囦歡
 1 package com.eplugger.struts.action;
 2 
 3 import javax.servlet.http.HttpServletRequest;
 4 import javax.servlet.http.HttpServletResponse;
 5 
 6 import org.apache.struts.action.Action;
 7 import org.apache.struts.action.ActionForm;
 8 import org.apache.struts.action.ActionForward;
 9 import org.apache.struts.action.ActionMapping;
10 import org.apache.struts.action.DynaActionForm;
11 
12 public class DynaAction extends Action {
13 
14     @Override
15     public ActionForward execute(ActionMapping mapping, ActionForm form,
16             HttpServletRequest request, HttpServletResponse response)
17             throws Exception {
18         //鑾峰彇鍔ㄦ佺殑ActionForm
19         DynaActionForm daf = (DynaActionForm) form;
20         //DynaActionForm涓彁渚涗簡get()鏂規硶錛屾墍浠ユ垜浠彲浠ョ洿鎺ヨ幏寰楅〉闈紶鏉ョ殑鍊箋備絾鏄粬鎶婂兼斁鍒頒簡Map涓紝鎵浠ユ垜浠寮哄埗綾誨瀷杞崲
21         String username = (String)daf.get("username");
22         Integer age = (Integer)daf.get("age"); 
23         //鎴愬姛杞埌鎴愬姛欏甸潰
24         return mapping.findForward("success");
25     }
26     
27 }
28 
index.jsp
 1 <%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
 2 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 3 <html>
 4   <head>
 5   </head>
 6   <body>
 7       <form action="danaform.do" method="post">
 8       username:<input type="text" name="username"><br>
 9       age:<input type="text" name="age"><br>
10       <input type="submit" value="submit">
11       </form>
12   </body>
13 </html>
14 

dyna_actionform.jsp
 1<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
 2    pageEncoding="ISO-8859-1"
%>
 3<%@ page isELIgnored="false" %>
 4<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
 5<html>
 6<head>
 7<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
 8<title>Insert title here</title>
 9</head>
10<body>
11    username:${dynaFrom.map.username }<br>
12    age:${dynaFrom.map.age }
13</body>
14</html>

鏈鍚庤涓鐐瑰姩鎬佺殑ActionForm鐨勯獙璇侊紝閫氬父浣跨敤鍔ㄦ侀獙璇佹鏋秜alidator銆傚惁鍒欏皢澶卞幓鍔ㄦ丄ctionForm鐨勬剰涔夈?

鍚戝墠璧扮殑铻冭煿 2009-06-07 17:16 鍙戣〃璇勮
]]>
主站蜘蛛池模板: 美女黄色免费网站| 精品女同一区二区三区免费播放 | 无码中文在线二区免费| 亚洲制服丝袜在线播放| 一个人免费观看视频www| 亚洲精品无码久久久久A片苍井空 亚洲精品无码久久久久YW | 又黄又爽又成人免费视频| 亚洲一区二区三区乱码在线欧洲| 免费观看美女裸体网站| 美女裸体无遮挡免费视频网站| 久久亚洲中文字幕精品一区四| 国产精成人品日日拍夜夜免费| 四虎必出精品亚洲高清| 国产成人精品123区免费视频| 中文永久免费观看网站| 亚洲视频一区在线| 999久久久免费精品国产| 亚洲av无码一区二区三区人妖| 国产综合精品久久亚洲| 久久久精品2019免费观看| 亚洲人色大成年网站在线观看| 亚洲国产精品综合久久网络| 久久久久久影院久久久久免费精品国产小说 | 亚洲精品无码av人在线观看 | 亚洲AV无码成人网站久久精品大| 成人免费视频77777| 美美女高清毛片视频黄的一免费| 日韩va亚洲va欧洲va国产| 国产免费不卡v片在线观看| 精品在线观看免费| 亚洲色成人中文字幕网站| 美女视频黄免费亚洲| 一日本道a高清免费播放| 久久久婷婷五月亚洲97号色| 亚洲成A人片在线观看中文| 免费不卡在线观看AV| 小说区亚洲自拍另类| 亚洲黄色在线观看网站| 亚洲av无码天堂一区二区三区 | 久久精品国产亚洲麻豆| 成人毛片免费观看|