struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pablo Vázquez Blázquez <pvazq...@denodo.com>
Subject Re: File Upload
Date Thu, 17 Jan 2008 15:17:46 GMT
I send you my struts-config.xml file, but it works ok. If I delete my 
"s:file" from my form, everything works fine.

To see the action involved search:  <!-- HERE IS THE PROBLEM -->


<?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="true" /> <!-- TODO: cambiar a 
false en produccion -->
    <constant name="struts.action.extension" value="do"/>
    <constant name="struts.ui.theme" value="simple"/>
    <constant name="struts.multipart.parser"
        
value="org.apache.struts2.dispatcher.multipart.JakartaMultiPartRequest"/>
   
   
    <!-- Internacionalizacion para los tags de struts 2 -->
    <constant name="struts.custom.i18n.resources"
        value="admintool.http.view.messages.Messages"/>
   
    <include file="struts-default.xml"/>

    <!-- ===== Paquetes ===== -->
    <package name="scheduler" extends="struts-default">
   
        <!-- ===== Resultados globales ===== -->
        <result-types>
            <result-type name="tiles"
                class="org.apache.struts2.views.tiles.TilesResult"/>
        </result-types>
   
        <!-- ===== Interceptors ===== -->
        <interceptors>

            <interceptor name="session"
                
class="admintool.http.controller.interceptors.SessionInterceptor" />
               
            <interceptor name="login"
                
class="admintool.http.controller.interceptors.AuthenticationInterceptor" />
           
            <interceptor-stack name="defaultLoginStack">
                <interceptor-ref name="exception" />
                <interceptor-ref name="alias" />
                <interceptor-ref name="servlet-config" />
                <interceptor-ref name="session" />
                <interceptor-ref name="login" />
                <interceptor-ref name="prepare" />
                <interceptor-ref name="i18n"/>
                <interceptor-ref name="chain" />
                <interceptor-ref name="model-driven" />
                <interceptor-ref name="fileUpload" />
                <interceptor-ref name="static-params" />
                <interceptor-ref name="params" />
                <interceptor-ref name="conversionError" />
                <interceptor-ref name="validation" />
                <interceptor-ref name="workflow" />
            </interceptor-stack>
   
            <interceptor-stack name="defaultInsecureStack">
                <interceptor-ref name="exception" />
                <interceptor-ref name="alias" />
                <interceptor-ref name="servlet-config" />
                <interceptor-ref name="session" />
                <interceptor-ref name="prepare" />
                <interceptor-ref name="i18n"/>
                <interceptor-ref name="chain" />
                <interceptor-ref name="model-driven" />
                <interceptor-ref name="fileUpload" />
                <interceptor-ref name="static-params" />
                <interceptor-ref name="params" />
                <interceptor-ref name="conversionError" />
                <interceptor-ref name="validation" />
                <interceptor-ref name="workflow" />
            </interceptor-stack>
           
            <!-- Sample file upload stack -->
            <interceptor-stack name="fileUploadStack">
                <interceptor-ref name="fileUpload"/>
                <interceptor-ref name="basicStack"/>
            </interceptor-stack>
       
        </interceptors>

        <!--
            Make the defaultLoginStack the default one used
            for all actions unless otherwise configured.
        -->
        <default-interceptor-ref name="defaultLoginStack" />
   
        <!-- ===== Resultados globales ===== -->
        <!-- se corresponden con los valores por defecto devueltos por 
Action (ej: error, login) -->
        <global-results>
            <result name="login" 
type="redirect-action">ShowAuthentication</result>
            <result name="MainPage" 
type="redirect-action">Workspace</result>
            <result 
name="error">/HTML/tiles/base/InternalError.jspx</result>
            <result name="exito">/HTML/tiles/base/SuccessPage.jspx</result>
        </global-results>
       
        <!-- ===== Secciones principales ===== -->
        <action name="Workspace">
            <result type="tiles">.Workspace</result>
        </action>
       
        <action name="Scheduler">
            <result type="tiles">.Scheduler</result>
        </action>
       
        <action name="Configuration">
            <result type="tiles">.Configuration</result>
        </action>

        <!-- ===== Autenticacion ===== -->
        <!-- Accion que muestra el formulario de autenticacion -->
        <action name="ShowAuthentication"
            
class="admintool.http.controller.actions.users.ShowAuthenticationAction">
            <interceptor-ref name="defaultInsecureStack"/>
            <result type="tiles">.Login</result>
        </action>
       
        <!-- Ejecuta la accion de login. Si hay fallos, vuelve a la 
misma pagina -->
        <action name="Login"
                class="admintool.http.controller.actions.users.LoginAction">
            <interceptor-ref name="defaultInsecureStack"/>
            <result name="input" type="tiles">.Login</result>
        </action>
       
        <!-- Cierra la sesion y vuelve a la pagina de login  -->
        <action name="Logout"
                
class="admintool.http.controller.actions.users.LogoutAction">
            <interceptor-ref name="defaultInsecureStack"/>
        </action>
               
        <!-- ===== Configuration ===== -->
       
        <action name="CancelConfiguration">
            <result>/HTML/tiles/configuration/ConnectionInfo.jspx</result>
        </action>
       
        <action name="ShowChangePassword">
            <result>/HTML/tiles/configuration/ChangePassword.jspx</result>
        </action>
       
        <action name="ChangePassword"
                
class="admintool.http.controller.actions.configuration.ChangePasswordAction">
            <result 
name="input">/HTML/tiles/configuration/ChangePassword.jspx</result>
        </action>
       
        <action name="ShowChangeServer">
            <result>/HTML/tiles/configuration/ChangeServer.jspx</result>
        </action>
       
        <action name="ChangeServer"
                
class="admintool.http.controller.actions.configuration.ChangeServerAction">
            <result 
name="input">/HTML/tiles/configuration/ChangeServer.jspx</result>
        </action>
       
        <action name="ShowChangeRemotePort">
            <result>/HTML/tiles/configuration/ChangeRemotePort.jspx</result>
        </action>
       
        <action name="ChangeRemotePort"
                
class="admintool.http.controller.actions.configuration.ChangeRemotePortAction">
            <result 
name="input">/HTML/tiles/configuration/ChangeRemotePort.jspx</result>
        </action>
       
        <action name="ShowChangeMail">
            <result>/HTML/tiles/configuration/ChangeMail.jspx</result>
        </action>
       
        <action name="ChangeMail"
                
class="admintool.http.controller.actions.configuration.ChangeMailAction">
            <result 
name="input">/HTML/tiles/configuration/ChangeMail.jspx</result>
        </action>
       
        <action name="ShowChangeThreads">
            <result>/HTML/tiles/configuration/ChangeThreads.jspx</result>
        </action>
       
        <action name="ChangeThreads"
                
class="admintool.http.controller.actions.configuration.ChangeThreadsAction">
            <result 
name="input">/HTML/tiles/configuration/ChangeThreads.jspx</result>
        </action>
       
        <action name="ShowPlugins"
                
class="admintool.http.controller.actions.configuration.ShowPluginsAction">
            <result>/HTML/tiles/configuration/Plugins.jspx</result>
        </action>
       
       <!-- HERE IS THE PROBLEM -->
        <action name="AddPlugin"
                
class="admintool.http.controller.actions.configuration.AddPluginAction">
            <interceptor-ref name="fileUpload">
                <param name="allowedTypes">
                    application/java-archive,application/x-zip-compressed
                </param>
            </interceptor-ref>
            <interceptor-ref name="basicStack"/>
            <!--<interceptor-ref name="validation"/>-->
            <!--<interceptor-ref name="workflow"/>-->
            <result name="success" type="chain">ShowPlugins</result>
            <result 
name="input">/HTML/tiles/configuration/Plugins.jspx</result>
        </action>
       
        <action name="RemovePlugin"
                
class="admintool.http.controller.actions.configuration.RemovePluginAction">
            <result name="success" type="chain">ShowPlugins</result>
        </action>
               
       
       
        <!-- ===== Workspace ===== -->
       
        <action name="CancelWorkspace">
            <result>/HTML/tiles/workspace/WorkspaceInfo.jspx</result>
        </action>
       
        <action name="RefreshTree"
                
class="admintool.http.controller.actions.workspace.RefreshTreeAction">
            <result>/HTML/tiles/workspace/RefreshTree.jspx</result>
            <result name="input">/HTML/tiles/workspace/Tree.jspx</result>
        </action>
       
        <action name="ShowCreateProject">
            <result>/HTML/tiles/workspace/CreateProject.jspx</result>
        </action>
       
        <!-- Projects -->
       
        <action name="CreateProject"
                
class="admintool.http.controller.actions.workspace.CreateProjectAction">
            <result 
name="input">/HTML/tiles/workspace/CreateProject.jspx</result>
        </action>
       
        <action name="ShowUpdateProject"
                
class="admintool.http.controller.actions.workspace.ShowUpdateProjectAction">
            <result>/HTML/tiles/workspace/UpdateProject.jspx</result>
        </action>
       
        <action name="UpdateProject"
                
class="admintool.http.controller.actions.workspace.UpdateProjectAction">
            <result 
name="input">/HTML/tiles/workspace/UpdateProject.jspx</result>
        </action>
       
        <action name="RemoveProject"
                
class="admintool.http.controller.actions.workspace.RemoveProjectAction">
            <result 
name="input">/HTML/tiles/workspace/UpdateProject.jspx</result>
        </action>
       
        <!-- Data sources -->
       
        <action name="ShowAddElement"
                
class="admintool.http.controller.actions.workspace.ShowAddElementAction">
            <result>/HTML/tiles/workspace/AddElementLinks.jspx</result>
        </action>
       
        <action name="EditDataSource"
                
class="admintool.http.controller.actions.workspace.EditDataSourceAction">
            <result 
name="input">/HTML/tiles/workspace/AddElementLinks.jspx</result>
            <result 
name="create">/HTML/tiles/workspace/AddDataSource.jspx</result>
            <result 
name="update">/HTML/tiles/workspace/UpdateDataSource.jspx</result>
        </action>
       
        <action name="CreateDataSource"
                
class="admintool.http.controller.actions.workspace.CreateDataSourceAction">
            <result 
name="input">/HTML/tiles/workspace/AddDataSource.jspx</result>
        </action>
       
        <action name="UpdateDataSource"
                
class="admintool.http.controller.actions.workspace.UpdateDataSourceAction">
            <result 
name="input">/HTML/tiles/workspace/UpdateDataSource.jspx</result>
        </action>
       
        <!-- vale para borrar todos los elementos -->
        <action name="RemoveElement"
                
class="admintool.http.controller.actions.workspace.RemoveElementAction">
            <result 
name="input">/HTML/tiles/workspace/UpdateDataSource.jspx</result>
        </action>
       
        <!-- Filter sequences -->
       
        <action name="EditFilterSequence"
                
class="admintool.http.controller.actions.workspace.EditFilterSequenceAction">
            <result 
name="create">/HTML/tiles/workspace/AddFilterSequence.jspx</result>
            <result 
name="update">/HTML/tiles/workspace/UpdateFilterSequence.jspx</result>
        </action>
       
        <action name="AddFilter"
                
class="admintool.http.controller.actions.workspace.AddFilterAction">
            <result>/HTML/tiles/workspace/Filter.jspx</result>
        </action>
       
        <action name="AddFilterSequence"
                
class="admintool.http.controller.actions.workspace.AddFilterSequenceAction">
            <result 
name="input">/HTML/tiles/workspace/AddFilterSequence.jspx</result>
        </action>
       
        <action name="UpdateFilterSequence"
                
class="admintool.http.controller.actions.workspace.UpdateFilterSequenceAction">
            <result 
name="input">/HTML/tiles/workspace/UpdateFilterSequence.jspx</result>
        </action>
       
        <!-- Jobs -->
       
        <action name="EditJob"
                
class="admintool.http.controller.actions.workspace.EditJobAction">
            <result name="ARN-Index" 
type="redirect-action">EditJobARNIndex</result>
            <result name="ARN" type="redirect-action">EditJobARN</result>
            <result name="ITP" type="redirect-action">EditJobITP</result>
            <result name="VDP" type="redirect-action">EditJobVDP</result>
        </action>
       
        <action name="EditJobVDP"
                
class="admintool.http.controller.actions.workspace.EditJobVDPAction">
            <result 
name="create">/HTML/tiles/workspace/jobs/AddJobVDP.jspx</result>
            <result 
name="update">/HTML/tiles/workspace/jobs/UpdateJobVDP.jspx</result>
        </action>
       
        <action name="AddJobVDP"
                
class="admintool.http.controller.actions.workspace.AddJobVDPAction">
            <result 
name="input">/HTML/tiles/workspace/jobs/AddJobVDP.jspx</result>
        </action>
       
        <action name="UpdateJobVDP"
                
class="admintool.http.controller.actions.workspace.UpdateJobVDPAction">
            <result 
name="input">/HTML/tiles/workspace/jobs/UpdateJobVDP.jspx</result>
        </action>
       
        <action name="EditJobITP"
                
class="admintool.http.controller.actions.workspace.EditJobITPAction">
            <result 
name="create">/HTML/tiles/workspace/jobs/AddJobITP.jspx</result>
            <result 
name="update">/HTML/tiles/workspace/jobs/UpdateJobITP.jspx</result>
        </action>
       
        <action name="AddJobITP"
                
class="admintool.http.controller.actions.workspace.AddJobITPAction">
            <result 
name="input">/HTML/tiles/workspace/jobs/AddJobITP.jspx</result>
        </action>
       
        <action name="UpdateJobITP"
                
class="admintool.http.controller.actions.workspace.UpdateJobITPAction">
            <result 
name="input">/HTML/tiles/workspace/jobs/UpdateJobITP.jspx</result>
        </action>
       
        <action name="EditJobARN"
                
class="admintool.http.controller.actions.workspace.EditJobARNAction">
            <result 
name="create">/HTML/tiles/workspace/jobs/AddJobARN.jspx</result>
            <result 
name="update">/HTML/tiles/workspace/jobs/UpdateJobARN.jspx</result>
        </action>
       
        <action name="AddJobARN"
                
class="admintool.http.controller.actions.workspace.AddJobARNAction">
            <result 
name="input">/HTML/tiles/workspace/jobs/AddJobARN.jspx</result>
        </action>
       
        <action name="UpdateJobARN"
                
class="admintool.http.controller.actions.workspace.UpdateJobARNAction">
            <result 
name="input">/HTML/tiles/workspace/jobs/UpdateJobARN.jspx</result>
        </action>
       
        <action name="EditJobARNIndex"
                
class="admintool.http.controller.actions.workspace.EditJobARNIndexAction">
            <result 
name="create">/HTML/tiles/workspace/jobs/AddJobARNIndex.jspx</result>
            <result 
name="update">/HTML/tiles/workspace/jobs/UpdateJobARNIndex.jspx</result>
        </action>
       
        <action name="AddJobARNIndex"
                
class="admintool.http.controller.actions.workspace.AddJobARNIndexAction">
            <result 
name="input">/HTML/tiles/workspace/jobs/AddJobARNIndex.jspx</result>
        </action>
       
        <action name="UpdateJobARNIndex"
                
class="admintool.http.controller.actions.workspace.UpdateJobARNIndexAction">
            <result 
name="input">/HTML/tiles/workspace/jobs/UpdateJobARNIndex.jspx</result>
        </action>
       
        <action name="AddField"
                
class="admintool.http.controller.actions.workspace.AddFieldAction">
            <result 
name="list">/HTML/tiles/workspace/jobs/sources/FieldList.jspx</result>
            <result 
name="csv">/HTML/tiles/workspace/jobs/sources/FieldCSV.jspx</result>
            <result 
name="database">/HTML/tiles/workspace/jobs/sources/FieldDatabase.jspx</result>
        </action>
       
        <action name="AddProcessor"
                
class="admintool.http.controller.actions.workspace.AddProcessorAction">
            
<result>/HTML/tiles/workspace/jobs/exporters/Processor.jspx</result>
        </action>
       
        <action name="AddExporter"
                
class="admintool.http.controller.actions.workspace.AddExporterAction">
            <result 
name="ARN-Index">/HTML/tiles/workspace/jobs/exporters/ExporterARN.jspx</result>
            <result 
name="CSV">/HTML/tiles/workspace/jobs/exporters/ExporterCSV.jspx</result>
            <result 
name="JDBC">/HTML/tiles/workspace/jobs/exporters/ExporterJDBC.jspx</result>
            <result 
name="SQL">/HTML/tiles/workspace/jobs/exporters/ExporterSQL.jspx</result>
            <result 
name="Custom">/HTML/tiles/workspace/jobs/exporters/ExporterCustom.jspx</result>
        </action>
       
        <action name="AddHandler"
                
class="admintool.http.controller.actions.workspace.AddHandlerAction">
            <result 
name="mail">/HTML/tiles/workspace/jobs/handlers/HandlerMail.jspx</result>
            <result 
name="retry">/HTML/tiles/workspace/jobs/handlers/HandlerRetry.jspx</result>
            <result 
name="Custom">/HTML/tiles/workspace/jobs/handlers/HandlerCustom.jspx</result>
        </action>
       
        <action name="AddTrigger"
                
class="admintool.http.controller.actions.workspace.AddTriggerAction">
            <result 
name="cron">/HTML/tiles/workspace/jobs/triggers/TriggerCron.jspx</result>
        </action>
       
        <action name="AddWrapper"
                
class="admintool.http.controller.actions.workspace.AddWrapperAction">
            <result>/HTML/tiles/workspace/jobs/Wrapper.jspx</result>
        </action>
       
        <action name="AddCrawler"
                
class="admintool.http.controller.actions.workspace.AddCrawlerAction">
            
<result>/HTML/tiles/workspace/jobs/crawlers/Crawler.jspx</result>
        </action>
       
        <action name="AddAction"
                
class="admintool.http.controller.actions.workspace.AddActionAction">
            <result 
name="checkURI">/HTML/tiles/workspace/jobs/actions/ActionCheckURI.jspx</result>
            <result 
name="deleteDocs">/HTML/tiles/workspace/jobs/actions/ActionDeleteDocs.jspx</result>
            <result 
name="Custom">/HTML/tiles/workspace/jobs/actions/Action.jspx</result>
        </action>

    </package>
   
</struts>





Dave Newton escribió:
> --- Cheng Wei Lee <zhenwei.li@gmail.com> wrote:
>   
>> Could you list out your entire XML file? I believe namespace is required?
>>     
>
> Namespace isn't required and will default to "" (the empty string) [1,2].
>
>   
>> Pablo Vázquez Blázquez <pvazquez@denodo.com> wrote:
>>     
>>> <package name="scheduler" extends="struts-default">
>>>
>>> Everything is into this package. I didn´t define namespaces.
>>> My only own stack is "defaultLoginStack", but I am not using it in the
>>> involved action.
>>> I followed the instructions at
>>> http://struts.apache.org/2.0.9/docs/file-upload-interceptor.html, but it
>>> doesn´t work.
>>>
>>> Another thing is that, when I execute the action in IE, it gives me an
>>> error saying: "Error: Only one top level element is allowed in an XML
>>> document."
>>>       
>
> What is on the stack trace? Without any more to go on it sounds like you have
> a configuration problem. As Lee Cheng Wei said we'll need to see your
> configuration file to help. In this case we'd probably want to see all of it
> so we can check it both for well-formedness, and interceptor stack and action
> configuration.
>
> d.
>
> [1] http://struts.apache.org/2.x/docs/package-configuration.html
> [2] http://struts.apache.org/2.x/docs/namespace-configuration.html
> [tags: s2, file upload, configuration]
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message