• struts2从零开始(四)


    知识点:1、文件上传
              2、类型转换
      

       1、文件上传:
       1.1、 jsp页面代码:
      
    Java代码 复制代码 收藏代码
    1. <body>   
    2.      
    3.           <form action="upload.action" method="post" enctype="multipart/form-data">   
    4.              <input type="file" name="photo">   
    5.              <input type="submit" value="上传">   
    6.                 
    7.           </form>   
    8.      
    9.      
    10.   </body>  


      1.2、 struts.xml中的代码:
      
    Java代码 复制代码 收藏代码
    1. <package name="mypackage" extends="struts-default">   
    2.             
    3.             <action name="upload" class="cn.zhuojingxinxi.web.UploadAction">   
    4.                 <interceptor-ref name="fileUpload"></interceptor-ref>   
    5.                 <interceptor-ref name="defaultStack"></interceptor-ref>   
    6.                          <result name="success">/success.jsp</result>   
    7.                          <result name="input">/error.jsp</result>   
    8.             </action>   
    9.          
    10.          </package>  


  • 相关阅读:
    LeetCode-434-字符串中的单词数
    LeetCode-415-字符串相加
    字符串
    序列
    元组
    列表
    repr()与str的区别
    输出函数print()
    输入函数input()
    MySQL中快速复制数据表方法汇总
  • 原文地址:https://www.cnblogs.com/bjanzhuo/p/3576022.html
Copyright © 2020-2023  润新知