<tfoot id='9pV3H'></tfoot>

  • <i id='9pV3H'><tr id='9pV3H'><dt id='9pV3H'><q id='9pV3H'><span id='9pV3H'><b id='9pV3H'><form id='9pV3H'><ins id='9pV3H'></ins><ul id='9pV3H'></ul><sub id='9pV3H'></sub></form><legend id='9pV3H'></legend><bdo id='9pV3H'><pre id='9pV3H'><center id='9pV3H'></center></pre></bdo></b><th id='9pV3H'></th></span></q></dt></tr></i><div id='9pV3H'><tfoot id='9pV3H'></tfoot><dl id='9pV3H'><fieldset id='9pV3H'></fieldset></dl></div>
  • <small id='9pV3H'></small><noframes id='9pV3H'>

    1. <legend id='9pV3H'><style id='9pV3H'><dir id='9pV3H'><q id='9pV3H'></q></dir></style></legend>

          <bdo id='9pV3H'></bdo><ul id='9pV3H'></ul>

      1. 如何将 fileUpload Interceptor 与其他拦截器堆栈一起使用?

        时间:2023-09-24
            • <bdo id='lL2Ri'></bdo><ul id='lL2Ri'></ul>
            • <small id='lL2Ri'></small><noframes id='lL2Ri'>

                  <tbody id='lL2Ri'></tbody>
              1. <legend id='lL2Ri'><style id='lL2Ri'><dir id='lL2Ri'><q id='lL2Ri'></q></dir></style></legend>
              2. <i id='lL2Ri'><tr id='lL2Ri'><dt id='lL2Ri'><q id='lL2Ri'><span id='lL2Ri'><b id='lL2Ri'><form id='lL2Ri'><ins id='lL2Ri'></ins><ul id='lL2Ri'></ul><sub id='lL2Ri'></sub></form><legend id='lL2Ri'></legend><bdo id='lL2Ri'><pre id='lL2Ri'><center id='lL2Ri'></center></pre></bdo></b><th id='lL2Ri'></th></span></q></dt></tr></i><div id='lL2Ri'><tfoot id='lL2Ri'></tfoot><dl id='lL2Ri'><fieldset id='lL2Ri'></fieldset></dl></div>
                <tfoot id='lL2Ri'></tfoot>

                  本文介绍了如何将 fileUpload Interceptor 与其他拦截器堆栈一起使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  这是我的 struts.xml 配置文件,其中有一个登录拦截器.我想使用不同的文件上传拦截器,在不同的操作中使用不同的文件类型,以及给定的最大大小.但问题就在这里:它总是采用默认的 maximumSizeallowedType.我哪里做错了?

                  Here is my struts.xml configuration file in which I have a login interceptor. I want to use different file upload interceptor, in different action with different file type, and maximum size as given. But the problem is here: It's always taking the default maximumSize and allowedType. Where I am doing wrong?

                  <?xml version="1.0" encoding="UTF-8" ?>
                  <!DOCTYPE struts PUBLIC
                  "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
                  "http://struts.apache.org/dtds/struts-2.0.dtd">
                  
                      <struts>
                  <constant name="struts.enable.DynamicMethodInvocation"
                      value="false" />
                  <constant name="struts.devMode" value="false" />
                  <constant name="struts.custom.i18n.resources"
                      value="ApplicationResources" />
                  
                  <package name="default" extends="struts-default" namespace="/">
                      <result-types>
                          <result-type name="tiles"
                              class="org.apache.struts2.views.tiles.TilesResult" />
                      </result-types>
                      
                      <interceptors>
                          <interceptor name="nlogin" class="com.picvik.interceptor.LoginInterceptor"/>
                          <interceptor-stack name="loginStack">
                              <interceptor-ref name="servletConfig"/>
                              <interceptor-ref name="params"/>
                              <interceptor-ref name="nlogin"/>
                              <interceptor-ref name="prepare"/>
                              <interceptor-ref name="chain"/>
                              <interceptor-ref name="modelDriven"/>
                              <interceptor-ref name="staticParams"/>
                              <interceptor-ref name="params"/>
                              <interceptor-ref name="conversionError"/>
                              <interceptor-ref name="validation"/>
                              <interceptor-ref name="workflow"/>
                          </interceptor-stack>
                      </interceptors>
                      <!-- <default-interceptor-ref name="loginStack"/>  -->
                     
                      <global-results>
                          <result name="login" type="tiles">/login.tiles</result>
                      </global-results>
                  
                      
                      <action name="home" 
                          class="com.picvik.action.HomeAction">
                          <interceptor-ref name="loginStack"/>
                          <result name="success" type="tiles">/home.tiles</result>
                          <result name="error" type="tiles">/welcome.tiles</result>
                      </action>
                      <action name="registration" 
                          class="com.picvik.action.RegisterAction" method="execute">
                          <result name="success" type="tiles">/register.tiles</result>
                      </action>
                      <action name="register" 
                          class="com.picvik.action.RegisterAction" method="register">
                          <result name="success" type="tiles">/registerverify.tiles</result>
                          <result name="error" type="tiles">/register.tiles</result>
                          <result name="input" type="tiles">/register.tiles</result>
                      </action>
                      <action name="verify" 
                          class="com.picvik.action.RegisterAction" method="verify">
                          <result name="success" type="tiles">/login.tiles</result>
                          <result name="error" type="tiles">/registerverify.tiles</result>
                      </action>
                      
                       <action name="login" class="com.picvik.action.LoginAction">
                          <result name="success" type="tiles">/home.tiles</result>
                          <result name="input" type="tiles">/login.tiles</result>
                      </action>
                      
                      <action name="dologin" class="com.picvik.action.LoginAction" method="login">
                          <interceptor-ref name="defaultStack"/>
                          <result name="success" type="tiles">/home.tiles</result>
                          <result name="input" type="tiles">/login.tiles</result>
                      </action>
                  
                      <action name="logout" class="com.picvik.action.LoginAction" method="logout">
                          <interceptor-ref name="defaultStack"/>
                          <result name="success" type="tiles">/login.tiles</result>
                      </action>
                      
                      <action name="viewprofile" class="com.picvik.action.ViewProfileAction">
                          <interceptor-ref name="loginStack"/>
                          <result name="success" type="tiles">/viewprofile.tiles</result>
                      </action>
                      <action name="editprofile" class="com.picvik.action.ViewProfileAction">
                          <interceptor-ref name="loginStack"/>
                          <result name="success" type="tiles">/editprofile.tiles</result>
                      </action>
                      <action name="saveprofile" class="com.picvik.action.ViewProfileAction" method = "saveProfile">
                          <interceptor-ref name="loginStack"/>
                          <result name="success" type="tiles">/home.tiles</result>
                          <result name="input" type="tiles">/editprofile.tiles</result>
                      </action>
                      
                      <action name="changeprofilephoto" class="com.picvik.action.ChangeProfilePhotoAction">
                          <interceptor-ref name="loginStack"/>
                          <result name="success" type="tiles">/changephoto.tiles</result>
                          <result name="input" type="tiles">/changephoto.tiles</result>
                      </action>
                      
                      <action name="uploadprofilephoto"
                              class="com.picvik.action.ChangeProfilePhotoAction" method="uploadProfilePhoto">
                           <interceptor-ref name="fileUpload">
                              <param name="maximumSize">2097152</param>
                              <param name="allowedTypes">
                                  image/png,image/gif,image/jpeg,image/pjpeg
                              </param>
                          </interceptor-ref>
                          <interceptor-ref name="loginStack"></interceptor-ref>
                          <result name="success" type= "redirectAction">
                              <param name="actionName">viewprofile</param>
                          </result>
                          <result name="input" type="tiles">/changephoto.tiles</result>
                      </action>
                      <!-- video upload-->
                      <action name="videouploader"
                              class="com.picvik.action.UploadVideoAction" method="execute">
                          <interceptor-ref name="loginStack"></interceptor-ref>
                          <result name="success" type="tiles">/videoupload.tiles</result>
                      </action>
                      
                      <action name="uploadvideo"
                              class="com.picvik.action.UploadVideoAction" method="uploadVideo">
                           <interceptor-ref name="fileUpload">
                              <param name="maximumSize">209715200</param>
                              <param name="allowedTypes">
                                  video/mp4
                              </param>
                          </interceptor-ref>
                          <interceptor-ref name="loginStack"></interceptor-ref>
                          <result name="success" type= "redirectAction">
                              <param name="actionName">editvideo</param>
                          </result>
                          <result name="input" type="tiles">/videoupload.tiles</result>
                      </action>
                      <action name="editvideo"
                              class="com.picvik.action.UploadVideoAction" method="editVideo">
                          <interceptor-ref name="loginStack"></interceptor-ref>
                          <result name="success" type= "redirectAction">
                              <param name="actionName">home</param>
                          </result>
                          <result name="input" type="tiles">/editvideo.tiles</result>
                      </action>
                      <action name="savevideos"
                              class="com.picvik.action.UploadVideoAction" method="saveVideo">
                          <interceptor-ref name="loginStack"></interceptor-ref>
                          <result name="success" type= "redirectAction">
                              <param name="actionName">listVideo</param>
                          </result>
                          <result name="error" type="tiles">/editvideo.tiles</result>
                      </action>
                      <!-- video upload ends here-->
                      
                      <!-- photo upload -->
                      <action name="photouploader"
                              class="com.picvik.action.UploadPhotoAction">
                          <interceptor-ref name="loginStack"></interceptor-ref>
                          <result name="success" type="tiles">/photoupload.tiles</result>
                      </action>
                      
                      <action name="uploadphoto"
                              class="com.picvik.action.UploadPhotoAction" method="uploadPhoto">
                           <interceptor-ref name="fileUpload">
                              <param name="maximumSize">20971520</param>
                              <param name="allowedTypes">
                                  image/png,image/gif,image/jpeg,image/pjpeg
                              </param>
                          </interceptor-ref>
                          <interceptor-ref name="loginStack"></interceptor-ref>
                          <result name="success" type= "redirectAction">
                              <param name="actionName">editphoto</param>
                          </result>
                          <result name="input" type="tiles">/photoupload.tiles</result>
                      </action>
                      
                      <action name="editphoto"
                              class="com.picvik.action.UploadPhotoAction" method="editPhoto">
                          <interceptor-ref name="loginStack"></interceptor-ref>
                          <result name="success" type= "redirectAction">
                              <param name="actionName">home</param>
                          </result>
                          <result name="input" type="tiles">/editphoto.tiles</result>
                      </action>
                      <action name="savephotos"
                              class="com.picvik.action.UploadPhotoAction" method="savePhoto">
                          <interceptor-ref name="loginStack"></interceptor-ref>
                          <result name="success" type= "redirectAction">
                              <param name="actionName">listalbum</param>
                          </result>
                          <result name="error" type="tiles">/editphoto.tiles</result>
                      </action>
                      
                      <action name="listalbum"
                              class="com.picvik.action.ViewAlbumAction" method="listAlbum">
                          <interceptor-ref name="loginStack"></interceptor-ref>
                          <result name="success" type="tiles">/listalbum.tiles</result>
                      </action>
                      
                      <action name="listphoto"
                              class="com.picvik.action.ViewAlbumAction" method="listPhoto">
                          <interceptor-ref name="loginStack"></interceptor-ref>
                          <result name="success" type="tiles">/listphoto.tiles</result>
                      </action>
                      
                      <action name="listalbumphoto"
                              class="com.picvik.action.ViewAlbumAction" method="listAlbumPhoto">
                          <interceptor-ref name="loginStack"></interceptor-ref>
                          <result name="success" type="tiles">/listalbumphoto.tiles</result>
                      </action>
                      
                      <action name="viewphoto"
                              class="com.picvik.action.ViewAlbumAction" method="viewPhoto">
                          <interceptor-ref name="loginStack"></interceptor-ref>
                          <result name="success" type="tiles">/viewphoto.tiles</result>
                      </action>
                      
                      <action name="commentonphoto"
                              class="com.picvik.action.CommentAction" method="commentOnPhoto">
                          <interceptor-ref name="loginStack"></interceptor-ref>
                          <result name="success" type= "redirectAction">
                              <param name="actionName">listphoto</param>
                          </result>
                      </action>
                      
                      <action name="commentonalbum"
                              class="com.picvik.action.CommentAction" method="commentOnAlbum">
                          <interceptor-ref name="loginStack"></interceptor-ref>
                          <result name="success" type= "redirectAction">
                              <param name="actionName">listalbum</param>
                          </result>
                      </action>
                      
                  </package>
                  

                  推荐答案

                  使用以下配置属性覆盖默认值

                  Use the following configuration property to override the defaults

                  struts.multipart.maxSize=2097152
                  

                  取自 default.properties.注意末尾没有0.

                  that is taken from the default.properties. Note without 0 at the end.

                  查看文档和示例如何使用 fileUpload 拦截器.

                  Check the documentation and examples how to use fileUpload interceptor.

                  这篇关于如何将 fileUpload Interceptor 与其他拦截器堆栈一起使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:使用 Struts 2 REST 插件的带有附加参数的自定义函数 下一篇:升级到 Struts 2.3.16.3 s:submit 后不起作用

                  相关文章

                  <i id='YnRB6'><tr id='YnRB6'><dt id='YnRB6'><q id='YnRB6'><span id='YnRB6'><b id='YnRB6'><form id='YnRB6'><ins id='YnRB6'></ins><ul id='YnRB6'></ul><sub id='YnRB6'></sub></form><legend id='YnRB6'></legend><bdo id='YnRB6'><pre id='YnRB6'><center id='YnRB6'></center></pre></bdo></b><th id='YnRB6'></th></span></q></dt></tr></i><div id='YnRB6'><tfoot id='YnRB6'></tfoot><dl id='YnRB6'><fieldset id='YnRB6'></fieldset></dl></div>

                1. <small id='YnRB6'></small><noframes id='YnRB6'>

                2. <legend id='YnRB6'><style id='YnRB6'><dir id='YnRB6'><q id='YnRB6'></q></dir></style></legend>

                    <tfoot id='YnRB6'></tfoot>
                      • <bdo id='YnRB6'></bdo><ul id='YnRB6'></ul>