You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Pablo Vázquez Blázquez <pv...@denodo.com> on 2008/01/16 19:32:44 UTC

File Upload

I am using Struts 2.0.9 and I have the following action:

    <action name="AddPlugin"
                class="AddPluginAction">
            <interceptor-ref name="fileUpload"/>
            <interceptor-ref name="basicStack"/>
            <result>/HTML/tiles/configuration/Plugins.jspx</result>
            <result 
name="input">/HTML/tiles/configuration/Plugins.jspx</result>
        </action>

The action is successfully executed, but the "indicator" does not stop 
and it does not go to Plugins.jspx (it "hands on the air").

Do I have any problem with my interceptors? What else can be?

Thanks.


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


Re: File Upload

Posted by Pablo Vázquez Blázquez <pv...@denodo.com>.
Is there any problem with this mail list? I can´t send mails.

Jeromy Evans escribió:
> I'd use a breakpoint in to inspect the content of the data variable.  
> Is it a tree of Nodes or is it plain text/html?  If the former it can 
> be appended/inserted directly into the DOM with the respective method. 
> If the latter the code below would be throwing a NPE and you can use 
> innerHTML=data.
>
> innerHTML also has a few quirks in IE6 and IE7. Dojo itself may 
> include some functions for manipulating the DOM reliably.  Check the 
> 0.4 API.
>
> Pablo Vázquez Blázquez wrote:
>> Hello again,
>>
>> If I change:
>> load: function(type, data, evt){
>>          document.getElementById("mydiv").innerHTML =
>> data.firstChild.innerHTML;
>>
>> for:
>>
>> load: function(type, data, evt){
>>          document.getElementById("mydiv").innerHTML = 'HELLO';
>>
>> it works. But I want to show the response content. Do you know why 
>> "data.firstChild.innerHTML" is "undefined"??
>>
>> Thanks.
>>
>>
>> Pablo Vázquez Blázquez escribió:
>>> Thanks for your reply.
>>>
>>> I have looked the links below and I tried what it says:
>>>
>>> The form:
>>>
>>> <form id="myform" action="nodecorate/myaction.action"
>>> enctype="multipart/form-data" method="post">
>>>      <s:file name="myfile"></s:file>
>>>      <input type="button" onclick="sendIt(); return false;">
>>> </form>
>>>
>>> The javascript:
>>>
>>> function sendIt(){
>>>   var bindArgs = {
>>>       transport: "IframeTransport",
>>>       formNode: document.getElementById("myform"),
>>>       mimetype: "text/html",
>>>       load: function(type, data, evt){
>>>           document.getElementById("mydiv").innerHTML =
>>> data.firstChild.innerHTML;
>>>       }
>>>   };
>>>   var request = dojo.io.bind(bindArgs);
>>> }
>>>
>>> The div with id 'mydiv' will then get updated with the response from 
>>> the
>>> action.
>>>
>>>
>>>
>>> Well, my form looks like this:
>>>
>>>    <s:form id="addPluginForm" name="addPluginForm" theme="simple" 
>>>            action="AddPlugin" enctype="multipart/form-data" 
>>> method="post">
>>>               <div class="field">
>>>            <span class="label">
>>>                <fmt:message key="PluginsTable.File"/>*:
>>>            </span>
>>>            <span class="entry">
>>>                <s:file name="upload" size="40"
>>>                    accept="application/java-archive"/>
>>>                <span id="errorId" class="errorMessage">
>>>                    <s:property value="fieldErrors['upload'][0]" />
>>>                </span>
>>>                <span id="errorId" class="errorMessage">
>>>                    <s:property 
>>> value="fieldErrors['uploadContentType'][0]" />
>>>                </span>
>>>            </span>
>>>        </div>
>>>               <!-- BOTONES -->
>>>        <div class="button">
>>>            <span class="buttonLeft">
>>>                <s:submit type="button"                         
>>> onclick="sendMultiPartForm('addPluginForm', 'configAjaxContent'); 
>>> return false;"
>>>                        cssClass="submit">
>>>                    <s:param name="value">
>>>                        <fmt:message key="Buttons.accept"/>
>>>                    </s:param>
>>>                </s:submit>
>>>            </span>
>>>            <span class="buttonRight">
>>>                <!-- cancelar -->
>>>                <s:url id="CancelUrl" action="CancelConfiguration"/>
>>>                <s:submit type="button" theme="ajax" 
>>> targets="configAjaxContent"                        
>>> showLoadingText="false" cssClass="reset" href="${CancelUrl}">
>>>                    <s:param name="value">
>>>                        <fmt:message key="Buttons.cancel"/>
>>>                    </s:param>
>>>                </s:submit>
>>>            </span>
>>>        </div>
>>>           </s:form>
>>>
>>> and my Javascript:
>>>
>>> function sendMultiPartForm(formId, targetId) {
>>>       dojo.require("dojo.io.IframeIO");
>>>    var bindArgs = {
>>>       transport: "IframeTransport",
>>>       formNode: document.getElementById(formId),
>>>       mimetype: "text/html",
>>>       load: function(type, data, evt) {
>>>           document.getElementById(targetId).innerHTML =
>>>                data.firstChild.innerHTML;
>>>       }
>>>    };
>>>      var request = dojo.io.bind(bindArgs);
>>> }
>>>
>>> Unfortunately, it is happening the same than before: the file is 
>>> uploaded but my target div is not being updated with the action's 
>>> response content. And, as before, if I want to upload another file, 
>>> I must go first to another action and then, return to this one; if 
>>> not, it doesn't work...
>>>
>>>
>>> Am I missing sth? Doing sth wrong?
>>>
>>>
>>>
>>>
>>>
>>>
>>> Jeromy Evans escribió:
>>>> hmm...that's interesting.
>>>>
>>>> My approach would be to create a new blank struts application that 
>>>> just contains a file upload action. Get it to work without ajax as 
>>>> there still seems to be a configuration problem.
>>>>
>>>> Then, when you're satisfied the configuration is correct... 
>>>> unfortunately you can't use s:form theme=ajax to perform a 
>>>> multi-part upload in Struts2.0.  To perform an asynchronous upload, 
>>>> you'll have to use Dojo's IFrameIO feature directly.  I haven't 
>>>> used it myself, but it's described in the following two posts:
>>>>
>>>> http://www.mail-archive.com/user@struts.apache.org/msg60245.html
>>>> http://www.nabble.com/Image-Upload-and-Dojo-td14350527.html
>>>>
>>>> I hope that helps!
>>>>
>>>> Pablo Vázquez Blázquez wrote:
>>>>> Error de lectura XML: contenido incorrecto tras un elemento XML 
>>>>> del documento
>>>>> Ubicación: http://localhost:8080/scheduler-admintool-1.0/AddPlugin.do
>>>>> Número de línea 8, columna 1:<form id="addPluginForm" 
>>>>> name="addPluginForm" onsubmit="return true;" 
>>>>> action="/scheduler-admintool-1.0/AddPlugin.do" method="post" 
>>>>> enctype="multipart/form-data">
>>>>> ^
>>>>>
>>>>> That´s the result if I try without the ajax theme on the form.
>>>>>
>>>>> Yes, I would like to use the ajax theme.
>>>>>
>>>>> Thanks.
>>>>>
>>>>> Jeromy Evans escribió:
>>>>>> Are you deliberately trying to do an XHR file upload? Have you 
>>>>>> tried it without the ajax theme on the form?
>>>>>>
>>>>>> Pablo Vázquez Blázquez wrote:
>>>>>>> Yes yes, that debugging statement is executed. That´s why I know 
>>>>>>> my plugin is created.
>>>>>>>
>>>>>>> "Anadido plugin " + uploadFileName means "Added plugin " + 
>>>>>>> uploadFileName.
>>>>>>>
>>>>>>> And then, it goes to ShowPlugins and the debugging statement
>>>>>>> log.debug("Obtenidos plugins"); (Getted all plugins) is also 
>>>>>>> executed.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Cheng Wei Lee escribió:
>>>>>>>> Was this debugging statement executed?
>>>>>>>>
>>>>>>>>            log.debug("Anadido plugin " + uploadFileName);
>>>>>>>>
>>>>>>>>
>>>>>>>> On Jan 18, 2008 12:13 AM, Pablo Vázquez Blázquez 
>>>>>>>> <pv...@denodo.com>
>>>>>>>> wrote:
>>>>>>>>
>>>>>>>>  
>>>>>>>>> Here I send you my JSP and Action code.
>>>>>>>>>
>>>>>>>>> Yes, when I submit, the new plugin is added (I know it because 
>>>>>>>>> of my
>>>>>>>>> logs), but I don´t know why I don´t get the result page.
>>>>>>>>>
>>>>>>>>> Thank you.
>>>>>>>>>
>>>>>>>>> PD: I have now tried without struts.multipart.parser, but it 
>>>>>>>>> doesn´t work.
>>>>>>>>>
>>>>>>>>> ****** JSP ******
>>>>>>>>>
>>>>>>>>> <jsp:root xmlns="http://www.w3.org/1999/xhtml"
>>>>>>>>>    xmlns:jsp="http://java.sun.com/JSP/Page"
>>>>>>>>>    xmlns:fmt="http://java.sun.com/jsp/jstl/fmt"
>>>>>>>>>    xmlns:c="http://java.sun.com/jsp/jstl/core"
>>>>>>>>>    xmlns:s="/struts-tags"
>>>>>>>>>    version="2.0">
>>>>>>>>>
>>>>>>>>>    <!-- Tabla con los plugins. Si no hay ninguno, se muestra 
>>>>>>>>> un mensaje
>>>>>>>>> -->
>>>>>>>>>    <table class="pluginsTable" cellspacing="0px" 
>>>>>>>>> cellpadding="3px"
>>>>>>>>> border="1px">
>>>>>>>>>        <tbody>
>>>>>>>>>            <tr>
>>>>>>>>>                <td class="tableTitle" colspan="5">
>>>>>>>>>                    <fmt:message key="PluginsTable.Title"/>
>>>>>>>>>                </td>
>>>>>>>>>            </tr>
>>>>>>>>>            <tr>
>>>>>>>>>                <td class="tableHeader">
>>>>>>>>>                    <fmt:message key="PluginsTable.Name"/>
>>>>>>>>>                </td>
>>>>>>>>>                <td class="tableHeader">
>>>>>>>>>                    <fmt:message key="PluginsTable.JarFile"/>
>>>>>>>>>                </td>
>>>>>>>>>                <td class="tableHeader">
>>>>>>>>>                    <fmt:message key="PluginsTable.PluginClass"/>
>>>>>>>>>                </td>
>>>>>>>>>                <td class="tableHeader">
>>>>>>>>>                    <fmt:message key="PluginsTable.Type"/>
>>>>>>>>>                </td>
>>>>>>>>>                <td class="tableHeader">
>>>>>>>>>                    <fmt:message key="PluginsTable.Actions"/>
>>>>>>>>>                </td>
>>>>>>>>>            </tr>
>>>>>>>>>            <c:if test="${empty plugins}">
>>>>>>>>>                <tr>
>>>>>>>>>                    <td class="tableMessage" colspan="5">
>>>>>>>>>                        <fmt:message 
>>>>>>>>> key="PluginsTable.NoPlugins"/>
>>>>>>>>>                    </td>
>>>>>>>>>                </tr>
>>>>>>>>>            </c:if>
>>>>>>>>>            <c:forEach items="${plugins}" var="plugin" 
>>>>>>>>> varStatus="status">
>>>>>>>>>                <!-- stuff -->
>>>>>>>>>            </c:forEach>
>>>>>>>>>        </tbody>
>>>>>>>>>    </table>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>    <!-- Form to add plugin -->
>>>>>>>>>    <s:form id="addPluginForm" name="addPluginForm" theme="ajax"
>>>>>>>>>            action="AddPlugin" enctype="multipart/form-data" 
>>>>>>>>> method="post">
>>>>>>>>>
>>>>>>>>>        <div class="field">
>>>>>>>>>            <span class="label">
>>>>>>>>>                <fmt:message key="PluginsTable.File"/>*:
>>>>>>>>>            </span>
>>>>>>>>>            <span class="entry">
>>>>>>>>>                <s:file name="upload" size="40"
>>>>>>>>>                    accept="application/java-archive"/>
>>>>>>>>>                <span id="errorId" class="errorMessage">
>>>>>>>>>                    <s:property 
>>>>>>>>> value="fieldErrors['upload'][0]" />
>>>>>>>>>                </span>
>>>>>>>>>                <span id="errorId" class="errorMessage">
>>>>>>>>>                    <s:property 
>>>>>>>>> value="fieldErrors['uploadContentType'][0]"
>>>>>>>>> />
>>>>>>>>>                </span>
>>>>>>>>>            </span>
>>>>>>>>>        </div>
>>>>>>>>>
>>>>>>>>>        <!-- BOTONES -->
>>>>>>>>>        <jsp:directive.include file="FormButtons.jspf"/>
>>>>>>>>>
>>>>>>>>>    </s:form>
>>>>>>>>>
>>>>>>>>> </jsp:root>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> ****** FORMBUTTONS.JSPF****
>>>>>>>>>
>>>>>>>>> <!-- BUTTONS-->
>>>>>>>>> <div class="button">
>>>>>>>>>    <span class="buttonLeft">
>>>>>>>>>        <s:submit type="button"
>>>>>>>>>                targets="configAjaxContent" executeScripts="true"
>>>>>>>>>                showLoadingText="false" indicator="indicator"
>>>>>>>>> cssClass="submit">
>>>>>>>>>            <s:param name="value">
>>>>>>>>>                <fmt:message key="Buttons.accept"/>
>>>>>>>>>            </s:param>
>>>>>>>>>        </s:submit>
>>>>>>>>>    </span>
>>>>>>>>>    <span class="buttonRight">
>>>>>>>>>        <!-- cancelar -->
>>>>>>>>>        <s:url id="CancelUrl" action="CancelConfiguration"/>
>>>>>>>>>        <s:submit type="button" targets="configAjaxContent"
>>>>>>>>>                showLoadingText="false" cssClass="reset"
>>>>>>>>> href="${CancelUrl}">
>>>>>>>>>            <s:param name="value">
>>>>>>>>>                <fmt:message key="Buttons.cancel"/>
>>>>>>>>>            </s:param>
>>>>>>>>>        </s:submit>
>>>>>>>>>    </span>
>>>>>>>>> </div>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> *****ACTION *****
>>>>>>>>> public class AddPluginAction extends 
>>>>>>>>> DefaultRequestResponseAction {
>>>>>>>>>
>>>>>>>>>    private static final long serialVersionUID = 
>>>>>>>>> 1516786859681901796L;
>>>>>>>>>
>>>>>>>>>    /**
>>>>>>>>>     * Logger for this class
>>>>>>>>>     */
>>>>>>>>>    private static final Log log = 
>>>>>>>>> LogFactory.getLog(AddPluginAction.class
>>>>>>>>> );
>>>>>>>>>
>>>>>>>>>    private File upload;
>>>>>>>>>    private String uploadContentType;
>>>>>>>>>    private String uploadFileName;
>>>>>>>>>
>>>>>>>>>    @Override
>>>>>>>>>    protected String doExecute() throws Exception {
>>>>>>>>>
>>>>>>>>>        clearErrorsAndMessages();
>>>>>>>>>
>>>>>>>>>        Context context =
>>>>>>>>>            SessionManager.getRemoteServerContext(getRequest());
>>>>>>>>>
>>>>>>>>>        SchedulerManager facade =
>>>>>>>>>            SessionManager.getUserFacadeDelegate(getRequest(), 
>>>>>>>>> context);
>>>>>>>>>
>>>>>>>>>        try {
>>>>>>>>>
>>>>>>>>>            byte[] filedata = readInputStream(new 
>>>>>>>>> FileInputStream(upload));
>>>>>>>>>
>>>>>>>>>            facade.addPlugin(uploadFileName, filedata);
>>>>>>>>>
>>>>>>>>>            log.debug("Anadido plugin " + uploadFileName);
>>>>>>>>>
>>>>>>>>>        } catch (ConnectException e) {
>>>>>>>>>            log.error(e);
>>>>>>>>>            throw new InternalErrorException(e);
>>>>>>>>>
>>>>>>>>>        } catch (DuplicateInstanceException e) {
>>>>>>>>>            log.error(e);
>>>>>>>>>            addFieldError("upload",
>>>>>>>>>                    getText("PluginsTable.File.Duplicate"));
>>>>>>>>>
>>>>>>>>>        } catch (FileNotFoundException e) {
>>>>>>>>>            log.error(e);
>>>>>>>>>            addFieldError("upload",
>>>>>>>>>                    getText("PluginsTable.File.NotFound"));
>>>>>>>>>
>>>>>>>>>        } catch (Exception e) {
>>>>>>>>>            log.error(e);
>>>>>>>>>            addFieldError("uploadContentType",
>>>>>>>>>                    
>>>>>>>>> getText("ErrorMessages.file.incorrectExtension"));
>>>>>>>>>        }
>>>>>>>>>
>>>>>>>>>        if (hasErrors()) {
>>>>>>>>>            return Action.INPUT;
>>>>>>>>>        }
>>>>>>>>>
>>>>>>>>>        return Action.SUCCESS;
>>>>>>>>>    }
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>    /*
>>>>>>>>>     * Read an input stream in its entirety into a byte array
>>>>>>>>>     */
>>>>>>>>>    private static byte[] readInputStream(InputStream inputStream)
>>>>>>>>>        throws IOException {
>>>>>>>>>
>>>>>>>>>        ....
>>>>>>>>>
>>>>>>>>>        return content;
>>>>>>>>>    }
>>>>>>>>>
>>>>>>>>>    /**
>>>>>>>>>     * Getters/Setters
>>>>>>>>>     * @return
>>>>>>>>>     */
>>>>>>>>>
>>>>>>>>>    public File getUpload() {
>>>>>>>>>        return upload;
>>>>>>>>>    }
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>    public void setUpload(File upload) {
>>>>>>>>>        this.upload = upload;
>>>>>>>>>    }
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>    public String getUploadContentType() {
>>>>>>>>>        return uploadContentType;
>>>>>>>>>    }
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>    public void setUploadContentType(String uploadContentType) {
>>>>>>>>>        this.uploadContentType = uploadContentType;
>>>>>>>>>    }
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>    public String getUploadFileName() {
>>>>>>>>>        return uploadFileName;
>>>>>>>>>    }
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>    public void setUploadFileName(String uploadFileName) {
>>>>>>>>>        this.uploadFileName = uploadFileName;
>>>>>>>>>    }
>>>>>>>>>
>>>>>>>>> }
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Dave Newton escribió:
>>>>>>>>>
>>>>>>>>>  
>>>>>>>>>> --- Pablo Vázquez Blázquez <pv...@denodo.com> wrote:
>>>>>>>>>>
>>>>>>>>>>  
>>>>>>>>>>> I send you my struts-config.xml file, but it works ok. If I 
>>>>>>>>>>> delete my
>>>>>>>>>>> "s:file" from my form, everything works fine.
>>>>>>>>>>>
>>>>>>>>>>>         
>>>>>>>>>> The error happens after you submit, correct?
>>>>>>>>>>
>>>>>>>>>> I guess I'd want to see the JSP and the action code, then; the
>>>>>>>>>>       
>>>>>>>>> configuration
>>>>>>>>>  
>>>>>>>>>> seems okay.
>>>>>>>>>>
>>>>>>>>>> Have you tried it without setting the "struts.multipart.parser"
>>>>>>>>>>       
>>>>>>>>> constant? The
>>>>>>>>>  
>>>>>>>>>> default value of that is "jakarta", not a classname; it's 
>>>>>>>>>> worth a shot,
>>>>>>>>>> anyway.
>>>>>>>>>>
>>>>>>>>>> d.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>  
>>>>>>>>>>> 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">
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>         
>>>>>>>>>> === message truncated ===
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> --------------------------------------------------------------------- 
>>>>>>>>>>
>>>>>>>>>> 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
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>     
>>>>>>>
>>>>>>>
>>>>>>> --------------------------------------------------------------------- 
>>>>>>>
>>>>>>> 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
>>>>>>
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> 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
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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
>>
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> 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


Re: File Upload

Posted by Pablo Vázquez Blázquez <pv...@denodo.com>.
If I add this script to the end of Plugins.jspx, firebug says: "dojo is 
not defined". How is it possible?

<script type="text/javascript">
        function fixLinks() {
            var wid = dojo.widget.byId("removePluginAnchor");
            alert(wid);
        }
        dojo.addOnLoad(fixLinks);       
    </script>



Pablo Vázquez Blázquez escribió:
> I always try first in Firefox, you know...
>
> And yes, I´m debugging with firebug (what would I do without this 
> tool??).
>
> If I begin my "Plugins.jspx" with "jsp:root" tag (with no syntax 
> problem, as it works fine when is loaded by "ShowPlugins.do" action) 
> the load function from the javascript gives me an "parse error" (I 
> don´t know why) and then, begining it with "div" and importing all 
> namespaces it also works fine when is loaded by "ShowPlugins.do" 
> action, but does not work when is loaded as response from a file 
> upload request, because the anchor tags are bad generated (not to use 
> ajax theme)  (I don´t know if I have explained the issue fine).
>
> Thanks.
>
>
>
> Jeromy Evans escribió:
>> Sorry Pablo, I'm not sure about this.
>>
>> My suggestions are:
>>  - try it in FireFox.  If it works, you know you have an IE-specific 
>> problem.  If it doesn't work, there's something wrong with the code
>>  - innerHTML is known to have quirks in IE.  I'd simplify the HTML 
>> result and work upwards from plain text to find the specific 
>> combination of HTML tags that cause the problem (not JSP-tags, the 
>> generated HTML)
>>
>> I'm not likely to find anything looking at the JSP.  You'll have to 
>> debug it at runtime.  I always use FireBug to inspect the AJAX result 
>> prior to inserting it into the page.
>>
>> Pablo Vázquez Blázquez wrote:
>>> Any idea?
>>>
>>> How can I fix the "Delete links" problem?
>>>
>>>
>>>
>>> Pablo Vázquez Blázquez escribió:
>>>> Well, if I begin my Plugins.jspx with a div tag, it works (before, 
>>>> the begin was a jsp:root tag). But, when the response is loaded (it 
>>>> is the same page but with a new plugin entry), the "delete" link is 
>>>> bad created.
>>>> So, 2 questions:
>>>>
>>>> a) why didn´t it work with jsp:root?
>>>> b) why delete links are bad generated if, when I access normally to 
>>>> the page, they are fine? (Now, they dont work with ajax. I click 
>>>> and go to the "whole url").
>>>> c) Why if I don´t comment the cancel button it doesn´t work?
>>>>
>>>> Thanks to everybody who has helped me.
>>>>
>>>> ************
>>>>
>>>> I can´t send you my Plugins.jspx because my message is recognized 
>>>> as spam... I would be pleased sending it to you by personal email 
>>>> if you wish.
>>>>
>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> 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
>>>
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> 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
>


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


Re: File Upload

Posted by Pablo Vázquez Blázquez <pv...@denodo.com>.
I always try first in Firefox, you know...

And yes, I´m debugging with firebug (what would I do without this tool??).

If I begin my "Plugins.jspx" with "jsp:root" tag (with no syntax 
problem, as it works fine when is loaded by "ShowPlugins.do" action) the 
load function from the javascript gives me an "parse error" (I don´t 
know why) and then, begining it with "div" and importing all namespaces 
it also works fine when is loaded by "ShowPlugins.do" action, but does 
not work when is loaded as response from a file upload request, because 
the anchor tags are bad generated (not to use ajax theme)  (I don´t know 
if I have explained the issue fine).

Thanks.



Jeromy Evans escribió:
> Sorry Pablo, I'm not sure about this.
>
> My suggestions are:
>  - try it in FireFox.  If it works, you know you have an IE-specific 
> problem.  If it doesn't work, there's something wrong with the code
>  - innerHTML is known to have quirks in IE.  I'd simplify the HTML 
> result and work upwards from plain text to find the specific 
> combination of HTML tags that cause the problem (not JSP-tags, the 
> generated HTML)
>
> I'm not likely to find anything looking at the JSP.  You'll have to 
> debug it at runtime.  I always use FireBug to inspect the AJAX result 
> prior to inserting it into the page.
>
> Pablo Vázquez Blázquez wrote:
>> Any idea?
>>
>> How can I fix the "Delete links" problem?
>>
>>
>>
>> Pablo Vázquez Blázquez escribió:
>>> Well, if I begin my Plugins.jspx with a div tag, it works (before, 
>>> the begin was a jsp:root tag). But, when the response is loaded (it 
>>> is the same page but with a new plugin entry), the "delete" link is 
>>> bad created.
>>> So, 2 questions:
>>>
>>> a) why didn´t it work with jsp:root?
>>> b) why delete links are bad generated if, when I access normally to 
>>> the page, they are fine? (Now, they dont work with ajax. I click and 
>>> go to the "whole url").
>>> c) Why if I don´t comment the cancel button it doesn´t work?
>>>
>>> Thanks to everybody who has helped me.
>>>
>>> ************
>>>
>>> I can´t send you my Plugins.jspx because my message is recognized as 
>>> spam... I would be pleased sending it to you by personal email if 
>>> you wish.
>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> 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


Re: File Upload

Posted by Jeromy Evans <je...@blueskyminds.com.au>.
Sorry Pablo, I'm not sure about this.

My suggestions are:
  - try it in FireFox.  If it works, you know you have an IE-specific 
problem.  If it doesn't work, there's something wrong with the code
  - innerHTML is known to have quirks in IE.  I'd simplify the HTML 
result and work upwards from plain text to find the specific combination 
of HTML tags that cause the problem (not JSP-tags, the generated HTML)

I'm not likely to find anything looking at the JSP.  You'll have to 
debug it at runtime.  I always use FireBug to inspect the AJAX result 
prior to inserting it into the page.

Pablo Vázquez Blázquez wrote:
> Any idea?
>
> How can I fix the "Delete links" problem?
>
>
>
> Pablo Vázquez Blázquez escribió:
>> Well, if I begin my Plugins.jspx with a div tag, it works (before, 
>> the begin was a jsp:root tag). But, when the response is loaded (it 
>> is the same page but with a new plugin entry), the "delete" link is 
>> bad created.
>> So, 2 questions:
>>
>> a) why didn´t it work with jsp:root?
>> b) why delete links are bad generated if, when I access normally to 
>> the page, they are fine? (Now, they dont work with ajax. I click and 
>> go to the "whole url").
>> c) Why if I don´t comment the cancel button it doesn´t work?
>>
>> Thanks to everybody who has helped me.
>>
>> ************
>>
>> I can´t send you my Plugins.jspx because my message is recognized as 
>> spam... I would be pleased sending it to you by personal email if you 
>> wish.
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> 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
>
>
>


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


Re: File Upload

Posted by Pablo Vázquez Blázquez <pv...@denodo.com>.
Any idea?

How can I fix the "Delete links" problem?



Pablo Vázquez Blázquez escribió:
> Well, if I begin my Plugins.jspx with a div tag, it works (before, the 
> begin was a jsp:root tag). But, when the response is loaded (it is the 
> same page but with a new plugin entry), the "delete" link is bad created.
> So, 2 questions:
>
> a) why didn´t it work with jsp:root?
> b) why delete links are bad generated if, when I access normally to 
> the page, they are fine? (Now, they dont work with ajax. I click and 
> go to the "whole url").
> c) Why if I don´t comment the cancel button it doesn´t work?
>
> Thanks to everybody who has helped me.
>
> ************
>
> I can´t send you my Plugins.jspx because my message is recognized as 
> spam... I would be pleased sending it to you by personal email if you 
> wish.
>
>
>
>
> ---------------------------------------------------------------------
> 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


Re: File Upload

Posted by Pablo Vázquez Blázquez <pv...@denodo.com>.
Well, if I begin my Plugins.jspx with a div tag, it works (before, the 
begin was a jsp:root tag). But, when the response is loaded (it is the 
same page but with a new plugin entry), the "delete" link is bad created.
So, 2 questions:

a) why didn´t it work with jsp:root?
b) why delete links are bad generated if, when I access normally to the 
page, they are fine? (Now, they dont work with ajax. I click and go to 
the "whole url").
c) Why if I don´t comment the cancel button it doesn´t work?

Thanks to everybody who has helped me.

************

I can´t send you my Plugins.jspx because my message is recognized as 
spam... I would be pleased sending it to you by personal email if you wish.




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


Re: File Upload

Posted by Jeromy Evans <je...@blueskyminds.com.au>.
I'd use a breakpoint in to inspect the content of the data variable.  Is 
it a tree of Nodes or is it plain text/html?  If the former it can be 
appended/inserted directly into the DOM with the respective method. If 
the latter the code below would be throwing a NPE and you can use 
innerHTML=data.

innerHTML also has a few quirks in IE6 and IE7. Dojo itself may include 
some functions for manipulating the DOM reliably.  Check the 0.4 API.

Pablo Vázquez Blázquez wrote:
> Hello again,
>
> If I change:
> load: function(type, data, evt){
>          document.getElementById("mydiv").innerHTML =
> data.firstChild.innerHTML;
>
> for:
>
> load: function(type, data, evt){
>          document.getElementById("mydiv").innerHTML = 'HELLO';
>
> it works. But I want to show the response content. Do you know why 
> "data.firstChild.innerHTML" is "undefined"??
>
> Thanks.
>
>
> Pablo Vázquez Blázquez escribió:
>> Thanks for your reply.
>>
>> I have looked the links below and I tried what it says:
>>
>> The form:
>>
>> <form id="myform" action="nodecorate/myaction.action"
>> enctype="multipart/form-data" method="post">
>>      <s:file name="myfile"></s:file>
>>      <input type="button" onclick="sendIt(); return false;">
>> </form>
>>
>> The javascript:
>>
>> function sendIt(){
>>   var bindArgs = {
>>       transport: "IframeTransport",
>>       formNode: document.getElementById("myform"),
>>       mimetype: "text/html",
>>       load: function(type, data, evt){
>>           document.getElementById("mydiv").innerHTML =
>> data.firstChild.innerHTML;
>>       }
>>   };
>>   var request = dojo.io.bind(bindArgs);
>> }
>>
>> The div with id 'mydiv' will then get updated with the response from the
>> action.
>>
>>
>>
>> Well, my form looks like this:
>>
>>    <s:form id="addPluginForm" name="addPluginForm" theme="simple" 
>>            action="AddPlugin" enctype="multipart/form-data" 
>> method="post">
>>               <div class="field">
>>            <span class="label">
>>                <fmt:message key="PluginsTable.File"/>*:
>>            </span>
>>            <span class="entry">
>>                <s:file name="upload" size="40"
>>                    accept="application/java-archive"/>
>>                <span id="errorId" class="errorMessage">
>>                    <s:property value="fieldErrors['upload'][0]" />
>>                </span>
>>                <span id="errorId" class="errorMessage">
>>                    <s:property 
>> value="fieldErrors['uploadContentType'][0]" />
>>                </span>
>>            </span>
>>        </div>
>>               <!-- BOTONES -->
>>        <div class="button">
>>            <span class="buttonLeft">
>>                <s:submit type="button"                         
>> onclick="sendMultiPartForm('addPluginForm', 'configAjaxContent'); 
>> return false;"
>>                        cssClass="submit">
>>                    <s:param name="value">
>>                        <fmt:message key="Buttons.accept"/>
>>                    </s:param>
>>                </s:submit>
>>            </span>
>>            <span class="buttonRight">
>>                <!-- cancelar -->
>>                <s:url id="CancelUrl" action="CancelConfiguration"/>
>>                <s:submit type="button" theme="ajax" 
>> targets="configAjaxContent"                        
>> showLoadingText="false" cssClass="reset" href="${CancelUrl}">
>>                    <s:param name="value">
>>                        <fmt:message key="Buttons.cancel"/>
>>                    </s:param>
>>                </s:submit>
>>            </span>
>>        </div>
>>           </s:form>
>>
>> and my Javascript:
>>
>> function sendMultiPartForm(formId, targetId) {
>>       dojo.require("dojo.io.IframeIO");
>>    var bindArgs = {
>>       transport: "IframeTransport",
>>       formNode: document.getElementById(formId),
>>       mimetype: "text/html",
>>       load: function(type, data, evt) {
>>           document.getElementById(targetId).innerHTML =
>>                data.firstChild.innerHTML;
>>       }
>>    };
>>      var request = dojo.io.bind(bindArgs);
>> }
>>
>> Unfortunately, it is happening the same than before: the file is 
>> uploaded but my target div is not being updated with the action's 
>> response content. And, as before, if I want to upload another file, I 
>> must go first to another action and then, return to this one; if not, 
>> it doesn't work...
>>
>>
>> Am I missing sth? Doing sth wrong?
>>
>>
>>
>>
>>
>>
>> Jeromy Evans escribió:
>>> hmm...that's interesting.
>>>
>>> My approach would be to create a new blank struts application that 
>>> just contains a file upload action. Get it to work without ajax as 
>>> there still seems to be a configuration problem.
>>>
>>> Then, when you're satisfied the configuration is correct... 
>>> unfortunately you can't use s:form theme=ajax to perform a 
>>> multi-part upload in Struts2.0.  To perform an asynchronous upload, 
>>> you'll have to use Dojo's IFrameIO feature directly.  I haven't used 
>>> it myself, but it's described in the following two posts:
>>>
>>> http://www.mail-archive.com/user@struts.apache.org/msg60245.html
>>> http://www.nabble.com/Image-Upload-and-Dojo-td14350527.html
>>>
>>> I hope that helps!
>>>
>>> Pablo Vázquez Blázquez wrote:
>>>> Error de lectura XML: contenido incorrecto tras un elemento XML del 
>>>> documento
>>>> Ubicación: http://localhost:8080/scheduler-admintool-1.0/AddPlugin.do
>>>> Número de línea 8, columna 1:<form id="addPluginForm" 
>>>> name="addPluginForm" onsubmit="return true;" 
>>>> action="/scheduler-admintool-1.0/AddPlugin.do" method="post" 
>>>> enctype="multipart/form-data">
>>>> ^
>>>>
>>>> That´s the result if I try without the ajax theme on the form.
>>>>
>>>> Yes, I would like to use the ajax theme.
>>>>
>>>> Thanks.
>>>>
>>>> Jeromy Evans escribió:
>>>>> Are you deliberately trying to do an XHR file upload? Have you 
>>>>> tried it without the ajax theme on the form?
>>>>>
>>>>> Pablo Vázquez Blázquez wrote:
>>>>>> Yes yes, that debugging statement is executed. That´s why I know 
>>>>>> my plugin is created.
>>>>>>
>>>>>> "Anadido plugin " + uploadFileName means "Added plugin " + 
>>>>>> uploadFileName.
>>>>>>
>>>>>> And then, it goes to ShowPlugins and the debugging statement
>>>>>> log.debug("Obtenidos plugins"); (Getted all plugins) is also 
>>>>>> executed.
>>>>>>
>>>>>>
>>>>>>
>>>>>> Cheng Wei Lee escribió:
>>>>>>> Was this debugging statement executed?
>>>>>>>
>>>>>>>            log.debug("Anadido plugin " + uploadFileName);
>>>>>>>
>>>>>>>
>>>>>>> On Jan 18, 2008 12:13 AM, Pablo Vázquez Blázquez 
>>>>>>> <pv...@denodo.com>
>>>>>>> wrote:
>>>>>>>
>>>>>>>  
>>>>>>>> Here I send you my JSP and Action code.
>>>>>>>>
>>>>>>>> Yes, when I submit, the new plugin is added (I know it because 
>>>>>>>> of my
>>>>>>>> logs), but I don´t know why I don´t get the result page.
>>>>>>>>
>>>>>>>> Thank you.
>>>>>>>>
>>>>>>>> PD: I have now tried without struts.multipart.parser, but it 
>>>>>>>> doesn´t work.
>>>>>>>>
>>>>>>>> ****** JSP ******
>>>>>>>>
>>>>>>>> <jsp:root xmlns="http://www.w3.org/1999/xhtml"
>>>>>>>>    xmlns:jsp="http://java.sun.com/JSP/Page"
>>>>>>>>    xmlns:fmt="http://java.sun.com/jsp/jstl/fmt"
>>>>>>>>    xmlns:c="http://java.sun.com/jsp/jstl/core"
>>>>>>>>    xmlns:s="/struts-tags"
>>>>>>>>    version="2.0">
>>>>>>>>
>>>>>>>>    <!-- Tabla con los plugins. Si no hay ninguno, se muestra un 
>>>>>>>> mensaje
>>>>>>>> -->
>>>>>>>>    <table class="pluginsTable" cellspacing="0px" cellpadding="3px"
>>>>>>>> border="1px">
>>>>>>>>        <tbody>
>>>>>>>>            <tr>
>>>>>>>>                <td class="tableTitle" colspan="5">
>>>>>>>>                    <fmt:message key="PluginsTable.Title"/>
>>>>>>>>                </td>
>>>>>>>>            </tr>
>>>>>>>>            <tr>
>>>>>>>>                <td class="tableHeader">
>>>>>>>>                    <fmt:message key="PluginsTable.Name"/>
>>>>>>>>                </td>
>>>>>>>>                <td class="tableHeader">
>>>>>>>>                    <fmt:message key="PluginsTable.JarFile"/>
>>>>>>>>                </td>
>>>>>>>>                <td class="tableHeader">
>>>>>>>>                    <fmt:message key="PluginsTable.PluginClass"/>
>>>>>>>>                </td>
>>>>>>>>                <td class="tableHeader">
>>>>>>>>                    <fmt:message key="PluginsTable.Type"/>
>>>>>>>>                </td>
>>>>>>>>                <td class="tableHeader">
>>>>>>>>                    <fmt:message key="PluginsTable.Actions"/>
>>>>>>>>                </td>
>>>>>>>>            </tr>
>>>>>>>>            <c:if test="${empty plugins}">
>>>>>>>>                <tr>
>>>>>>>>                    <td class="tableMessage" colspan="5">
>>>>>>>>                        <fmt:message key="PluginsTable.NoPlugins"/>
>>>>>>>>                    </td>
>>>>>>>>                </tr>
>>>>>>>>            </c:if>
>>>>>>>>            <c:forEach items="${plugins}" var="plugin" 
>>>>>>>> varStatus="status">
>>>>>>>>                <!-- stuff -->
>>>>>>>>            </c:forEach>
>>>>>>>>        </tbody>
>>>>>>>>    </table>
>>>>>>>>
>>>>>>>>
>>>>>>>>    <!-- Form to add plugin -->
>>>>>>>>    <s:form id="addPluginForm" name="addPluginForm" theme="ajax"
>>>>>>>>            action="AddPlugin" enctype="multipart/form-data" 
>>>>>>>> method="post">
>>>>>>>>
>>>>>>>>        <div class="field">
>>>>>>>>            <span class="label">
>>>>>>>>                <fmt:message key="PluginsTable.File"/>*:
>>>>>>>>            </span>
>>>>>>>>            <span class="entry">
>>>>>>>>                <s:file name="upload" size="40"
>>>>>>>>                    accept="application/java-archive"/>
>>>>>>>>                <span id="errorId" class="errorMessage">
>>>>>>>>                    <s:property value="fieldErrors['upload'][0]" />
>>>>>>>>                </span>
>>>>>>>>                <span id="errorId" class="errorMessage">
>>>>>>>>                    <s:property 
>>>>>>>> value="fieldErrors['uploadContentType'][0]"
>>>>>>>> />
>>>>>>>>                </span>
>>>>>>>>            </span>
>>>>>>>>        </div>
>>>>>>>>
>>>>>>>>        <!-- BOTONES -->
>>>>>>>>        <jsp:directive.include file="FormButtons.jspf"/>
>>>>>>>>
>>>>>>>>    </s:form>
>>>>>>>>
>>>>>>>> </jsp:root>
>>>>>>>>
>>>>>>>>
>>>>>>>> ****** FORMBUTTONS.JSPF****
>>>>>>>>
>>>>>>>> <!-- BUTTONS-->
>>>>>>>> <div class="button">
>>>>>>>>    <span class="buttonLeft">
>>>>>>>>        <s:submit type="button"
>>>>>>>>                targets="configAjaxContent" executeScripts="true"
>>>>>>>>                showLoadingText="false" indicator="indicator"
>>>>>>>> cssClass="submit">
>>>>>>>>            <s:param name="value">
>>>>>>>>                <fmt:message key="Buttons.accept"/>
>>>>>>>>            </s:param>
>>>>>>>>        </s:submit>
>>>>>>>>    </span>
>>>>>>>>    <span class="buttonRight">
>>>>>>>>        <!-- cancelar -->
>>>>>>>>        <s:url id="CancelUrl" action="CancelConfiguration"/>
>>>>>>>>        <s:submit type="button" targets="configAjaxContent"
>>>>>>>>                showLoadingText="false" cssClass="reset"
>>>>>>>> href="${CancelUrl}">
>>>>>>>>            <s:param name="value">
>>>>>>>>                <fmt:message key="Buttons.cancel"/>
>>>>>>>>            </s:param>
>>>>>>>>        </s:submit>
>>>>>>>>    </span>
>>>>>>>> </div>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> *****ACTION *****
>>>>>>>> public class AddPluginAction extends 
>>>>>>>> DefaultRequestResponseAction {
>>>>>>>>
>>>>>>>>    private static final long serialVersionUID = 
>>>>>>>> 1516786859681901796L;
>>>>>>>>
>>>>>>>>    /**
>>>>>>>>     * Logger for this class
>>>>>>>>     */
>>>>>>>>    private static final Log log = 
>>>>>>>> LogFactory.getLog(AddPluginAction.class
>>>>>>>> );
>>>>>>>>
>>>>>>>>    private File upload;
>>>>>>>>    private String uploadContentType;
>>>>>>>>    private String uploadFileName;
>>>>>>>>
>>>>>>>>    @Override
>>>>>>>>    protected String doExecute() throws Exception {
>>>>>>>>
>>>>>>>>        clearErrorsAndMessages();
>>>>>>>>
>>>>>>>>        Context context =
>>>>>>>>            SessionManager.getRemoteServerContext(getRequest());
>>>>>>>>
>>>>>>>>        SchedulerManager facade =
>>>>>>>>            SessionManager.getUserFacadeDelegate(getRequest(), 
>>>>>>>> context);
>>>>>>>>
>>>>>>>>        try {
>>>>>>>>
>>>>>>>>            byte[] filedata = readInputStream(new 
>>>>>>>> FileInputStream(upload));
>>>>>>>>
>>>>>>>>            facade.addPlugin(uploadFileName, filedata);
>>>>>>>>
>>>>>>>>            log.debug("Anadido plugin " + uploadFileName);
>>>>>>>>
>>>>>>>>        } catch (ConnectException e) {
>>>>>>>>            log.error(e);
>>>>>>>>            throw new InternalErrorException(e);
>>>>>>>>
>>>>>>>>        } catch (DuplicateInstanceException e) {
>>>>>>>>            log.error(e);
>>>>>>>>            addFieldError("upload",
>>>>>>>>                    getText("PluginsTable.File.Duplicate"));
>>>>>>>>
>>>>>>>>        } catch (FileNotFoundException e) {
>>>>>>>>            log.error(e);
>>>>>>>>            addFieldError("upload",
>>>>>>>>                    getText("PluginsTable.File.NotFound"));
>>>>>>>>
>>>>>>>>        } catch (Exception e) {
>>>>>>>>            log.error(e);
>>>>>>>>            addFieldError("uploadContentType",
>>>>>>>>                    
>>>>>>>> getText("ErrorMessages.file.incorrectExtension"));
>>>>>>>>        }
>>>>>>>>
>>>>>>>>        if (hasErrors()) {
>>>>>>>>            return Action.INPUT;
>>>>>>>>        }
>>>>>>>>
>>>>>>>>        return Action.SUCCESS;
>>>>>>>>    }
>>>>>>>>
>>>>>>>>
>>>>>>>>    /*
>>>>>>>>     * Read an input stream in its entirety into a byte array
>>>>>>>>     */
>>>>>>>>    private static byte[] readInputStream(InputStream inputStream)
>>>>>>>>        throws IOException {
>>>>>>>>
>>>>>>>>        ....
>>>>>>>>
>>>>>>>>        return content;
>>>>>>>>    }
>>>>>>>>
>>>>>>>>    /**
>>>>>>>>     * Getters/Setters
>>>>>>>>     * @return
>>>>>>>>     */
>>>>>>>>
>>>>>>>>    public File getUpload() {
>>>>>>>>        return upload;
>>>>>>>>    }
>>>>>>>>
>>>>>>>>
>>>>>>>>    public void setUpload(File upload) {
>>>>>>>>        this.upload = upload;
>>>>>>>>    }
>>>>>>>>
>>>>>>>>
>>>>>>>>    public String getUploadContentType() {
>>>>>>>>        return uploadContentType;
>>>>>>>>    }
>>>>>>>>
>>>>>>>>
>>>>>>>>    public void setUploadContentType(String uploadContentType) {
>>>>>>>>        this.uploadContentType = uploadContentType;
>>>>>>>>    }
>>>>>>>>
>>>>>>>>
>>>>>>>>    public String getUploadFileName() {
>>>>>>>>        return uploadFileName;
>>>>>>>>    }
>>>>>>>>
>>>>>>>>
>>>>>>>>    public void setUploadFileName(String uploadFileName) {
>>>>>>>>        this.uploadFileName = uploadFileName;
>>>>>>>>    }
>>>>>>>>
>>>>>>>> }
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> Dave Newton escribió:
>>>>>>>>
>>>>>>>>  
>>>>>>>>> --- Pablo Vázquez Blázquez <pv...@denodo.com> wrote:
>>>>>>>>>
>>>>>>>>>  
>>>>>>>>>> I send you my struts-config.xml file, but it works ok. If I 
>>>>>>>>>> delete my
>>>>>>>>>> "s:file" from my form, everything works fine.
>>>>>>>>>>
>>>>>>>>>>         
>>>>>>>>> The error happens after you submit, correct?
>>>>>>>>>
>>>>>>>>> I guess I'd want to see the JSP and the action code, then; the
>>>>>>>>>       
>>>>>>>> configuration
>>>>>>>>  
>>>>>>>>> seems okay.
>>>>>>>>>
>>>>>>>>> Have you tried it without setting the "struts.multipart.parser"
>>>>>>>>>       
>>>>>>>> constant? The
>>>>>>>>  
>>>>>>>>> default value of that is "jakarta", not a classname; it's 
>>>>>>>>> worth a shot,
>>>>>>>>> anyway.
>>>>>>>>>
>>>>>>>>> d.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>  
>>>>>>>>>> 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">
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>         
>>>>>>>>> === message truncated ===
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --------------------------------------------------------------------- 
>>>>>>>>>
>>>>>>>>> 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
>>>>>>>>
>>>>>>>>
>>>>>>>>     
>>>>>>
>>>>>>
>>>>>> --------------------------------------------------------------------- 
>>>>>>
>>>>>> 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
>>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> 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
>>>
>>
>>
>> ---------------------------------------------------------------------
>> 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
>
>
>
>


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


Re: File Upload

Posted by Pablo Vázquez Blázquez <pv...@denodo.com>.
Hello again,

If I change:
load: function(type, data, evt){
          document.getElementById("mydiv").innerHTML =
data.firstChild.innerHTML;

for:

load: function(type, data, evt){
          document.getElementById("mydiv").innerHTML = 'HELLO';

it works. But I want to show the response content. Do you know why 
"data.firstChild.innerHTML" is "undefined"??

Thanks.


Pablo Vázquez Blázquez escribió:
> Thanks for your reply.
>
> I have looked the links below and I tried what it says:
>
> The form:
>
> <form id="myform" action="nodecorate/myaction.action"
> enctype="multipart/form-data" method="post">
>      <s:file name="myfile"></s:file>
>      <input type="button" onclick="sendIt(); return false;">
> </form>
>
> The javascript:
>
> function sendIt(){
>   var bindArgs = {
>       transport: "IframeTransport",
>       formNode: document.getElementById("myform"),
>       mimetype: "text/html",
>       load: function(type, data, evt){
>           document.getElementById("mydiv").innerHTML =
> data.firstChild.innerHTML;
>       }
>   };
>   var request = dojo.io.bind(bindArgs);
> }
>
> The div with id 'mydiv' will then get updated with the response from the
> action.
>
>
>
> Well, my form looks like this:
>
>    <s:form id="addPluginForm" name="addPluginForm" theme="simple" 
>            action="AddPlugin" enctype="multipart/form-data" 
> method="post">
>               <div class="field">
>            <span class="label">
>                <fmt:message key="PluginsTable.File"/>*:
>            </span>
>            <span class="entry">
>                <s:file name="upload" size="40"
>                    accept="application/java-archive"/>
>                <span id="errorId" class="errorMessage">
>                    <s:property value="fieldErrors['upload'][0]" />
>                </span>
>                <span id="errorId" class="errorMessage">
>                    <s:property 
> value="fieldErrors['uploadContentType'][0]" />
>                </span>
>            </span>
>        </div>
>               <!-- BOTONES -->
>        <div class="button">
>            <span class="buttonLeft">
>                <s:submit type="button"                         
> onclick="sendMultiPartForm('addPluginForm', 'configAjaxContent'); 
> return false;"
>                        cssClass="submit">
>                    <s:param name="value">
>                        <fmt:message key="Buttons.accept"/>
>                    </s:param>
>                </s:submit>
>            </span>
>            <span class="buttonRight">
>                <!-- cancelar -->
>                <s:url id="CancelUrl" action="CancelConfiguration"/>
>                <s:submit type="button" theme="ajax" 
> targets="configAjaxContent"                        
> showLoadingText="false" cssClass="reset" href="${CancelUrl}">
>                    <s:param name="value">
>                        <fmt:message key="Buttons.cancel"/>
>                    </s:param>
>                </s:submit>
>            </span>
>        </div>
>           </s:form>
>
> and my Javascript:
>
> function sendMultiPartForm(formId, targetId) {
>       dojo.require("dojo.io.IframeIO");
>    var bindArgs = {
>       transport: "IframeTransport",
>       formNode: document.getElementById(formId),
>       mimetype: "text/html",
>       load: function(type, data, evt) {
>           document.getElementById(targetId).innerHTML =
>                data.firstChild.innerHTML;
>       }
>    };
>      var request = dojo.io.bind(bindArgs);
> }
>
> Unfortunately, it is happening the same than before: the file is 
> uploaded but my target div is not being updated with the action's 
> response content. And, as before, if I want to upload another file, I 
> must go first to another action and then, return to this one; if not, 
> it doesn't work...
>
>
> Am I missing sth? Doing sth wrong?
>
>
>
>
>
>
> Jeromy Evans escribió:
>> hmm...that's interesting.
>>
>> My approach would be to create a new blank struts application that 
>> just contains a file upload action. Get it to work without ajax as 
>> there still seems to be a configuration problem.
>>
>> Then, when you're satisfied the configuration is correct... 
>> unfortunately you can't use s:form theme=ajax to perform a multi-part 
>> upload in Struts2.0.  To perform an asynchronous upload, you'll have 
>> to use Dojo's IFrameIO feature directly.  I haven't used it myself, 
>> but it's described in the following two posts:
>>
>> http://www.mail-archive.com/user@struts.apache.org/msg60245.html
>> http://www.nabble.com/Image-Upload-and-Dojo-td14350527.html
>>
>> I hope that helps!
>>
>> Pablo Vázquez Blázquez wrote:
>>> Error de lectura XML: contenido incorrecto tras un elemento XML del 
>>> documento
>>> Ubicación: http://localhost:8080/scheduler-admintool-1.0/AddPlugin.do
>>> Número de línea 8, columna 1:<form id="addPluginForm" 
>>> name="addPluginForm" onsubmit="return true;" 
>>> action="/scheduler-admintool-1.0/AddPlugin.do" method="post" 
>>> enctype="multipart/form-data">
>>> ^
>>>
>>> That´s the result if I try without the ajax theme on the form.
>>>
>>> Yes, I would like to use the ajax theme.
>>>
>>> Thanks.
>>>
>>> Jeromy Evans escribió:
>>>> Are you deliberately trying to do an XHR file upload? Have you 
>>>> tried it without the ajax theme on the form?
>>>>
>>>> Pablo Vázquez Blázquez wrote:
>>>>> Yes yes, that debugging statement is executed. That´s why I know 
>>>>> my plugin is created.
>>>>>
>>>>> "Anadido plugin " + uploadFileName means "Added plugin " + 
>>>>> uploadFileName.
>>>>>
>>>>> And then, it goes to ShowPlugins and the debugging statement
>>>>> log.debug("Obtenidos plugins"); (Getted all plugins) is also 
>>>>> executed.
>>>>>
>>>>>
>>>>>
>>>>> Cheng Wei Lee escribió:
>>>>>> Was this debugging statement executed?
>>>>>>
>>>>>>            log.debug("Anadido plugin " + uploadFileName);
>>>>>>
>>>>>>
>>>>>> On Jan 18, 2008 12:13 AM, Pablo Vázquez Blázquez 
>>>>>> <pv...@denodo.com>
>>>>>> wrote:
>>>>>>
>>>>>>  
>>>>>>> Here I send you my JSP and Action code.
>>>>>>>
>>>>>>> Yes, when I submit, the new plugin is added (I know it because 
>>>>>>> of my
>>>>>>> logs), but I don´t know why I don´t get the result page.
>>>>>>>
>>>>>>> Thank you.
>>>>>>>
>>>>>>> PD: I have now tried without struts.multipart.parser, but it 
>>>>>>> doesn´t work.
>>>>>>>
>>>>>>> ****** JSP ******
>>>>>>>
>>>>>>> <jsp:root xmlns="http://www.w3.org/1999/xhtml"
>>>>>>>    xmlns:jsp="http://java.sun.com/JSP/Page"
>>>>>>>    xmlns:fmt="http://java.sun.com/jsp/jstl/fmt"
>>>>>>>    xmlns:c="http://java.sun.com/jsp/jstl/core"
>>>>>>>    xmlns:s="/struts-tags"
>>>>>>>    version="2.0">
>>>>>>>
>>>>>>>    <!-- Tabla con los plugins. Si no hay ninguno, se muestra un 
>>>>>>> mensaje
>>>>>>> -->
>>>>>>>    <table class="pluginsTable" cellspacing="0px" cellpadding="3px"
>>>>>>> border="1px">
>>>>>>>        <tbody>
>>>>>>>            <tr>
>>>>>>>                <td class="tableTitle" colspan="5">
>>>>>>>                    <fmt:message key="PluginsTable.Title"/>
>>>>>>>                </td>
>>>>>>>            </tr>
>>>>>>>            <tr>
>>>>>>>                <td class="tableHeader">
>>>>>>>                    <fmt:message key="PluginsTable.Name"/>
>>>>>>>                </td>
>>>>>>>                <td class="tableHeader">
>>>>>>>                    <fmt:message key="PluginsTable.JarFile"/>
>>>>>>>                </td>
>>>>>>>                <td class="tableHeader">
>>>>>>>                    <fmt:message key="PluginsTable.PluginClass"/>
>>>>>>>                </td>
>>>>>>>                <td class="tableHeader">
>>>>>>>                    <fmt:message key="PluginsTable.Type"/>
>>>>>>>                </td>
>>>>>>>                <td class="tableHeader">
>>>>>>>                    <fmt:message key="PluginsTable.Actions"/>
>>>>>>>                </td>
>>>>>>>            </tr>
>>>>>>>            <c:if test="${empty plugins}">
>>>>>>>                <tr>
>>>>>>>                    <td class="tableMessage" colspan="5">
>>>>>>>                        <fmt:message key="PluginsTable.NoPlugins"/>
>>>>>>>                    </td>
>>>>>>>                </tr>
>>>>>>>            </c:if>
>>>>>>>            <c:forEach items="${plugins}" var="plugin" 
>>>>>>> varStatus="status">
>>>>>>>                <!-- stuff -->
>>>>>>>            </c:forEach>
>>>>>>>        </tbody>
>>>>>>>    </table>
>>>>>>>
>>>>>>>
>>>>>>>    <!-- Form to add plugin -->
>>>>>>>    <s:form id="addPluginForm" name="addPluginForm" theme="ajax"
>>>>>>>            action="AddPlugin" enctype="multipart/form-data" 
>>>>>>> method="post">
>>>>>>>
>>>>>>>        <div class="field">
>>>>>>>            <span class="label">
>>>>>>>                <fmt:message key="PluginsTable.File"/>*:
>>>>>>>            </span>
>>>>>>>            <span class="entry">
>>>>>>>                <s:file name="upload" size="40"
>>>>>>>                    accept="application/java-archive"/>
>>>>>>>                <span id="errorId" class="errorMessage">
>>>>>>>                    <s:property value="fieldErrors['upload'][0]" />
>>>>>>>                </span>
>>>>>>>                <span id="errorId" class="errorMessage">
>>>>>>>                    <s:property 
>>>>>>> value="fieldErrors['uploadContentType'][0]"
>>>>>>> />
>>>>>>>                </span>
>>>>>>>            </span>
>>>>>>>        </div>
>>>>>>>
>>>>>>>        <!-- BOTONES -->
>>>>>>>        <jsp:directive.include file="FormButtons.jspf"/>
>>>>>>>
>>>>>>>    </s:form>
>>>>>>>
>>>>>>> </jsp:root>
>>>>>>>
>>>>>>>
>>>>>>> ****** FORMBUTTONS.JSPF****
>>>>>>>
>>>>>>> <!-- BUTTONS-->
>>>>>>> <div class="button">
>>>>>>>    <span class="buttonLeft">
>>>>>>>        <s:submit type="button"
>>>>>>>                targets="configAjaxContent" executeScripts="true"
>>>>>>>                showLoadingText="false" indicator="indicator"
>>>>>>> cssClass="submit">
>>>>>>>            <s:param name="value">
>>>>>>>                <fmt:message key="Buttons.accept"/>
>>>>>>>            </s:param>
>>>>>>>        </s:submit>
>>>>>>>    </span>
>>>>>>>    <span class="buttonRight">
>>>>>>>        <!-- cancelar -->
>>>>>>>        <s:url id="CancelUrl" action="CancelConfiguration"/>
>>>>>>>        <s:submit type="button" targets="configAjaxContent"
>>>>>>>                showLoadingText="false" cssClass="reset"
>>>>>>> href="${CancelUrl}">
>>>>>>>            <s:param name="value">
>>>>>>>                <fmt:message key="Buttons.cancel"/>
>>>>>>>            </s:param>
>>>>>>>        </s:submit>
>>>>>>>    </span>
>>>>>>> </div>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> *****ACTION *****
>>>>>>> public class AddPluginAction extends DefaultRequestResponseAction {
>>>>>>>
>>>>>>>    private static final long serialVersionUID = 
>>>>>>> 1516786859681901796L;
>>>>>>>
>>>>>>>    /**
>>>>>>>     * Logger for this class
>>>>>>>     */
>>>>>>>    private static final Log log = 
>>>>>>> LogFactory.getLog(AddPluginAction.class
>>>>>>> );
>>>>>>>
>>>>>>>    private File upload;
>>>>>>>    private String uploadContentType;
>>>>>>>    private String uploadFileName;
>>>>>>>
>>>>>>>    @Override
>>>>>>>    protected String doExecute() throws Exception {
>>>>>>>
>>>>>>>        clearErrorsAndMessages();
>>>>>>>
>>>>>>>        Context context =
>>>>>>>            SessionManager.getRemoteServerContext(getRequest());
>>>>>>>
>>>>>>>        SchedulerManager facade =
>>>>>>>            SessionManager.getUserFacadeDelegate(getRequest(), 
>>>>>>> context);
>>>>>>>
>>>>>>>        try {
>>>>>>>
>>>>>>>            byte[] filedata = readInputStream(new 
>>>>>>> FileInputStream(upload));
>>>>>>>
>>>>>>>            facade.addPlugin(uploadFileName, filedata);
>>>>>>>
>>>>>>>            log.debug("Anadido plugin " + uploadFileName);
>>>>>>>
>>>>>>>        } catch (ConnectException e) {
>>>>>>>            log.error(e);
>>>>>>>            throw new InternalErrorException(e);
>>>>>>>
>>>>>>>        } catch (DuplicateInstanceException e) {
>>>>>>>            log.error(e);
>>>>>>>            addFieldError("upload",
>>>>>>>                    getText("PluginsTable.File.Duplicate"));
>>>>>>>
>>>>>>>        } catch (FileNotFoundException e) {
>>>>>>>            log.error(e);
>>>>>>>            addFieldError("upload",
>>>>>>>                    getText("PluginsTable.File.NotFound"));
>>>>>>>
>>>>>>>        } catch (Exception e) {
>>>>>>>            log.error(e);
>>>>>>>            addFieldError("uploadContentType",
>>>>>>>                    
>>>>>>> getText("ErrorMessages.file.incorrectExtension"));
>>>>>>>        }
>>>>>>>
>>>>>>>        if (hasErrors()) {
>>>>>>>            return Action.INPUT;
>>>>>>>        }
>>>>>>>
>>>>>>>        return Action.SUCCESS;
>>>>>>>    }
>>>>>>>
>>>>>>>
>>>>>>>    /*
>>>>>>>     * Read an input stream in its entirety into a byte array
>>>>>>>     */
>>>>>>>    private static byte[] readInputStream(InputStream inputStream)
>>>>>>>        throws IOException {
>>>>>>>
>>>>>>>        ....
>>>>>>>
>>>>>>>        return content;
>>>>>>>    }
>>>>>>>
>>>>>>>    /**
>>>>>>>     * Getters/Setters
>>>>>>>     * @return
>>>>>>>     */
>>>>>>>
>>>>>>>    public File getUpload() {
>>>>>>>        return upload;
>>>>>>>    }
>>>>>>>
>>>>>>>
>>>>>>>    public void setUpload(File upload) {
>>>>>>>        this.upload = upload;
>>>>>>>    }
>>>>>>>
>>>>>>>
>>>>>>>    public String getUploadContentType() {
>>>>>>>        return uploadContentType;
>>>>>>>    }
>>>>>>>
>>>>>>>
>>>>>>>    public void setUploadContentType(String uploadContentType) {
>>>>>>>        this.uploadContentType = uploadContentType;
>>>>>>>    }
>>>>>>>
>>>>>>>
>>>>>>>    public String getUploadFileName() {
>>>>>>>        return uploadFileName;
>>>>>>>    }
>>>>>>>
>>>>>>>
>>>>>>>    public void setUploadFileName(String uploadFileName) {
>>>>>>>        this.uploadFileName = uploadFileName;
>>>>>>>    }
>>>>>>>
>>>>>>> }
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Dave Newton escribió:
>>>>>>>
>>>>>>>  
>>>>>>>> --- Pablo Vázquez Blázquez <pv...@denodo.com> wrote:
>>>>>>>>
>>>>>>>>  
>>>>>>>>> I send you my struts-config.xml file, but it works ok. If I 
>>>>>>>>> delete my
>>>>>>>>> "s:file" from my form, everything works fine.
>>>>>>>>>
>>>>>>>>>         
>>>>>>>> The error happens after you submit, correct?
>>>>>>>>
>>>>>>>> I guess I'd want to see the JSP and the action code, then; the
>>>>>>>>       
>>>>>>> configuration
>>>>>>>  
>>>>>>>> seems okay.
>>>>>>>>
>>>>>>>> Have you tried it without setting the "struts.multipart.parser"
>>>>>>>>       
>>>>>>> constant? The
>>>>>>>  
>>>>>>>> default value of that is "jakarta", not a classname; it's worth 
>>>>>>>> a shot,
>>>>>>>> anyway.
>>>>>>>>
>>>>>>>> d.
>>>>>>>>
>>>>>>>>
>>>>>>>>  
>>>>>>>>> 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">
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>         
>>>>>>>> === message truncated ===
>>>>>>>>
>>>>>>>>
>>>>>>>> --------------------------------------------------------------------- 
>>>>>>>>
>>>>>>>> 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
>>>>>>>
>>>>>>>
>>>>>>>     
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> 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
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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
>>
>
>
> ---------------------------------------------------------------------
> 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


Re: File Upload

Posted by Pablo Vázquez Blázquez <pv...@denodo.com>.
Thanks for your reply.

I have looked the links below and I tried what it says:

The form:

<form id="myform" action="nodecorate/myaction.action"
enctype="multipart/form-data" method="post">
      <s:file name="myfile"></s:file>
      <input type="button" onclick="sendIt(); return false;">
</form>

The javascript:

function sendIt(){
   var bindArgs = {
       transport: "IframeTransport",
       formNode: document.getElementById("myform"),
       mimetype: "text/html",
       load: function(type, data, evt){
           document.getElementById("mydiv").innerHTML =
data.firstChild.innerHTML;
       }
   };
   var request = dojo.io.bind(bindArgs);
}

The div with id 'mydiv' will then get updated with the response from the
action.



Well, my form looks like this:

    <s:form id="addPluginForm" name="addPluginForm" theme="simple" 
            action="AddPlugin" enctype="multipart/form-data" method="post">
        
        <div class="field">
            <span class="label">
                <fmt:message key="PluginsTable.File"/>*:
            </span>
            <span class="entry">
                <s:file name="upload" size="40"
                    accept="application/java-archive"/>
                <span id="errorId" class="errorMessage">
                    <s:property value="fieldErrors['upload'][0]" />
                </span>
                <span id="errorId" class="errorMessage">
                    <s:property value="fieldErrors['uploadContentType'][0]" />
                </span>
            </span>
        </div>
        
        <!-- BOTONES -->
        <div class="button">
            <span class="buttonLeft">
                <s:submit type="button"  
                        onclick="sendMultiPartForm('addPluginForm', 'configAjaxContent'); return false;"
                        cssClass="submit">
                    <s:param name="value">
                        <fmt:message key="Buttons.accept"/>
                    </s:param>
                </s:submit>
            </span>
            <span class="buttonRight">
                <!-- cancelar -->
                <s:url id="CancelUrl" action="CancelConfiguration"/>
                <s:submit type="button" theme="ajax" targets="configAjaxContent" 
                        showLoadingText="false" cssClass="reset" href="${CancelUrl}">
                    <s:param name="value">
                        <fmt:message key="Buttons.cancel"/>
                    </s:param>
                </s:submit>
            </span>
        </div>
        
    </s:form>

and my Javascript:

function sendMultiPartForm(formId, targetId) {
    
    dojo.require("dojo.io.IframeIO");
    var bindArgs = {
       transport: "IframeTransport",
       formNode: document.getElementById(formId),
       mimetype: "text/html",
       load: function(type, data, evt) {
           document.getElementById(targetId).innerHTML =
                data.firstChild.innerHTML;
       }
    };
   
    var request = dojo.io.bind(bindArgs);
}

Unfortunately, it is happening the same than before: the file is uploaded but my target div is not being updated with the action's response content. 
And, as before, if I want to upload another file, I must go first to another action and then, return to this one; if not, it doesn't work...


Am I missing sth? Doing sth wrong?






Jeromy Evans escribió:
> hmm...that's interesting.
>
> My approach would be to create a new blank struts application that 
> just contains a file upload action. Get it to work without ajax as 
> there still seems to be a configuration problem.
>
> Then, when you're satisfied the configuration is correct... 
> unfortunately you can't use s:form theme=ajax to perform a multi-part 
> upload in Struts2.0.  To perform an asynchronous upload, you'll have 
> to use Dojo's IFrameIO feature directly.  I haven't used it myself, 
> but it's described in the following two posts:
>
> http://www.mail-archive.com/user@struts.apache.org/msg60245.html
> http://www.nabble.com/Image-Upload-and-Dojo-td14350527.html
>
> I hope that helps!
>
> Pablo Vázquez Blázquez wrote:
>> Error de lectura XML: contenido incorrecto tras un elemento XML del 
>> documento
>> Ubicación: http://localhost:8080/scheduler-admintool-1.0/AddPlugin.do
>> Número de línea 8, columna 1:<form id="addPluginForm" 
>> name="addPluginForm" onsubmit="return true;" 
>> action="/scheduler-admintool-1.0/AddPlugin.do" method="post" 
>> enctype="multipart/form-data">
>> ^
>>
>> That´s the result if I try without the ajax theme on the form.
>>
>> Yes, I would like to use the ajax theme.
>>
>> Thanks.
>>
>> Jeromy Evans escribió:
>>> Are you deliberately trying to do an XHR file upload? Have you tried 
>>> it without the ajax theme on the form?
>>>
>>> Pablo Vázquez Blázquez wrote:
>>>> Yes yes, that debugging statement is executed. That´s why I know my 
>>>> plugin is created.
>>>>
>>>> "Anadido plugin " + uploadFileName means "Added plugin " + 
>>>> uploadFileName.
>>>>
>>>> And then, it goes to ShowPlugins and the debugging statement
>>>> log.debug("Obtenidos plugins"); (Getted all plugins) is also executed.
>>>>
>>>>
>>>>
>>>> Cheng Wei Lee escribió:
>>>>> Was this debugging statement executed?
>>>>>
>>>>>            log.debug("Anadido plugin " + uploadFileName);
>>>>>
>>>>>
>>>>> On Jan 18, 2008 12:13 AM, Pablo Vázquez Blázquez 
>>>>> <pv...@denodo.com>
>>>>> wrote:
>>>>>
>>>>>  
>>>>>> Here I send you my JSP and Action code.
>>>>>>
>>>>>> Yes, when I submit, the new plugin is added (I know it because of my
>>>>>> logs), but I don´t know why I don´t get the result page.
>>>>>>
>>>>>> Thank you.
>>>>>>
>>>>>> PD: I have now tried without struts.multipart.parser, but it 
>>>>>> doesn´t work.
>>>>>>
>>>>>> ****** JSP ******
>>>>>>
>>>>>> <jsp:root xmlns="http://www.w3.org/1999/xhtml"
>>>>>>    xmlns:jsp="http://java.sun.com/JSP/Page"
>>>>>>    xmlns:fmt="http://java.sun.com/jsp/jstl/fmt"
>>>>>>    xmlns:c="http://java.sun.com/jsp/jstl/core"
>>>>>>    xmlns:s="/struts-tags"
>>>>>>    version="2.0">
>>>>>>
>>>>>>    <!-- Tabla con los plugins. Si no hay ninguno, se muestra un 
>>>>>> mensaje
>>>>>> -->
>>>>>>    <table class="pluginsTable" cellspacing="0px" cellpadding="3px"
>>>>>> border="1px">
>>>>>>        <tbody>
>>>>>>            <tr>
>>>>>>                <td class="tableTitle" colspan="5">
>>>>>>                    <fmt:message key="PluginsTable.Title"/>
>>>>>>                </td>
>>>>>>            </tr>
>>>>>>            <tr>
>>>>>>                <td class="tableHeader">
>>>>>>                    <fmt:message key="PluginsTable.Name"/>
>>>>>>                </td>
>>>>>>                <td class="tableHeader">
>>>>>>                    <fmt:message key="PluginsTable.JarFile"/>
>>>>>>                </td>
>>>>>>                <td class="tableHeader">
>>>>>>                    <fmt:message key="PluginsTable.PluginClass"/>
>>>>>>                </td>
>>>>>>                <td class="tableHeader">
>>>>>>                    <fmt:message key="PluginsTable.Type"/>
>>>>>>                </td>
>>>>>>                <td class="tableHeader">
>>>>>>                    <fmt:message key="PluginsTable.Actions"/>
>>>>>>                </td>
>>>>>>            </tr>
>>>>>>            <c:if test="${empty plugins}">
>>>>>>                <tr>
>>>>>>                    <td class="tableMessage" colspan="5">
>>>>>>                        <fmt:message key="PluginsTable.NoPlugins"/>
>>>>>>                    </td>
>>>>>>                </tr>
>>>>>>            </c:if>
>>>>>>            <c:forEach items="${plugins}" var="plugin" 
>>>>>> varStatus="status">
>>>>>>                <!-- stuff -->
>>>>>>            </c:forEach>
>>>>>>        </tbody>
>>>>>>    </table>
>>>>>>
>>>>>>
>>>>>>    <!-- Form to add plugin -->
>>>>>>    <s:form id="addPluginForm" name="addPluginForm" theme="ajax"
>>>>>>            action="AddPlugin" enctype="multipart/form-data" 
>>>>>> method="post">
>>>>>>
>>>>>>        <div class="field">
>>>>>>            <span class="label">
>>>>>>                <fmt:message key="PluginsTable.File"/>*:
>>>>>>            </span>
>>>>>>            <span class="entry">
>>>>>>                <s:file name="upload" size="40"
>>>>>>                    accept="application/java-archive"/>
>>>>>>                <span id="errorId" class="errorMessage">
>>>>>>                    <s:property value="fieldErrors['upload'][0]" />
>>>>>>                </span>
>>>>>>                <span id="errorId" class="errorMessage">
>>>>>>                    <s:property 
>>>>>> value="fieldErrors['uploadContentType'][0]"
>>>>>> />
>>>>>>                </span>
>>>>>>            </span>
>>>>>>        </div>
>>>>>>
>>>>>>        <!-- BOTONES -->
>>>>>>        <jsp:directive.include file="FormButtons.jspf"/>
>>>>>>
>>>>>>    </s:form>
>>>>>>
>>>>>> </jsp:root>
>>>>>>
>>>>>>
>>>>>> ****** FORMBUTTONS.JSPF****
>>>>>>
>>>>>> <!-- BUTTONS-->
>>>>>> <div class="button">
>>>>>>    <span class="buttonLeft">
>>>>>>        <s:submit type="button"
>>>>>>                targets="configAjaxContent" executeScripts="true"
>>>>>>                showLoadingText="false" indicator="indicator"
>>>>>> cssClass="submit">
>>>>>>            <s:param name="value">
>>>>>>                <fmt:message key="Buttons.accept"/>
>>>>>>            </s:param>
>>>>>>        </s:submit>
>>>>>>    </span>
>>>>>>    <span class="buttonRight">
>>>>>>        <!-- cancelar -->
>>>>>>        <s:url id="CancelUrl" action="CancelConfiguration"/>
>>>>>>        <s:submit type="button" targets="configAjaxContent"
>>>>>>                showLoadingText="false" cssClass="reset"
>>>>>> href="${CancelUrl}">
>>>>>>            <s:param name="value">
>>>>>>                <fmt:message key="Buttons.cancel"/>
>>>>>>            </s:param>
>>>>>>        </s:submit>
>>>>>>    </span>
>>>>>> </div>
>>>>>>
>>>>>>
>>>>>>
>>>>>> *****ACTION *****
>>>>>> public class AddPluginAction extends DefaultRequestResponseAction {
>>>>>>
>>>>>>    private static final long serialVersionUID = 
>>>>>> 1516786859681901796L;
>>>>>>
>>>>>>    /**
>>>>>>     * Logger for this class
>>>>>>     */
>>>>>>    private static final Log log = 
>>>>>> LogFactory.getLog(AddPluginAction.class
>>>>>> );
>>>>>>
>>>>>>    private File upload;
>>>>>>    private String uploadContentType;
>>>>>>    private String uploadFileName;
>>>>>>
>>>>>>    @Override
>>>>>>    protected String doExecute() throws Exception {
>>>>>>
>>>>>>        clearErrorsAndMessages();
>>>>>>
>>>>>>        Context context =
>>>>>>            SessionManager.getRemoteServerContext(getRequest());
>>>>>>
>>>>>>        SchedulerManager facade =
>>>>>>            SessionManager.getUserFacadeDelegate(getRequest(), 
>>>>>> context);
>>>>>>
>>>>>>        try {
>>>>>>
>>>>>>            byte[] filedata = readInputStream(new 
>>>>>> FileInputStream(upload));
>>>>>>
>>>>>>            facade.addPlugin(uploadFileName, filedata);
>>>>>>
>>>>>>            log.debug("Anadido plugin " + uploadFileName);
>>>>>>
>>>>>>        } catch (ConnectException e) {
>>>>>>            log.error(e);
>>>>>>            throw new InternalErrorException(e);
>>>>>>
>>>>>>        } catch (DuplicateInstanceException e) {
>>>>>>            log.error(e);
>>>>>>            addFieldError("upload",
>>>>>>                    getText("PluginsTable.File.Duplicate"));
>>>>>>
>>>>>>        } catch (FileNotFoundException e) {
>>>>>>            log.error(e);
>>>>>>            addFieldError("upload",
>>>>>>                    getText("PluginsTable.File.NotFound"));
>>>>>>
>>>>>>        } catch (Exception e) {
>>>>>>            log.error(e);
>>>>>>            addFieldError("uploadContentType",
>>>>>>                    
>>>>>> getText("ErrorMessages.file.incorrectExtension"));
>>>>>>        }
>>>>>>
>>>>>>        if (hasErrors()) {
>>>>>>            return Action.INPUT;
>>>>>>        }
>>>>>>
>>>>>>        return Action.SUCCESS;
>>>>>>    }
>>>>>>
>>>>>>
>>>>>>    /*
>>>>>>     * Read an input stream in its entirety into a byte array
>>>>>>     */
>>>>>>    private static byte[] readInputStream(InputStream inputStream)
>>>>>>        throws IOException {
>>>>>>
>>>>>>        ....
>>>>>>
>>>>>>        return content;
>>>>>>    }
>>>>>>
>>>>>>    /**
>>>>>>     * Getters/Setters
>>>>>>     * @return
>>>>>>     */
>>>>>>
>>>>>>    public File getUpload() {
>>>>>>        return upload;
>>>>>>    }
>>>>>>
>>>>>>
>>>>>>    public void setUpload(File upload) {
>>>>>>        this.upload = upload;
>>>>>>    }
>>>>>>
>>>>>>
>>>>>>    public String getUploadContentType() {
>>>>>>        return uploadContentType;
>>>>>>    }
>>>>>>
>>>>>>
>>>>>>    public void setUploadContentType(String uploadContentType) {
>>>>>>        this.uploadContentType = uploadContentType;
>>>>>>    }
>>>>>>
>>>>>>
>>>>>>    public String getUploadFileName() {
>>>>>>        return uploadFileName;
>>>>>>    }
>>>>>>
>>>>>>
>>>>>>    public void setUploadFileName(String uploadFileName) {
>>>>>>        this.uploadFileName = uploadFileName;
>>>>>>    }
>>>>>>
>>>>>> }
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> Dave Newton escribió:
>>>>>>
>>>>>>  
>>>>>>> --- Pablo Vázquez Blázquez <pv...@denodo.com> wrote:
>>>>>>>
>>>>>>>   
>>>>>>>> I send you my struts-config.xml file, but it works ok. If I 
>>>>>>>> delete my
>>>>>>>> "s:file" from my form, everything works fine.
>>>>>>>>
>>>>>>>>         
>>>>>>> The error happens after you submit, correct?
>>>>>>>
>>>>>>> I guess I'd want to see the JSP and the action code, then; the
>>>>>>>       
>>>>>> configuration
>>>>>>  
>>>>>>> seems okay.
>>>>>>>
>>>>>>> Have you tried it without setting the "struts.multipart.parser"
>>>>>>>       
>>>>>> constant? The
>>>>>>  
>>>>>>> default value of that is "jakarta", not a classname; it's worth 
>>>>>>> a shot,
>>>>>>> anyway.
>>>>>>>
>>>>>>> d.
>>>>>>>
>>>>>>>
>>>>>>>   
>>>>>>>> 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">
>>>>>>>>
>>>>>>>>
>>>>>>>>         
>>>>>>> === message truncated ===
>>>>>>>
>>>>>>>
>>>>>>> --------------------------------------------------------------------- 
>>>>>>>
>>>>>>> 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
>>>>>>
>>>>>>
>>>>>>     
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> 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
>>>
>>
>>
>> ---------------------------------------------------------------------
>> 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
>


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


Re: File Upload

Posted by Jeromy Evans <je...@blueskyminds.com.au>.
hmm...that's interesting.

My approach would be to create a new blank struts application that just 
contains a file upload action. Get it to work without ajax as there 
still seems to be a configuration problem.

Then, when you're satisfied the configuration is correct... 
unfortunately you can't use s:form theme=ajax to perform a multi-part 
upload in Struts2.0.  To perform an asynchronous upload, you'll have to 
use Dojo's IFrameIO feature directly.  I haven't used it myself, but 
it's described in the following two posts:

http://www.mail-archive.com/user@struts.apache.org/msg60245.html
http://www.nabble.com/Image-Upload-and-Dojo-td14350527.html

I hope that helps!

Pablo Vázquez Blázquez wrote:
> Error de lectura XML: contenido incorrecto tras un elemento XML del 
> documento
> Ubicación: http://localhost:8080/scheduler-admintool-1.0/AddPlugin.do
> Número de línea 8, columna 1:<form id="addPluginForm" 
> name="addPluginForm" onsubmit="return true;" 
> action="/scheduler-admintool-1.0/AddPlugin.do" method="post" 
> enctype="multipart/form-data">
> ^
>
> That´s the result if I try without the ajax theme on the form.
>
> Yes, I would like to use the ajax theme.
>
> Thanks.
>
> Jeromy Evans escribió:
>> Are you deliberately trying to do an XHR file upload? Have you tried 
>> it without the ajax theme on the form?
>>
>> Pablo Vázquez Blázquez wrote:
>>> Yes yes, that debugging statement is executed. That´s why I know my 
>>> plugin is created.
>>>
>>> "Anadido plugin " + uploadFileName means "Added plugin " + 
>>> uploadFileName.
>>>
>>> And then, it goes to ShowPlugins and the debugging statement
>>> log.debug("Obtenidos plugins"); (Getted all plugins) is also executed.
>>>
>>>
>>>
>>> Cheng Wei Lee escribió:
>>>> Was this debugging statement executed?
>>>>
>>>>            log.debug("Anadido plugin " + uploadFileName);
>>>>
>>>>
>>>> On Jan 18, 2008 12:13 AM, Pablo Vázquez Blázquez <pv...@denodo.com>
>>>> wrote:
>>>>
>>>>  
>>>>> Here I send you my JSP and Action code.
>>>>>
>>>>> Yes, when I submit, the new plugin is added (I know it because of my
>>>>> logs), but I don´t know why I don´t get the result page.
>>>>>
>>>>> Thank you.
>>>>>
>>>>> PD: I have now tried without struts.multipart.parser, but it 
>>>>> doesn´t work.
>>>>>
>>>>> ****** JSP ******
>>>>>
>>>>> <jsp:root xmlns="http://www.w3.org/1999/xhtml"
>>>>>    xmlns:jsp="http://java.sun.com/JSP/Page"
>>>>>    xmlns:fmt="http://java.sun.com/jsp/jstl/fmt"
>>>>>    xmlns:c="http://java.sun.com/jsp/jstl/core"
>>>>>    xmlns:s="/struts-tags"
>>>>>    version="2.0">
>>>>>
>>>>>    <!-- Tabla con los plugins. Si no hay ninguno, se muestra un 
>>>>> mensaje
>>>>> -->
>>>>>    <table class="pluginsTable" cellspacing="0px" cellpadding="3px"
>>>>> border="1px">
>>>>>        <tbody>
>>>>>            <tr>
>>>>>                <td class="tableTitle" colspan="5">
>>>>>                    <fmt:message key="PluginsTable.Title"/>
>>>>>                </td>
>>>>>            </tr>
>>>>>            <tr>
>>>>>                <td class="tableHeader">
>>>>>                    <fmt:message key="PluginsTable.Name"/>
>>>>>                </td>
>>>>>                <td class="tableHeader">
>>>>>                    <fmt:message key="PluginsTable.JarFile"/>
>>>>>                </td>
>>>>>                <td class="tableHeader">
>>>>>                    <fmt:message key="PluginsTable.PluginClass"/>
>>>>>                </td>
>>>>>                <td class="tableHeader">
>>>>>                    <fmt:message key="PluginsTable.Type"/>
>>>>>                </td>
>>>>>                <td class="tableHeader">
>>>>>                    <fmt:message key="PluginsTable.Actions"/>
>>>>>                </td>
>>>>>            </tr>
>>>>>            <c:if test="${empty plugins}">
>>>>>                <tr>
>>>>>                    <td class="tableMessage" colspan="5">
>>>>>                        <fmt:message key="PluginsTable.NoPlugins"/>
>>>>>                    </td>
>>>>>                </tr>
>>>>>            </c:if>
>>>>>            <c:forEach items="${plugins}" var="plugin" 
>>>>> varStatus="status">
>>>>>                <!-- stuff -->
>>>>>            </c:forEach>
>>>>>        </tbody>
>>>>>    </table>
>>>>>
>>>>>
>>>>>    <!-- Form to add plugin -->
>>>>>    <s:form id="addPluginForm" name="addPluginForm" theme="ajax"
>>>>>            action="AddPlugin" enctype="multipart/form-data" 
>>>>> method="post">
>>>>>
>>>>>        <div class="field">
>>>>>            <span class="label">
>>>>>                <fmt:message key="PluginsTable.File"/>*:
>>>>>            </span>
>>>>>            <span class="entry">
>>>>>                <s:file name="upload" size="40"
>>>>>                    accept="application/java-archive"/>
>>>>>                <span id="errorId" class="errorMessage">
>>>>>                    <s:property value="fieldErrors['upload'][0]" />
>>>>>                </span>
>>>>>                <span id="errorId" class="errorMessage">
>>>>>                    <s:property 
>>>>> value="fieldErrors['uploadContentType'][0]"
>>>>> />
>>>>>                </span>
>>>>>            </span>
>>>>>        </div>
>>>>>
>>>>>        <!-- BOTONES -->
>>>>>        <jsp:directive.include file="FormButtons.jspf"/>
>>>>>
>>>>>    </s:form>
>>>>>
>>>>> </jsp:root>
>>>>>
>>>>>
>>>>> ****** FORMBUTTONS.JSPF****
>>>>>
>>>>> <!-- BUTTONS-->
>>>>> <div class="button">
>>>>>    <span class="buttonLeft">
>>>>>        <s:submit type="button"
>>>>>                targets="configAjaxContent" executeScripts="true"
>>>>>                showLoadingText="false" indicator="indicator"
>>>>> cssClass="submit">
>>>>>            <s:param name="value">
>>>>>                <fmt:message key="Buttons.accept"/>
>>>>>            </s:param>
>>>>>        </s:submit>
>>>>>    </span>
>>>>>    <span class="buttonRight">
>>>>>        <!-- cancelar -->
>>>>>        <s:url id="CancelUrl" action="CancelConfiguration"/>
>>>>>        <s:submit type="button" targets="configAjaxContent"
>>>>>                showLoadingText="false" cssClass="reset"
>>>>> href="${CancelUrl}">
>>>>>            <s:param name="value">
>>>>>                <fmt:message key="Buttons.cancel"/>
>>>>>            </s:param>
>>>>>        </s:submit>
>>>>>    </span>
>>>>> </div>
>>>>>
>>>>>
>>>>>
>>>>> *****ACTION *****
>>>>> public class AddPluginAction extends DefaultRequestResponseAction {
>>>>>
>>>>>    private static final long serialVersionUID = 1516786859681901796L;
>>>>>
>>>>>    /**
>>>>>     * Logger for this class
>>>>>     */
>>>>>    private static final Log log = 
>>>>> LogFactory.getLog(AddPluginAction.class
>>>>> );
>>>>>
>>>>>    private File upload;
>>>>>    private String uploadContentType;
>>>>>    private String uploadFileName;
>>>>>
>>>>>    @Override
>>>>>    protected String doExecute() throws Exception {
>>>>>
>>>>>        clearErrorsAndMessages();
>>>>>
>>>>>        Context context =
>>>>>            SessionManager.getRemoteServerContext(getRequest());
>>>>>
>>>>>        SchedulerManager facade =
>>>>>            SessionManager.getUserFacadeDelegate(getRequest(), 
>>>>> context);
>>>>>
>>>>>        try {
>>>>>
>>>>>            byte[] filedata = readInputStream(new 
>>>>> FileInputStream(upload));
>>>>>
>>>>>            facade.addPlugin(uploadFileName, filedata);
>>>>>
>>>>>            log.debug("Anadido plugin " + uploadFileName);
>>>>>
>>>>>        } catch (ConnectException e) {
>>>>>            log.error(e);
>>>>>            throw new InternalErrorException(e);
>>>>>
>>>>>        } catch (DuplicateInstanceException e) {
>>>>>            log.error(e);
>>>>>            addFieldError("upload",
>>>>>                    getText("PluginsTable.File.Duplicate"));
>>>>>
>>>>>        } catch (FileNotFoundException e) {
>>>>>            log.error(e);
>>>>>            addFieldError("upload",
>>>>>                    getText("PluginsTable.File.NotFound"));
>>>>>
>>>>>        } catch (Exception e) {
>>>>>            log.error(e);
>>>>>            addFieldError("uploadContentType",
>>>>>                    getText("ErrorMessages.file.incorrectExtension"));
>>>>>        }
>>>>>
>>>>>        if (hasErrors()) {
>>>>>            return Action.INPUT;
>>>>>        }
>>>>>
>>>>>        return Action.SUCCESS;
>>>>>    }
>>>>>
>>>>>
>>>>>    /*
>>>>>     * Read an input stream in its entirety into a byte array
>>>>>     */
>>>>>    private static byte[] readInputStream(InputStream inputStream)
>>>>>        throws IOException {
>>>>>
>>>>>        ....
>>>>>
>>>>>        return content;
>>>>>    }
>>>>>
>>>>>    /**
>>>>>     * Getters/Setters
>>>>>     * @return
>>>>>     */
>>>>>
>>>>>    public File getUpload() {
>>>>>        return upload;
>>>>>    }
>>>>>
>>>>>
>>>>>    public void setUpload(File upload) {
>>>>>        this.upload = upload;
>>>>>    }
>>>>>
>>>>>
>>>>>    public String getUploadContentType() {
>>>>>        return uploadContentType;
>>>>>    }
>>>>>
>>>>>
>>>>>    public void setUploadContentType(String uploadContentType) {
>>>>>        this.uploadContentType = uploadContentType;
>>>>>    }
>>>>>
>>>>>
>>>>>    public String getUploadFileName() {
>>>>>        return uploadFileName;
>>>>>    }
>>>>>
>>>>>
>>>>>    public void setUploadFileName(String uploadFileName) {
>>>>>        this.uploadFileName = uploadFileName;
>>>>>    }
>>>>>
>>>>> }
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> Dave Newton escribió:
>>>>>
>>>>>  
>>>>>> --- Pablo Vázquez Blázquez <pv...@denodo.com> wrote:
>>>>>>
>>>>>>    
>>>>>>> I send you my struts-config.xml file, but it works ok. If I 
>>>>>>> delete my
>>>>>>> "s:file" from my form, everything works fine.
>>>>>>>
>>>>>>>         
>>>>>> The error happens after you submit, correct?
>>>>>>
>>>>>> I guess I'd want to see the JSP and the action code, then; the
>>>>>>       
>>>>> configuration
>>>>>  
>>>>>> seems okay.
>>>>>>
>>>>>> Have you tried it without setting the "struts.multipart.parser"
>>>>>>       
>>>>> constant? The
>>>>>  
>>>>>> default value of that is "jakarta", not a classname; it's worth a 
>>>>>> shot,
>>>>>> anyway.
>>>>>>
>>>>>> d.
>>>>>>
>>>>>>
>>>>>>    
>>>>>>> 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">
>>>>>>>
>>>>>>>
>>>>>>>         
>>>>>> === message truncated ===
>>>>>>
>>>>>>
>>>>>> --------------------------------------------------------------------- 
>>>>>>
>>>>>> 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
>>>>>
>>>>>
>>>>>     
>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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
>>
>
>
> ---------------------------------------------------------------------
> 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


Re: File Upload

Posted by Pablo Vázquez Blázquez <pv...@denodo.com>.
Error de lectura XML: contenido incorrecto tras un elemento XML del 
documento
Ubicación: http://localhost:8080/scheduler-admintool-1.0/AddPlugin.do
Número de línea 8, columna 1:<form id="addPluginForm" 
name="addPluginForm" onsubmit="return true;" 
action="/scheduler-admintool-1.0/AddPlugin.do" method="post" 
enctype="multipart/form-data">
^

That´s the result if I try without the ajax theme on the form.

Yes, I would like to use the ajax theme.

Thanks.

Jeromy Evans escribió:
> Are you deliberately trying to do an XHR file upload? Have you tried 
> it without the ajax theme on the form?
>
> Pablo Vázquez Blázquez wrote:
>> Yes yes, that debugging statement is executed. That´s why I know my 
>> plugin is created.
>>
>> "Anadido plugin " + uploadFileName means "Added plugin " + 
>> uploadFileName.
>>
>> And then, it goes to ShowPlugins and the debugging statement
>> log.debug("Obtenidos plugins"); (Getted all plugins) is also executed.
>>
>>
>>
>> Cheng Wei Lee escribió:
>>> Was this debugging statement executed?
>>>
>>>            log.debug("Anadido plugin " + uploadFileName);
>>>
>>>
>>> On Jan 18, 2008 12:13 AM, Pablo Vázquez Blázquez <pv...@denodo.com>
>>> wrote:
>>>
>>>  
>>>> Here I send you my JSP and Action code.
>>>>
>>>> Yes, when I submit, the new plugin is added (I know it because of my
>>>> logs), but I don´t know why I don´t get the result page.
>>>>
>>>> Thank you.
>>>>
>>>> PD: I have now tried without struts.multipart.parser, but it 
>>>> doesn´t work.
>>>>
>>>> ****** JSP ******
>>>>
>>>> <jsp:root xmlns="http://www.w3.org/1999/xhtml"
>>>>    xmlns:jsp="http://java.sun.com/JSP/Page"
>>>>    xmlns:fmt="http://java.sun.com/jsp/jstl/fmt"
>>>>    xmlns:c="http://java.sun.com/jsp/jstl/core"
>>>>    xmlns:s="/struts-tags"
>>>>    version="2.0">
>>>>
>>>>    <!-- Tabla con los plugins. Si no hay ninguno, se muestra un 
>>>> mensaje
>>>> -->
>>>>    <table class="pluginsTable" cellspacing="0px" cellpadding="3px"
>>>> border="1px">
>>>>        <tbody>
>>>>            <tr>
>>>>                <td class="tableTitle" colspan="5">
>>>>                    <fmt:message key="PluginsTable.Title"/>
>>>>                </td>
>>>>            </tr>
>>>>            <tr>
>>>>                <td class="tableHeader">
>>>>                    <fmt:message key="PluginsTable.Name"/>
>>>>                </td>
>>>>                <td class="tableHeader">
>>>>                    <fmt:message key="PluginsTable.JarFile"/>
>>>>                </td>
>>>>                <td class="tableHeader">
>>>>                    <fmt:message key="PluginsTable.PluginClass"/>
>>>>                </td>
>>>>                <td class="tableHeader">
>>>>                    <fmt:message key="PluginsTable.Type"/>
>>>>                </td>
>>>>                <td class="tableHeader">
>>>>                    <fmt:message key="PluginsTable.Actions"/>
>>>>                </td>
>>>>            </tr>
>>>>            <c:if test="${empty plugins}">
>>>>                <tr>
>>>>                    <td class="tableMessage" colspan="5">
>>>>                        <fmt:message key="PluginsTable.NoPlugins"/>
>>>>                    </td>
>>>>                </tr>
>>>>            </c:if>
>>>>            <c:forEach items="${plugins}" var="plugin" 
>>>> varStatus="status">
>>>>                <!-- stuff -->
>>>>            </c:forEach>
>>>>        </tbody>
>>>>    </table>
>>>>
>>>>
>>>>    <!-- Form to add plugin -->
>>>>    <s:form id="addPluginForm" name="addPluginForm" theme="ajax"
>>>>            action="AddPlugin" enctype="multipart/form-data" 
>>>> method="post">
>>>>
>>>>        <div class="field">
>>>>            <span class="label">
>>>>                <fmt:message key="PluginsTable.File"/>*:
>>>>            </span>
>>>>            <span class="entry">
>>>>                <s:file name="upload" size="40"
>>>>                    accept="application/java-archive"/>
>>>>                <span id="errorId" class="errorMessage">
>>>>                    <s:property value="fieldErrors['upload'][0]" />
>>>>                </span>
>>>>                <span id="errorId" class="errorMessage">
>>>>                    <s:property 
>>>> value="fieldErrors['uploadContentType'][0]"
>>>> />
>>>>                </span>
>>>>            </span>
>>>>        </div>
>>>>
>>>>        <!-- BOTONES -->
>>>>        <jsp:directive.include file="FormButtons.jspf"/>
>>>>
>>>>    </s:form>
>>>>
>>>> </jsp:root>
>>>>
>>>>
>>>> ****** FORMBUTTONS.JSPF****
>>>>
>>>> <!-- BUTTONS-->
>>>> <div class="button">
>>>>    <span class="buttonLeft">
>>>>        <s:submit type="button"
>>>>                targets="configAjaxContent" executeScripts="true"
>>>>                showLoadingText="false" indicator="indicator"
>>>> cssClass="submit">
>>>>            <s:param name="value">
>>>>                <fmt:message key="Buttons.accept"/>
>>>>            </s:param>
>>>>        </s:submit>
>>>>    </span>
>>>>    <span class="buttonRight">
>>>>        <!-- cancelar -->
>>>>        <s:url id="CancelUrl" action="CancelConfiguration"/>
>>>>        <s:submit type="button" targets="configAjaxContent"
>>>>                showLoadingText="false" cssClass="reset"
>>>> href="${CancelUrl}">
>>>>            <s:param name="value">
>>>>                <fmt:message key="Buttons.cancel"/>
>>>>            </s:param>
>>>>        </s:submit>
>>>>    </span>
>>>> </div>
>>>>
>>>>
>>>>
>>>> *****ACTION *****
>>>> public class AddPluginAction extends DefaultRequestResponseAction {
>>>>
>>>>    private static final long serialVersionUID = 1516786859681901796L;
>>>>
>>>>    /**
>>>>     * Logger for this class
>>>>     */
>>>>    private static final Log log = 
>>>> LogFactory.getLog(AddPluginAction.class
>>>> );
>>>>
>>>>    private File upload;
>>>>    private String uploadContentType;
>>>>    private String uploadFileName;
>>>>
>>>>    @Override
>>>>    protected String doExecute() throws Exception {
>>>>
>>>>        clearErrorsAndMessages();
>>>>
>>>>        Context context =
>>>>            SessionManager.getRemoteServerContext(getRequest());
>>>>
>>>>        SchedulerManager facade =
>>>>            SessionManager.getUserFacadeDelegate(getRequest(), 
>>>> context);
>>>>
>>>>        try {
>>>>
>>>>            byte[] filedata = readInputStream(new 
>>>> FileInputStream(upload));
>>>>
>>>>            facade.addPlugin(uploadFileName, filedata);
>>>>
>>>>            log.debug("Anadido plugin " + uploadFileName);
>>>>
>>>>        } catch (ConnectException e) {
>>>>            log.error(e);
>>>>            throw new InternalErrorException(e);
>>>>
>>>>        } catch (DuplicateInstanceException e) {
>>>>            log.error(e);
>>>>            addFieldError("upload",
>>>>                    getText("PluginsTable.File.Duplicate"));
>>>>
>>>>        } catch (FileNotFoundException e) {
>>>>            log.error(e);
>>>>            addFieldError("upload",
>>>>                    getText("PluginsTable.File.NotFound"));
>>>>
>>>>        } catch (Exception e) {
>>>>            log.error(e);
>>>>            addFieldError("uploadContentType",
>>>>                    getText("ErrorMessages.file.incorrectExtension"));
>>>>        }
>>>>
>>>>        if (hasErrors()) {
>>>>            return Action.INPUT;
>>>>        }
>>>>
>>>>        return Action.SUCCESS;
>>>>    }
>>>>
>>>>
>>>>    /*
>>>>     * Read an input stream in its entirety into a byte array
>>>>     */
>>>>    private static byte[] readInputStream(InputStream inputStream)
>>>>        throws IOException {
>>>>
>>>>        ....
>>>>
>>>>        return content;
>>>>    }
>>>>
>>>>    /**
>>>>     * Getters/Setters
>>>>     * @return
>>>>     */
>>>>
>>>>    public File getUpload() {
>>>>        return upload;
>>>>    }
>>>>
>>>>
>>>>    public void setUpload(File upload) {
>>>>        this.upload = upload;
>>>>    }
>>>>
>>>>
>>>>    public String getUploadContentType() {
>>>>        return uploadContentType;
>>>>    }
>>>>
>>>>
>>>>    public void setUploadContentType(String uploadContentType) {
>>>>        this.uploadContentType = uploadContentType;
>>>>    }
>>>>
>>>>
>>>>    public String getUploadFileName() {
>>>>        return uploadFileName;
>>>>    }
>>>>
>>>>
>>>>    public void setUploadFileName(String uploadFileName) {
>>>>        this.uploadFileName = uploadFileName;
>>>>    }
>>>>
>>>> }
>>>>
>>>>
>>>>
>>>>
>>>> Dave Newton escribió:
>>>>
>>>>   
>>>>> --- Pablo Vázquez Blázquez <pv...@denodo.com> wrote:
>>>>>
>>>>>     
>>>>>> I send you my struts-config.xml file, but it works ok. If I 
>>>>>> delete my
>>>>>> "s:file" from my form, everything works fine.
>>>>>>
>>>>>>         
>>>>> The error happens after you submit, correct?
>>>>>
>>>>> I guess I'd want to see the JSP and the action code, then; the
>>>>>       
>>>> configuration
>>>>   
>>>>> seems okay.
>>>>>
>>>>> Have you tried it without setting the "struts.multipart.parser"
>>>>>       
>>>> constant? The
>>>>   
>>>>> default value of that is "jakarta", not a classname; it's worth a 
>>>>> shot,
>>>>> anyway.
>>>>>
>>>>> d.
>>>>>
>>>>>
>>>>>     
>>>>>> 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">
>>>>>>
>>>>>>
>>>>>>         
>>>>> === message truncated ===
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> 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
>>>>
>>>>
>>>>     
>>
>>
>> ---------------------------------------------------------------------
>> 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
>


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


Re: File Upload

Posted by Jeromy Evans <je...@blueskyminds.com.au>.
Are you deliberately trying to do an XHR file upload? 
Have you tried it without the ajax theme on the form?

Pablo Vázquez Blázquez wrote:
> Yes yes, that debugging statement is executed. That´s why I know my 
> plugin is created.
>
> "Anadido plugin " + uploadFileName means "Added plugin " + 
> uploadFileName.
>
> And then, it goes to ShowPlugins and the debugging statement
> log.debug("Obtenidos plugins"); (Getted all plugins) is also executed.
>
>
>
> Cheng Wei Lee escribió:
>> Was this debugging statement executed?
>>
>>            log.debug("Anadido plugin " + uploadFileName);
>>
>>
>> On Jan 18, 2008 12:13 AM, Pablo Vázquez Blázquez <pv...@denodo.com>
>> wrote:
>>
>>  
>>> Here I send you my JSP and Action code.
>>>
>>> Yes, when I submit, the new plugin is added (I know it because of my
>>> logs), but I don´t know why I don´t get the result page.
>>>
>>> Thank you.
>>>
>>> PD: I have now tried without struts.multipart.parser, but it doesn´t 
>>> work.
>>>
>>> ****** JSP ******
>>>
>>> <jsp:root xmlns="http://www.w3.org/1999/xhtml"
>>>    xmlns:jsp="http://java.sun.com/JSP/Page"
>>>    xmlns:fmt="http://java.sun.com/jsp/jstl/fmt"
>>>    xmlns:c="http://java.sun.com/jsp/jstl/core"
>>>    xmlns:s="/struts-tags"
>>>    version="2.0">
>>>
>>>    <!-- Tabla con los plugins. Si no hay ninguno, se muestra un mensaje
>>> -->
>>>    <table class="pluginsTable" cellspacing="0px" cellpadding="3px"
>>> border="1px">
>>>        <tbody>
>>>            <tr>
>>>                <td class="tableTitle" colspan="5">
>>>                    <fmt:message key="PluginsTable.Title"/>
>>>                </td>
>>>            </tr>
>>>            <tr>
>>>                <td class="tableHeader">
>>>                    <fmt:message key="PluginsTable.Name"/>
>>>                </td>
>>>                <td class="tableHeader">
>>>                    <fmt:message key="PluginsTable.JarFile"/>
>>>                </td>
>>>                <td class="tableHeader">
>>>                    <fmt:message key="PluginsTable.PluginClass"/>
>>>                </td>
>>>                <td class="tableHeader">
>>>                    <fmt:message key="PluginsTable.Type"/>
>>>                </td>
>>>                <td class="tableHeader">
>>>                    <fmt:message key="PluginsTable.Actions"/>
>>>                </td>
>>>            </tr>
>>>            <c:if test="${empty plugins}">
>>>                <tr>
>>>                    <td class="tableMessage" colspan="5">
>>>                        <fmt:message key="PluginsTable.NoPlugins"/>
>>>                    </td>
>>>                </tr>
>>>            </c:if>
>>>            <c:forEach items="${plugins}" var="plugin" 
>>> varStatus="status">
>>>                <!-- stuff -->
>>>            </c:forEach>
>>>        </tbody>
>>>    </table>
>>>
>>>
>>>    <!-- Form to add plugin -->
>>>    <s:form id="addPluginForm" name="addPluginForm" theme="ajax"
>>>            action="AddPlugin" enctype="multipart/form-data" 
>>> method="post">
>>>
>>>        <div class="field">
>>>            <span class="label">
>>>                <fmt:message key="PluginsTable.File"/>*:
>>>            </span>
>>>            <span class="entry">
>>>                <s:file name="upload" size="40"
>>>                    accept="application/java-archive"/>
>>>                <span id="errorId" class="errorMessage">
>>>                    <s:property value="fieldErrors['upload'][0]" />
>>>                </span>
>>>                <span id="errorId" class="errorMessage">
>>>                    <s:property 
>>> value="fieldErrors['uploadContentType'][0]"
>>> />
>>>                </span>
>>>            </span>
>>>        </div>
>>>
>>>        <!-- BOTONES -->
>>>        <jsp:directive.include file="FormButtons.jspf"/>
>>>
>>>    </s:form>
>>>
>>> </jsp:root>
>>>
>>>
>>> ****** FORMBUTTONS.JSPF****
>>>
>>> <!-- BUTTONS-->
>>> <div class="button">
>>>    <span class="buttonLeft">
>>>        <s:submit type="button"
>>>                targets="configAjaxContent" executeScripts="true"
>>>                showLoadingText="false" indicator="indicator"
>>> cssClass="submit">
>>>            <s:param name="value">
>>>                <fmt:message key="Buttons.accept"/>
>>>            </s:param>
>>>        </s:submit>
>>>    </span>
>>>    <span class="buttonRight">
>>>        <!-- cancelar -->
>>>        <s:url id="CancelUrl" action="CancelConfiguration"/>
>>>        <s:submit type="button" targets="configAjaxContent"
>>>                showLoadingText="false" cssClass="reset"
>>> href="${CancelUrl}">
>>>            <s:param name="value">
>>>                <fmt:message key="Buttons.cancel"/>
>>>            </s:param>
>>>        </s:submit>
>>>    </span>
>>> </div>
>>>
>>>
>>>
>>> *****ACTION *****
>>> public class AddPluginAction extends DefaultRequestResponseAction {
>>>
>>>    private static final long serialVersionUID = 1516786859681901796L;
>>>
>>>    /**
>>>     * Logger for this class
>>>     */
>>>    private static final Log log = 
>>> LogFactory.getLog(AddPluginAction.class
>>> );
>>>
>>>    private File upload;
>>>    private String uploadContentType;
>>>    private String uploadFileName;
>>>
>>>    @Override
>>>    protected String doExecute() throws Exception {
>>>
>>>        clearErrorsAndMessages();
>>>
>>>        Context context =
>>>            SessionManager.getRemoteServerContext(getRequest());
>>>
>>>        SchedulerManager facade =
>>>            SessionManager.getUserFacadeDelegate(getRequest(), context);
>>>
>>>        try {
>>>
>>>            byte[] filedata = readInputStream(new 
>>> FileInputStream(upload));
>>>
>>>            facade.addPlugin(uploadFileName, filedata);
>>>
>>>            log.debug("Anadido plugin " + uploadFileName);
>>>
>>>        } catch (ConnectException e) {
>>>            log.error(e);
>>>            throw new InternalErrorException(e);
>>>
>>>        } catch (DuplicateInstanceException e) {
>>>            log.error(e);
>>>            addFieldError("upload",
>>>                    getText("PluginsTable.File.Duplicate"));
>>>
>>>        } catch (FileNotFoundException e) {
>>>            log.error(e);
>>>            addFieldError("upload",
>>>                    getText("PluginsTable.File.NotFound"));
>>>
>>>        } catch (Exception e) {
>>>            log.error(e);
>>>            addFieldError("uploadContentType",
>>>                    getText("ErrorMessages.file.incorrectExtension"));
>>>        }
>>>
>>>        if (hasErrors()) {
>>>            return Action.INPUT;
>>>        }
>>>
>>>        return Action.SUCCESS;
>>>    }
>>>
>>>
>>>    /*
>>>     * Read an input stream in its entirety into a byte array
>>>     */
>>>    private static byte[] readInputStream(InputStream inputStream)
>>>        throws IOException {
>>>
>>>        ....
>>>
>>>        return content;
>>>    }
>>>
>>>    /**
>>>     * Getters/Setters
>>>     * @return
>>>     */
>>>
>>>    public File getUpload() {
>>>        return upload;
>>>    }
>>>
>>>
>>>    public void setUpload(File upload) {
>>>        this.upload = upload;
>>>    }
>>>
>>>
>>>    public String getUploadContentType() {
>>>        return uploadContentType;
>>>    }
>>>
>>>
>>>    public void setUploadContentType(String uploadContentType) {
>>>        this.uploadContentType = uploadContentType;
>>>    }
>>>
>>>
>>>    public String getUploadFileName() {
>>>        return uploadFileName;
>>>    }
>>>
>>>
>>>    public void setUploadFileName(String uploadFileName) {
>>>        this.uploadFileName = uploadFileName;
>>>    }
>>>
>>> }
>>>
>>>
>>>
>>>
>>> Dave Newton escribió:
>>>
>>>    
>>>> --- Pablo Vázquez Blázquez <pv...@denodo.com> wrote:
>>>>
>>>>      
>>>>> I send you my struts-config.xml file, but it works ok. If I delete my
>>>>> "s:file" from my form, everything works fine.
>>>>>
>>>>>         
>>>> The error happens after you submit, correct?
>>>>
>>>> I guess I'd want to see the JSP and the action code, then; the
>>>>       
>>> configuration
>>>    
>>>> seems okay.
>>>>
>>>> Have you tried it without setting the "struts.multipart.parser"
>>>>       
>>> constant? The
>>>    
>>>> default value of that is "jakarta", not a classname; it's worth a 
>>>> shot,
>>>> anyway.
>>>>
>>>> d.
>>>>
>>>>
>>>>      
>>>>> 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">
>>>>>
>>>>>
>>>>>         
>>>> === message truncated ===
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> 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
>>>
>>>
>>>     
>
>
> ---------------------------------------------------------------------
> 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


Re: File Upload

Posted by Pablo Vázquez Blázquez <pv...@denodo.com>.
Yes yes, that debugging statement is executed. That´s why I know my 
plugin is created.

"Anadido plugin " + uploadFileName means "Added plugin " + uploadFileName.

And then, it goes to ShowPlugins and the debugging statement 

log.debug("Obtenidos plugins"); (Getted all plugins) is also executed.



Cheng Wei Lee escribió:
> Was this debugging statement executed?
>
>            log.debug("Anadido plugin " + uploadFileName);
>
>
> On Jan 18, 2008 12:13 AM, Pablo Vázquez Blázquez <pv...@denodo.com>
> wrote:
>
>   
>> Here I send you my JSP and Action code.
>>
>> Yes, when I submit, the new plugin is added (I know it because of my
>> logs), but I don´t know why I don´t get the result page.
>>
>> Thank you.
>>
>> PD: I have now tried without struts.multipart.parser, but it doesn´t work.
>>
>> ****** JSP ******
>>
>> <jsp:root xmlns="http://www.w3.org/1999/xhtml"
>>    xmlns:jsp="http://java.sun.com/JSP/Page"
>>    xmlns:fmt="http://java.sun.com/jsp/jstl/fmt"
>>    xmlns:c="http://java.sun.com/jsp/jstl/core"
>>    xmlns:s="/struts-tags"
>>    version="2.0">
>>
>>    <!-- Tabla con los plugins. Si no hay ninguno, se muestra un mensaje
>> -->
>>    <table class="pluginsTable" cellspacing="0px" cellpadding="3px"
>> border="1px">
>>        <tbody>
>>            <tr>
>>                <td class="tableTitle" colspan="5">
>>                    <fmt:message key="PluginsTable.Title"/>
>>                </td>
>>            </tr>
>>            <tr>
>>                <td class="tableHeader">
>>                    <fmt:message key="PluginsTable.Name"/>
>>                </td>
>>                <td class="tableHeader">
>>                    <fmt:message key="PluginsTable.JarFile"/>
>>                </td>
>>                <td class="tableHeader">
>>                    <fmt:message key="PluginsTable.PluginClass"/>
>>                </td>
>>                <td class="tableHeader">
>>                    <fmt:message key="PluginsTable.Type"/>
>>                </td>
>>                <td class="tableHeader">
>>                    <fmt:message key="PluginsTable.Actions"/>
>>                </td>
>>            </tr>
>>            <c:if test="${empty plugins}">
>>                <tr>
>>                    <td class="tableMessage" colspan="5">
>>                        <fmt:message key="PluginsTable.NoPlugins"/>
>>                    </td>
>>                </tr>
>>            </c:if>
>>            <c:forEach items="${plugins}" var="plugin" varStatus="status">
>>                <!-- stuff -->
>>            </c:forEach>
>>        </tbody>
>>    </table>
>>
>>
>>    <!-- Form to add plugin -->
>>    <s:form id="addPluginForm" name="addPluginForm" theme="ajax"
>>            action="AddPlugin" enctype="multipart/form-data" method="post">
>>
>>        <div class="field">
>>            <span class="label">
>>                <fmt:message key="PluginsTable.File"/>*:
>>            </span>
>>            <span class="entry">
>>                <s:file name="upload" size="40"
>>                    accept="application/java-archive"/>
>>                <span id="errorId" class="errorMessage">
>>                    <s:property value="fieldErrors['upload'][0]" />
>>                </span>
>>                <span id="errorId" class="errorMessage">
>>                    <s:property value="fieldErrors['uploadContentType'][0]"
>> />
>>                </span>
>>            </span>
>>        </div>
>>
>>        <!-- BOTONES -->
>>        <jsp:directive.include file="FormButtons.jspf"/>
>>
>>    </s:form>
>>
>> </jsp:root>
>>
>>
>> ****** FORMBUTTONS.JSPF****
>>
>> <!-- BUTTONS-->
>> <div class="button">
>>    <span class="buttonLeft">
>>        <s:submit type="button"
>>                targets="configAjaxContent" executeScripts="true"
>>                showLoadingText="false" indicator="indicator"
>> cssClass="submit">
>>            <s:param name="value">
>>                <fmt:message key="Buttons.accept"/>
>>            </s:param>
>>        </s:submit>
>>    </span>
>>    <span class="buttonRight">
>>        <!-- cancelar -->
>>        <s:url id="CancelUrl" action="CancelConfiguration"/>
>>        <s:submit type="button" targets="configAjaxContent"
>>                showLoadingText="false" cssClass="reset"
>> href="${CancelUrl}">
>>            <s:param name="value">
>>                <fmt:message key="Buttons.cancel"/>
>>            </s:param>
>>        </s:submit>
>>    </span>
>> </div>
>>
>>
>>
>> *****ACTION *****
>> public class AddPluginAction extends DefaultRequestResponseAction {
>>
>>    private static final long serialVersionUID = 1516786859681901796L;
>>
>>    /**
>>     * Logger for this class
>>     */
>>    private static final Log log = LogFactory.getLog(AddPluginAction.class
>> );
>>
>>    private File upload;
>>    private String uploadContentType;
>>    private String uploadFileName;
>>
>>    @Override
>>    protected String doExecute() throws Exception {
>>
>>        clearErrorsAndMessages();
>>
>>        Context context =
>>            SessionManager.getRemoteServerContext(getRequest());
>>
>>        SchedulerManager facade =
>>            SessionManager.getUserFacadeDelegate(getRequest(), context);
>>
>>        try {
>>
>>            byte[] filedata = readInputStream(new FileInputStream(upload));
>>
>>            facade.addPlugin(uploadFileName, filedata);
>>
>>            log.debug("Anadido plugin " + uploadFileName);
>>
>>        } catch (ConnectException e) {
>>            log.error(e);
>>            throw new InternalErrorException(e);
>>
>>        } catch (DuplicateInstanceException e) {
>>            log.error(e);
>>            addFieldError("upload",
>>                    getText("PluginsTable.File.Duplicate"));
>>
>>        } catch (FileNotFoundException e) {
>>            log.error(e);
>>            addFieldError("upload",
>>                    getText("PluginsTable.File.NotFound"));
>>
>>        } catch (Exception e) {
>>            log.error(e);
>>            addFieldError("uploadContentType",
>>                    getText("ErrorMessages.file.incorrectExtension"));
>>        }
>>
>>        if (hasErrors()) {
>>            return Action.INPUT;
>>        }
>>
>>        return Action.SUCCESS;
>>    }
>>
>>
>>    /*
>>     * Read an input stream in its entirety into a byte array
>>     */
>>    private static byte[] readInputStream(InputStream inputStream)
>>        throws IOException {
>>
>>        ....
>>
>>        return content;
>>    }
>>
>>    /**
>>     * Getters/Setters
>>     * @return
>>     */
>>
>>    public File getUpload() {
>>        return upload;
>>    }
>>
>>
>>    public void setUpload(File upload) {
>>        this.upload = upload;
>>    }
>>
>>
>>    public String getUploadContentType() {
>>        return uploadContentType;
>>    }
>>
>>
>>    public void setUploadContentType(String uploadContentType) {
>>        this.uploadContentType = uploadContentType;
>>    }
>>
>>
>>    public String getUploadFileName() {
>>        return uploadFileName;
>>    }
>>
>>
>>    public void setUploadFileName(String uploadFileName) {
>>        this.uploadFileName = uploadFileName;
>>    }
>>
>> }
>>
>>
>>
>>
>> Dave Newton escribió:
>>
>>     
>>> --- Pablo Vázquez Blázquez <pv...@denodo.com> wrote:
>>>
>>>       
>>>> I send you my struts-config.xml file, but it works ok. If I delete my
>>>> "s:file" from my form, everything works fine.
>>>>
>>>>         
>>> The error happens after you submit, correct?
>>>
>>> I guess I'd want to see the JSP and the action code, then; the
>>>       
>> configuration
>>     
>>> seems okay.
>>>
>>> Have you tried it without setting the "struts.multipart.parser"
>>>       
>> constant? The
>>     
>>> default value of that is "jakarta", not a classname; it's worth a shot,
>>> anyway.
>>>
>>> d.
>>>
>>>
>>>       
>>>> 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">
>>>>
>>>>
>>>>         
>>> === message truncated ===
>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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
>>
>>
>>     


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


Re: File Upload

Posted by Cheng Wei Lee <zh...@gmail.com>.
Does your doExecute method in DefaultRequestResponseAction class call the
execute method? I believe that Struts look for the execute method to run, so
if your debugging statement didn't execute, probably is the method not being
called.

On Jan 18, 2008 9:39 AM, Cheng Wei Lee <zh...@gmail.com> wrote:

> Was this debugging statement executed?
>
>            log.debug("Anadido plugin " + uploadFileName);
>
>
> On Jan 18, 2008 12:13 AM, Pablo Vázquez Blázquez < pvazquez@denodo.com>
> wrote:
>
> > Here I send you my JSP and Action code.
> >
> > Yes, when I submit, the new plugin is added (I know it because of my
> > logs), but I don´t know why I don´t get the result page.
> >
> > Thank you.
> >
> > PD: I have now tried without struts.multipart.parser, but it doesn´t
> > work.
> >
> > ****** JSP ******
> >
> > <jsp:root xmlns=" http://www.w3.org/1999/xhtml"
> >    xmlns:jsp="http://java.sun.com/JSP/Page"
> >    xmlns:fmt=" http://java.sun.com/jsp/jstl/fmt"
> >    xmlns:c="http://java.sun.com/jsp/jstl/core"
> >    xmlns:s="/struts-tags"
> >    version=" 2.0">
> >
> >    <!-- Tabla con los plugins. Si no hay ninguno, se muestra un mensaje
> > -->
> >    <table class="pluginsTable" cellspacing="0px" cellpadding="3px"
> > border="1px">
> >        <tbody>
> >            <tr>
> >                <td class="tableTitle" colspan="5">
> >                    <fmt:message key="PluginsTable.Title"/>
> >                </td>
> >            </tr>
> >            <tr>
> >                <td class="tableHeader">
> >                    <fmt:message key="PluginsTable.Name"/>
> >                </td>
> >                <td class="tableHeader">
> >                    <fmt:message key="PluginsTable.JarFile"/>
> >                </td>
> >                <td class="tableHeader">
> >                    <fmt:message key="PluginsTable.PluginClass"/>
> >                </td>
> >                <td class="tableHeader">
> >                    <fmt:message key=" PluginsTable.Type"/>
> >                </td>
> >                <td class="tableHeader">
> >                    <fmt:message key="PluginsTable.Actions"/>
> >                </td>
> >            </tr>
> >            <c:if test="${empty plugins}">
> >                <tr>
> >                    <td class="tableMessage" colspan="5">
> >                        <fmt:message key=" PluginsTable.NoPlugins"/>
> >                    </td>
> >                </tr>
> >            </c:if>
> >            <c:forEach items="${plugins}" var="plugin"
> > varStatus="status">
> >                <!-- stuff -->
> >            </c:forEach>
> >        </tbody>
> >    </table>
> >
> >
> >    <!-- Form to add plugin -->
> >    <s:form id="addPluginForm" name="addPluginForm" theme="ajax"
> >            action="AddPlugin" enctype="multipart/form-data"
> > method="post">
> >
> >        <div class="field">
> >            <span class="label">
> >                <fmt:message key=" PluginsTable.File"/>*:
> >            </span>
> >            <span class="entry">
> >                <s:file name="upload" size="40"
> >                    accept="application/java-archive"/>
> >                <span id="errorId" class="errorMessage">
> >                    <s:property value="fieldErrors['upload'][0]" />
> >                </span>
> >                <span id="errorId" class="errorMessage">
> >                    <s:property
> > value="fieldErrors['uploadContentType'][0]" />
> >                </span>
> >            </span>
> >        </div>
> >
> >        <!-- BOTONES -->
> >        <jsp:directive.include file="FormButtons.jspf"/>
> >
> >    </s:form>
> >
> > </jsp:root>
> >
> >
> > ****** FORMBUTTONS.JSPF****
> >
> > <!-- BUTTONS-->
> > <div class="button">
> >    <span class="buttonLeft">
> >        <s:submit type="button"
> >                targets="configAjaxContent" executeScripts="true"
> >                showLoadingText="false" indicator="indicator"
> > cssClass="submit">
> >            <s:param name="value">
> >                <fmt:message key="Buttons.accept"/>
> >            </s:param>
> >        </s:submit>
> >    </span>
> >    <span class="buttonRight">
> >        <!-- cancelar -->
> >        <s:url id="CancelUrl" action="CancelConfiguration"/>
> >        <s:submit type="button" targets="configAjaxContent"
> >                showLoadingText="false" cssClass="reset"
> > href="${CancelUrl}">
> >            <s:param name="value">
> >                <fmt:message key="Buttons.cancel "/>
> >            </s:param>
> >        </s:submit>
> >    </span>
> > </div>
> >
> >
> >
> > *****ACTION *****
> > public class AddPluginAction extends DefaultRequestResponseAction {
> >
> >    private static final long serialVersionUID = 1516786859681901796L;
> >
> >    /**
> >     * Logger for this class
> >     */
> >    private static final Log log = LogFactory.getLog(
> > AddPluginAction.class);
> >
> >    private File upload;
> >    private String uploadContentType;
> >    private String uploadFileName;
> >
> >    @Override
> >    protected String doExecute() throws Exception {
> >
> >        clearErrorsAndMessages();
> >
> >        Context context =
> >            SessionManager.getRemoteServerContext(getRequest());
> >
> >        SchedulerManager facade =
> >            SessionManager.getUserFacadeDelegate(getRequest(), context);
> >
> >        try {
> >
> >            byte[] filedata = readInputStream(new
> > FileInputStream(upload));
> >
> >            facade.addPlugin(uploadFileName, filedata);
> >
> >            log.debug("Anadido plugin " + uploadFileName);
> >
> >        } catch (ConnectException e) {
> >            log.error(e);
> >            throw new InternalErrorException(e);
> >
> >        } catch (DuplicateInstanceException e) {
> >            log.error(e);
> >            addFieldError("upload",
> >                    getText("PluginsTable.File.Duplicate"));
> >
> >        } catch (FileNotFoundException e) {
> >            log.error(e);
> >            addFieldError("upload",
> >                    getText("PluginsTable.File.NotFound"));
> >
> >        } catch (Exception e) {
> >            log.error(e);
> >            addFieldError("uploadContentType",
> >                    getText("ErrorMessages.file.incorrectExtension"));
> >        }
> >
> >        if (hasErrors()) {
> >            return Action.INPUT ;
> >        }
> >
> >        return Action.SUCCESS;
> >    }
> >
> >
> >    /*
> >     * Read an input stream in its entirety into a byte array
> >     */
> >    private static byte[] readInputStream(InputStream inputStream)
> >        throws IOException {
> >
> >        ....
> >
> >        return content;
> >    }
> >
> >    /**
> >     * Getters/Setters
> >     * @return
> >     */
> >
> >    public File getUpload() {
> >        return upload;
> >    }
> >
> >
> >    public void setUpload(File upload) {
> >        this.upload = upload;
> >    }
> >
> >
> >    public String getUploadContentType() {
> >        return uploadContentType;
> >    }
> >
> >
> >    public void setUploadContentType(String uploadContentType) {
> >        this.uploadContentType = uploadContentType;
> >    }
> >
> >
> >    public String getUploadFileName() {
> >        return uploadFileName;
> >    }
> >
> >
> >    public void setUploadFileName(String uploadFileName) {
> >        this.uploadFileName = uploadFileName;
> >    }
> >
> > }
> >
> >
> >
> >
> > Dave Newton escribió:
> >
> > > --- Pablo Vázquez Blázquez < pvazquez@denodo.com> wrote:
> > >
> > >> I send you my struts-config.xml file, but it works ok. If I delete my
> > >> "s:file" from my form, everything works fine.
> > >>
> > >
> > > The error happens after you submit, correct?
> > >
> > > I guess I'd want to see the JSP and the action code, then; the
> > configuration
> > > seems okay.
> > >
> > > Have you tried it without setting the "struts.multipart.parser"
> > constant? The
> > > default value of that is "jakarta", not a classname; it's worth a
> > shot,
> > > anyway.
> > >
> > > d.
> > >
> > >
> > >> 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">
> > >>
> > >>
> > > === message truncated ===
> > >
> > >
> > > ---------------------------------------------------------------------
> > > 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
> >
> >
>

Re: File Upload

Posted by Cheng Wei Lee <zh...@gmail.com>.
Was this debugging statement executed?

           log.debug("Anadido plugin " + uploadFileName);


On Jan 18, 2008 12:13 AM, Pablo Vázquez Blázquez <pv...@denodo.com>
wrote:

> Here I send you my JSP and Action code.
>
> Yes, when I submit, the new plugin is added (I know it because of my
> logs), but I don´t know why I don´t get the result page.
>
> Thank you.
>
> PD: I have now tried without struts.multipart.parser, but it doesn´t work.
>
> ****** JSP ******
>
> <jsp:root xmlns="http://www.w3.org/1999/xhtml"
>    xmlns:jsp="http://java.sun.com/JSP/Page"
>    xmlns:fmt="http://java.sun.com/jsp/jstl/fmt"
>    xmlns:c="http://java.sun.com/jsp/jstl/core"
>    xmlns:s="/struts-tags"
>    version="2.0">
>
>    <!-- Tabla con los plugins. Si no hay ninguno, se muestra un mensaje
> -->
>    <table class="pluginsTable" cellspacing="0px" cellpadding="3px"
> border="1px">
>        <tbody>
>            <tr>
>                <td class="tableTitle" colspan="5">
>                    <fmt:message key="PluginsTable.Title"/>
>                </td>
>            </tr>
>            <tr>
>                <td class="tableHeader">
>                    <fmt:message key="PluginsTable.Name"/>
>                </td>
>                <td class="tableHeader">
>                    <fmt:message key="PluginsTable.JarFile"/>
>                </td>
>                <td class="tableHeader">
>                    <fmt:message key="PluginsTable.PluginClass"/>
>                </td>
>                <td class="tableHeader">
>                    <fmt:message key="PluginsTable.Type"/>
>                </td>
>                <td class="tableHeader">
>                    <fmt:message key="PluginsTable.Actions"/>
>                </td>
>            </tr>
>            <c:if test="${empty plugins}">
>                <tr>
>                    <td class="tableMessage" colspan="5">
>                        <fmt:message key="PluginsTable.NoPlugins"/>
>                    </td>
>                </tr>
>            </c:if>
>            <c:forEach items="${plugins}" var="plugin" varStatus="status">
>                <!-- stuff -->
>            </c:forEach>
>        </tbody>
>    </table>
>
>
>    <!-- Form to add plugin -->
>    <s:form id="addPluginForm" name="addPluginForm" theme="ajax"
>            action="AddPlugin" enctype="multipart/form-data" method="post">
>
>        <div class="field">
>            <span class="label">
>                <fmt:message key="PluginsTable.File"/>*:
>            </span>
>            <span class="entry">
>                <s:file name="upload" size="40"
>                    accept="application/java-archive"/>
>                <span id="errorId" class="errorMessage">
>                    <s:property value="fieldErrors['upload'][0]" />
>                </span>
>                <span id="errorId" class="errorMessage">
>                    <s:property value="fieldErrors['uploadContentType'][0]"
> />
>                </span>
>            </span>
>        </div>
>
>        <!-- BOTONES -->
>        <jsp:directive.include file="FormButtons.jspf"/>
>
>    </s:form>
>
> </jsp:root>
>
>
> ****** FORMBUTTONS.JSPF****
>
> <!-- BUTTONS-->
> <div class="button">
>    <span class="buttonLeft">
>        <s:submit type="button"
>                targets="configAjaxContent" executeScripts="true"
>                showLoadingText="false" indicator="indicator"
> cssClass="submit">
>            <s:param name="value">
>                <fmt:message key="Buttons.accept"/>
>            </s:param>
>        </s:submit>
>    </span>
>    <span class="buttonRight">
>        <!-- cancelar -->
>        <s:url id="CancelUrl" action="CancelConfiguration"/>
>        <s:submit type="button" targets="configAjaxContent"
>                showLoadingText="false" cssClass="reset"
> href="${CancelUrl}">
>            <s:param name="value">
>                <fmt:message key="Buttons.cancel"/>
>            </s:param>
>        </s:submit>
>    </span>
> </div>
>
>
>
> *****ACTION *****
> public class AddPluginAction extends DefaultRequestResponseAction {
>
>    private static final long serialVersionUID = 1516786859681901796L;
>
>    /**
>     * Logger for this class
>     */
>    private static final Log log = LogFactory.getLog(AddPluginAction.class
> );
>
>    private File upload;
>    private String uploadContentType;
>    private String uploadFileName;
>
>    @Override
>    protected String doExecute() throws Exception {
>
>        clearErrorsAndMessages();
>
>        Context context =
>            SessionManager.getRemoteServerContext(getRequest());
>
>        SchedulerManager facade =
>            SessionManager.getUserFacadeDelegate(getRequest(), context);
>
>        try {
>
>            byte[] filedata = readInputStream(new FileInputStream(upload));
>
>            facade.addPlugin(uploadFileName, filedata);
>
>            log.debug("Anadido plugin " + uploadFileName);
>
>        } catch (ConnectException e) {
>            log.error(e);
>            throw new InternalErrorException(e);
>
>        } catch (DuplicateInstanceException e) {
>            log.error(e);
>            addFieldError("upload",
>                    getText("PluginsTable.File.Duplicate"));
>
>        } catch (FileNotFoundException e) {
>            log.error(e);
>            addFieldError("upload",
>                    getText("PluginsTable.File.NotFound"));
>
>        } catch (Exception e) {
>            log.error(e);
>            addFieldError("uploadContentType",
>                    getText("ErrorMessages.file.incorrectExtension"));
>        }
>
>        if (hasErrors()) {
>            return Action.INPUT;
>        }
>
>        return Action.SUCCESS;
>    }
>
>
>    /*
>     * Read an input stream in its entirety into a byte array
>     */
>    private static byte[] readInputStream(InputStream inputStream)
>        throws IOException {
>
>        ....
>
>        return content;
>    }
>
>    /**
>     * Getters/Setters
>     * @return
>     */
>
>    public File getUpload() {
>        return upload;
>    }
>
>
>    public void setUpload(File upload) {
>        this.upload = upload;
>    }
>
>
>    public String getUploadContentType() {
>        return uploadContentType;
>    }
>
>
>    public void setUploadContentType(String uploadContentType) {
>        this.uploadContentType = uploadContentType;
>    }
>
>
>    public String getUploadFileName() {
>        return uploadFileName;
>    }
>
>
>    public void setUploadFileName(String uploadFileName) {
>        this.uploadFileName = uploadFileName;
>    }
>
> }
>
>
>
>
> Dave Newton escribió:
>
> > --- Pablo Vázquez Blázquez <pv...@denodo.com> wrote:
> >
> >> I send you my struts-config.xml file, but it works ok. If I delete my
> >> "s:file" from my form, everything works fine.
> >>
> >
> > The error happens after you submit, correct?
> >
> > I guess I'd want to see the JSP and the action code, then; the
> configuration
> > seems okay.
> >
> > Have you tried it without setting the "struts.multipart.parser"
> constant? The
> > default value of that is "jakarta", not a classname; it's worth a shot,
> > anyway.
> >
> > d.
> >
> >
> >> 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">
> >>
> >>
> > === message truncated ===
> >
> >
> > ---------------------------------------------------------------------
> > 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
>
>

Re: File Upload

Posted by Pablo Vázquez Blázquez <pv...@denodo.com>.
Here I send you my JSP and Action code.

Yes, when I submit, the new plugin is added (I know it because of my 
logs), but I don´t know why I don´t get the result page.

Thank you.

PD: I have now tried without struts.multipart.parser, but it doesn´t work.

****** JSP ******

<jsp:root xmlns="http://www.w3.org/1999/xhtml"
    xmlns:jsp="http://java.sun.com/JSP/Page"
    xmlns:fmt="http://java.sun.com/jsp/jstl/fmt"
    xmlns:c="http://java.sun.com/jsp/jstl/core"
    xmlns:s="/struts-tags"
    version="2.0">
    
    <!-- Tabla con los plugins. Si no hay ninguno, se muestra un mensaje -->
    <table class="pluginsTable" cellspacing="0px" cellpadding="3px" border="1px">
        <tbody>
            <tr>
                <td class="tableTitle" colspan="5">
                    <fmt:message key="PluginsTable.Title"/>
                </td>
            </tr>
            <tr>
                <td class="tableHeader">
                    <fmt:message key="PluginsTable.Name"/>
                </td>
                <td class="tableHeader">
                    <fmt:message key="PluginsTable.JarFile"/>
                </td>
                <td class="tableHeader">
                    <fmt:message key="PluginsTable.PluginClass"/>
                </td>
                <td class="tableHeader">
                    <fmt:message key="PluginsTable.Type"/>
                </td>
                <td class="tableHeader">
                    <fmt:message key="PluginsTable.Actions"/>
                </td>
            </tr>
            <c:if test="${empty plugins}">
                <tr>
                    <td class="tableMessage" colspan="5">
                        <fmt:message key="PluginsTable.NoPlugins"/>
                    </td>
                </tr>
            </c:if>
            <c:forEach items="${plugins}" var="plugin" varStatus="status">
                <!-- stuff -->
            </c:forEach>
        </tbody>
    </table>
    
    
    <!-- Form to add plugin -->
    <s:form id="addPluginForm" name="addPluginForm" theme="ajax" 
            action="AddPlugin" enctype="multipart/form-data" method="post">
        
        <div class="field">
            <span class="label">
                <fmt:message key="PluginsTable.File"/>*:
            </span>
            <span class="entry">
                <s:file name="upload" size="40"
                    accept="application/java-archive"/>
                <span id="errorId" class="errorMessage">
                    <s:property value="fieldErrors['upload'][0]" />
                </span>
                <span id="errorId" class="errorMessage">
                    <s:property value="fieldErrors['uploadContentType'][0]" />
                </span>
            </span>
        </div>
        
        <!-- BOTONES -->
        <jsp:directive.include file="FormButtons.jspf"/>
        
    </s:form>
    
</jsp:root>


****** FORMBUTTONS.JSPF****

<!-- BUTTONS-->
<div class="button">
    <span class="buttonLeft">
        <s:submit type="button"  
                targets="configAjaxContent" executeScripts="true"
                showLoadingText="false" indicator="indicator" cssClass="submit">
            <s:param name="value">
                <fmt:message key="Buttons.accept"/>
            </s:param>
        </s:submit>
    </span>
    <span class="buttonRight">
        <!-- cancelar -->
        <s:url id="CancelUrl" action="CancelConfiguration"/>
        <s:submit type="button" targets="configAjaxContent" 
                showLoadingText="false" cssClass="reset" href="${CancelUrl}">
            <s:param name="value">
                <fmt:message key="Buttons.cancel"/>
            </s:param>
        </s:submit>
    </span>
</div>



*****ACTION *****
public class AddPluginAction extends DefaultRequestResponseAction {

    private static final long serialVersionUID = 1516786859681901796L;
    
    /**
     * Logger for this class
     */
    private static final Log log = LogFactory.getLog(AddPluginAction.class);
    
    private File upload;
    private String uploadContentType;
    private String uploadFileName;
    
    @Override
    protected String doExecute() throws Exception {
        
        clearErrorsAndMessages();

        Context context = 
            SessionManager.getRemoteServerContext(getRequest());

        SchedulerManager facade = 
            SessionManager.getUserFacadeDelegate(getRequest(), context);
        
        try {
            
            byte[] filedata = readInputStream(new FileInputStream(upload));
            
            facade.addPlugin(uploadFileName, filedata);
            
            log.debug("Anadido plugin " + uploadFileName);
            
        } catch (ConnectException e) {
            log.error(e);
            throw new InternalErrorException(e);
            
        } catch (DuplicateInstanceException e) {
            log.error(e);
            addFieldError("upload",
                    getText("PluginsTable.File.Duplicate"));
        
        } catch (FileNotFoundException e) {
            log.error(e);
            addFieldError("upload",
                    getText("PluginsTable.File.NotFound"));
            
        } catch (Exception e) {
            log.error(e);
            addFieldError("uploadContentType",
                    getText("ErrorMessages.file.incorrectExtension"));
        }
        
        if (hasErrors()) {
            return Action.INPUT;
        }
        
        return Action.SUCCESS;
    }
    

    /*
     * Read an input stream in its entirety into a byte array 
     */
    private static byte[] readInputStream(InputStream inputStream) 
        throws IOException {

        ....

        return content;
    }
    
    /**
     * Getters/Setters
     * @return
     */
    
    public File getUpload() {
        return upload;
    }


    public void setUpload(File upload) {
        this.upload = upload;
    }


    public String getUploadContentType() {
        return uploadContentType;
    }


    public void setUploadContentType(String uploadContentType) {
        this.uploadContentType = uploadContentType;
    }


    public String getUploadFileName() {
        return uploadFileName;
    }


    public void setUploadFileName(String uploadFileName) {
        this.uploadFileName = uploadFileName;
    }

}




Dave Newton escribió:

> --- Pablo Vázquez Blázquez <pv...@denodo.com> wrote:
>   
>> I send you my struts-config.xml file, but it works ok. If I delete my 
>> "s:file" from my form, everything works fine.
>>     
>
> The error happens after you submit, correct?
>
> I guess I'd want to see the JSP and the action code, then; the configuration
> seems okay.
>
> Have you tried it without setting the "struts.multipart.parser" constant? The
> default value of that is "jakarta", not a classname; it's worth a shot,
> anyway.
>
> d.
>
>   
>> 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">
>>
>>     
> === message truncated ===
>
>
> ---------------------------------------------------------------------
> 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


Re: File Upload

Posted by Dave Newton <ne...@yahoo.com>.
--- Pablo Vázquez Blázquez <pv...@denodo.com> wrote:
> I send you my struts-config.xml file, but it works ok. If I delete my 
> "s:file" from my form, everything works fine.

The error happens after you submit, correct?

I guess I'd want to see the JSP and the action code, then; the configuration
seems okay.

Have you tried it without setting the "struts.multipart.parser" constant? The
default value of that is "jakarta", not a classname; it's worth a shot,
anyway.

d.

> 
> 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">
> 
=== message truncated ===


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


Re: File Upload

Posted by Pablo Vázquez Blázquez <pv...@denodo.com>.
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 <zh...@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 <pv...@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


Re: File Upload

Posted by Dave Newton <ne...@yahoo.com>.
--- Cheng Wei Lee <zh...@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 <pv...@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


Re: File Upload

Posted by Cheng Wei Lee <zh...@gmail.com>.
Could you list out your entire XML file? I believe namespace is required?

On Jan 17, 2008 9:06 PM, Pablo Vázquez Blázquez <pv...@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."
>
> Thanks for your reply.
>
> Cheng Wei Lee escribió:
>  > Did you extends "struts-default" in your <package> tag?
> >
> > e.g.
> >
> > <package name="fileupload" extends="*struts-default*"
> > namespace="/fileupload"> or you used your own stack?
> >
> >
> > On Jan 17, 2008 8:33 PM, Pablo Vázquez Blázquez <pv...@denodo.com>
> wrote:
> >
> >
> >> Please, does somebody know what can be happening?
> >>
> >>
> >> Pablo Vázquez Blázquez escribió:
> >>
> >>> I´ll give you more information so that it helps you to give me a
> >>> solution:
> >>>
> >>> My Interceptors (defaultLoginStack is my default interceptor stack)
> >>> -------------------------------------------------------------------
> >>>
> >>>    <interceptor-stack name="defaultLoginStack">
> >>>                <interceptor-ref name="servlet-config" />
> >>>                <interceptor-ref name="params" />
> >>>                <interceptor-ref name="session" />
> >>>                <interceptor-ref name="login" /> <!-- mine -->
> >>>                <interceptor-ref name="prepare" />
> >>>                <interceptor-ref name="chain" />
> >>>                <interceptor-ref name="model-driven" />
> >>>                <interceptor-ref name="fileUpload" /> <!-- it should be
> >>> here?? -->
> >>>                <interceptor-ref name="static-params" />
> >>>                <interceptor-ref name="params" />
> >>>                <interceptor-ref name="conversionError" />
> >>>                <interceptor-ref name="validation" />
> >>>                <interceptor-ref name="workflow" />
> >>>    </interceptor-stack>
> >>>
> >>>
> >>> My action config:
> >>> -----------------
> >>>
> >>>    <action name="AddPlugin"
> >>>                class="AddPluginAction">
> >>>            <interceptor-ref name="fileUpload"/>
> >>>            <interceptor-ref name="basicStack"/>
> >>>            <result>/HTML/tiles/configuration/Plugins.jspx</result>
> >>>            <result
> >>> name="input">/HTML/tiles/configuration/Plugins.jspx</result>
> >>>    </action>
> >>>
> >>>
> >>> Form to add plugin:
> >>> ---------------------------------
> >>>
> >>>    <s:form id="addPluginForm" name="addPluginForm" theme="ajax"
> >>>            action="AddPlugin" enctype="multipart/form-data"
> >>> method="post">
> >>>              <div class="field">
> >>>            <span class="label">
> >>>                <fmt:message key="PluginsTable.File"/>*:
> >>>            </span>
> >>>            <span class="entry">
> >>>                <s:file name="upload"
> >>>                    accept="application/java-archive"/>
> >>>                <span id="errorId" class="errorMessage">
> >>>                    <s:property value="fieldErrors['upload'][0]" />
> >>>                </span>
> >>>                <span id="errorId" class="errorMessage">
> >>>                    <s:property
> >>> value="fieldErrors['uploadContentType'][0]" />
> >>>                </span>
> >>>            </span>
> >>>        </div>
> >>>              <s:submit type="button"
> >>> targets="configAjaxContent" executeScripts="true"
> >>>                showLoadingText="false" indicator="indicator"
> >>> cssClass="submit">
> >>>            <s:param name="value">
> >>>                <fmt:message key="Buttons.accept"/>
> >>>            </s:param>
> >>>        </s:submit>
> >>>          </s:form>
> >>>
> >>> Well, several things:
> >>>
> >>> a) I have a AddPluginAction-validation.xml, but validation never
> >>>
> >> occurrs.
> >>
> >>> b) With this interceptors configuration, the AddPluginAction is
> >>> successfully executed (it is, the plugin is added), but the
> >>> "indicator" image never stops (it is like if the request to the server
> >>> never end) and it does not go to the results' page.
> >>> c) I had to change the interceptors stack for this action, because, if
> >>> not, the action was not executed, but I would like to use my own
> >>> defaultLoginStack (if possible).
> >>>
> >>>
> >>> Thanks for your help.
> >>>
> >>>
> >>>
> >>>
> >>> Pablo Vázquez Blázquez escribió:
> >>>
> >>>> Yes, I first tried with the default stack, but the problem is the
> >>>> same :(
> >>>>
> >>>> Cheng Wei Lee escribió:
> >>>>
> >>>>> Try removing the interceptors? If I'm not mistaken, the default
> >>>>> stack has
> >>>>> it.
> >>>>>
> >>>>> On Jan 17, 2008 2:32 AM, Pablo Vázquez Blázquez
> >>>>> <pv...@denodo.com> wrote:
> >>>>>
> >>>>>
> >>>>>
> >>>>>> I am using Struts 2.0.9 and I have the following action:
> >>>>>>
> >>>>>>    <action name="AddPlugin"
> >>>>>>                class="AddPluginAction">
> >>>>>>            <interceptor-ref name="fileUpload"/>
> >>>>>>            <interceptor-ref name="basicStack"/>
> >>>>>>            <result>/HTML/tiles/configuration/Plugins.jspx</result>
> >>>>>>            <result
> >>>>>> name="input">/HTML/tiles/configuration/Plugins.jspx</result>
> >>>>>>        </action>
> >>>>>>
> >>>>>> The action is successfully executed, but the "indicator" does not
> >>>>>>
> >> stop
> >>
> >>>>>> and it does not go to Plugins.jspx (it "hands on the air").
> >>>>>>
> >>>>>> Do I have any problem with my interceptors? What else can be?
> >>>>>>
> >>>>>> Thanks.
> >>>>>>
> >>>>>>
> >>>>>>
> ---------------------------------------------------------------------
> >>>>>> 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
> >>>>
> >>>>
> >>> ---------------------------------------------------------------------
> >>> 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
> >>
> >>
> >>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: File Upload

Posted by Pablo Vázquez Blázquez <pv...@denodo.com>.
<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."

Thanks for your reply.

Cheng Wei Lee escribió:
> Did you extends "struts-default" in your <package> tag?
>
> e.g.
>
> <package name="fileupload" extends="*struts-default*"
> namespace="/fileupload"> or you used your own stack?
>
>
> On Jan 17, 2008 8:33 PM, Pablo Vázquez Blázquez <pv...@denodo.com> wrote:
>
>   
>> Please, does somebody know what can be happening?
>>
>>
>> Pablo Vázquez Blázquez escribió:
>>     
>>> I´ll give you more information so that it helps you to give me a
>>> solution:
>>>
>>> My Interceptors (defaultLoginStack is my default interceptor stack)
>>> -------------------------------------------------------------------
>>>
>>>    <interceptor-stack name="defaultLoginStack">
>>>                <interceptor-ref name="servlet-config" />
>>>                <interceptor-ref name="params" />
>>>                <interceptor-ref name="session" />
>>>                <interceptor-ref name="login" /> <!-- mine -->
>>>                <interceptor-ref name="prepare" />
>>>                <interceptor-ref name="chain" />
>>>                <interceptor-ref name="model-driven" />
>>>                <interceptor-ref name="fileUpload" /> <!-- it should be
>>> here?? -->
>>>                <interceptor-ref name="static-params" />
>>>                <interceptor-ref name="params" />
>>>                <interceptor-ref name="conversionError" />
>>>                <interceptor-ref name="validation" />
>>>                <interceptor-ref name="workflow" />
>>>    </interceptor-stack>
>>>
>>>
>>> My action config:
>>> -----------------
>>>
>>>    <action name="AddPlugin"
>>>                class="AddPluginAction">
>>>            <interceptor-ref name="fileUpload"/>
>>>            <interceptor-ref name="basicStack"/>
>>>            <result>/HTML/tiles/configuration/Plugins.jspx</result>
>>>            <result
>>> name="input">/HTML/tiles/configuration/Plugins.jspx</result>
>>>    </action>
>>>
>>>
>>> Form to add plugin:
>>> ---------------------------------
>>>
>>>    <s:form id="addPluginForm" name="addPluginForm" theme="ajax"
>>>            action="AddPlugin" enctype="multipart/form-data"
>>> method="post">
>>>              <div class="field">
>>>            <span class="label">
>>>                <fmt:message key="PluginsTable.File"/>*:
>>>            </span>
>>>            <span class="entry">
>>>                <s:file name="upload"
>>>                    accept="application/java-archive"/>
>>>                <span id="errorId" class="errorMessage">
>>>                    <s:property value="fieldErrors['upload'][0]" />
>>>                </span>
>>>                <span id="errorId" class="errorMessage">
>>>                    <s:property
>>> value="fieldErrors['uploadContentType'][0]" />
>>>                </span>
>>>            </span>
>>>        </div>
>>>              <s:submit type="button"
>>> targets="configAjaxContent" executeScripts="true"
>>>                showLoadingText="false" indicator="indicator"
>>> cssClass="submit">
>>>            <s:param name="value">
>>>                <fmt:message key="Buttons.accept"/>
>>>            </s:param>
>>>        </s:submit>
>>>          </s:form>
>>>
>>> Well, several things:
>>>
>>> a) I have a AddPluginAction-validation.xml, but validation never
>>>       
>> occurrs.
>>     
>>> b) With this interceptors configuration, the AddPluginAction is
>>> successfully executed (it is, the plugin is added), but the
>>> "indicator" image never stops (it is like if the request to the server
>>> never end) and it does not go to the results' page.
>>> c) I had to change the interceptors stack for this action, because, if
>>> not, the action was not executed, but I would like to use my own
>>> defaultLoginStack (if possible).
>>>
>>>
>>> Thanks for your help.
>>>
>>>
>>>
>>>
>>> Pablo Vázquez Blázquez escribió:
>>>       
>>>> Yes, I first tried with the default stack, but the problem is the
>>>> same :(
>>>>
>>>> Cheng Wei Lee escribió:
>>>>         
>>>>> Try removing the interceptors? If I'm not mistaken, the default
>>>>> stack has
>>>>> it.
>>>>>
>>>>> On Jan 17, 2008 2:32 AM, Pablo Vázquez Blázquez
>>>>> <pv...@denodo.com> wrote:
>>>>>
>>>>>
>>>>>           
>>>>>> I am using Struts 2.0.9 and I have the following action:
>>>>>>
>>>>>>    <action name="AddPlugin"
>>>>>>                class="AddPluginAction">
>>>>>>            <interceptor-ref name="fileUpload"/>
>>>>>>            <interceptor-ref name="basicStack"/>
>>>>>>            <result>/HTML/tiles/configuration/Plugins.jspx</result>
>>>>>>            <result
>>>>>> name="input">/HTML/tiles/configuration/Plugins.jspx</result>
>>>>>>        </action>
>>>>>>
>>>>>> The action is successfully executed, but the "indicator" does not
>>>>>>             
>> stop
>>     
>>>>>> and it does not go to Plugins.jspx (it "hands on the air").
>>>>>>
>>>>>> Do I have any problem with my interceptors? What else can be?
>>>>>>
>>>>>> Thanks.
>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> 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
>>>>
>>>>         
>>> ---------------------------------------------------------------------
>>> 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
>>
>>
>>     


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


Re: File Upload

Posted by Cheng Wei Lee <zh...@gmail.com>.
Did you extends "struts-default" in your <package> tag?

e.g.

<package name="fileupload" extends="*struts-default*"
namespace="/fileupload"> or you used your own stack?


On Jan 17, 2008 8:33 PM, Pablo Vázquez Blázquez <pv...@denodo.com> wrote:

> Please, does somebody know what can be happening?
>
>
> Pablo Vázquez Blázquez escribió:
> > I´ll give you more information so that it helps you to give me a
> > solution:
> >
> > My Interceptors (defaultLoginStack is my default interceptor stack)
> > -------------------------------------------------------------------
> >
> >    <interceptor-stack name="defaultLoginStack">
> >                <interceptor-ref name="servlet-config" />
> >                <interceptor-ref name="params" />
> >                <interceptor-ref name="session" />
> >                <interceptor-ref name="login" /> <!-- mine -->
> >                <interceptor-ref name="prepare" />
> >                <interceptor-ref name="chain" />
> >                <interceptor-ref name="model-driven" />
> >                <interceptor-ref name="fileUpload" /> <!-- it should be
> > here?? -->
> >                <interceptor-ref name="static-params" />
> >                <interceptor-ref name="params" />
> >                <interceptor-ref name="conversionError" />
> >                <interceptor-ref name="validation" />
> >                <interceptor-ref name="workflow" />
> >    </interceptor-stack>
> >
> >
> > My action config:
> > -----------------
> >
> >    <action name="AddPlugin"
> >                class="AddPluginAction">
> >            <interceptor-ref name="fileUpload"/>
> >            <interceptor-ref name="basicStack"/>
> >            <result>/HTML/tiles/configuration/Plugins.jspx</result>
> >            <result
> > name="input">/HTML/tiles/configuration/Plugins.jspx</result>
> >    </action>
> >
> >
> > Form to add plugin:
> > ---------------------------------
> >
> >    <s:form id="addPluginForm" name="addPluginForm" theme="ajax"
> >            action="AddPlugin" enctype="multipart/form-data"
> > method="post">
> >              <div class="field">
> >            <span class="label">
> >                <fmt:message key="PluginsTable.File"/>*:
> >            </span>
> >            <span class="entry">
> >                <s:file name="upload"
> >                    accept="application/java-archive"/>
> >                <span id="errorId" class="errorMessage">
> >                    <s:property value="fieldErrors['upload'][0]" />
> >                </span>
> >                <span id="errorId" class="errorMessage">
> >                    <s:property
> > value="fieldErrors['uploadContentType'][0]" />
> >                </span>
> >            </span>
> >        </div>
> >              <s:submit type="button"
> > targets="configAjaxContent" executeScripts="true"
> >                showLoadingText="false" indicator="indicator"
> > cssClass="submit">
> >            <s:param name="value">
> >                <fmt:message key="Buttons.accept"/>
> >            </s:param>
> >        </s:submit>
> >          </s:form>
> >
> > Well, several things:
> >
> > a) I have a AddPluginAction-validation.xml, but validation never
> occurrs.
> > b) With this interceptors configuration, the AddPluginAction is
> > successfully executed (it is, the plugin is added), but the
> > "indicator" image never stops (it is like if the request to the server
> > never end) and it does not go to the results' page.
> > c) I had to change the interceptors stack for this action, because, if
> > not, the action was not executed, but I would like to use my own
> > defaultLoginStack (if possible).
> >
> >
> > Thanks for your help.
> >
> >
> >
> >
> > Pablo Vázquez Blázquez escribió:
> >> Yes, I first tried with the default stack, but the problem is the
> >> same :(
> >>
> >> Cheng Wei Lee escribió:
> >>> Try removing the interceptors? If I'm not mistaken, the default
> >>> stack has
> >>> it.
> >>>
> >>> On Jan 17, 2008 2:32 AM, Pablo Vázquez Blázquez
> >>> <pv...@denodo.com> wrote:
> >>>
> >>>
> >>>> I am using Struts 2.0.9 and I have the following action:
> >>>>
> >>>>    <action name="AddPlugin"
> >>>>                class="AddPluginAction">
> >>>>            <interceptor-ref name="fileUpload"/>
> >>>>            <interceptor-ref name="basicStack"/>
> >>>>            <result>/HTML/tiles/configuration/Plugins.jspx</result>
> >>>>            <result
> >>>> name="input">/HTML/tiles/configuration/Plugins.jspx</result>
> >>>>        </action>
> >>>>
> >>>> The action is successfully executed, but the "indicator" does not
> stop
> >>>> and it does not go to Plugins.jspx (it "hands on the air").
> >>>>
> >>>> Do I have any problem with my interceptors? What else can be?
> >>>>
> >>>> Thanks.
> >>>>
> >>>>
> >>>> ---------------------------------------------------------------------
> >>>> 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
> >>
> >
> >
> > ---------------------------------------------------------------------
> > 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
>
>

Re: File Upload

Posted by Pablo Vázquez Blázquez <pv...@denodo.com>.
Please, does somebody know what can be happening?


Pablo Vázquez Blázquez escribió:
> I´ll give you more information so that it helps you to give me a 
> solution:
>
> My Interceptors (defaultLoginStack is my default interceptor stack)
> -------------------------------------------------------------------
>
>    <interceptor-stack name="defaultLoginStack">
>                <interceptor-ref name="servlet-config" />
>                <interceptor-ref name="params" />
>                <interceptor-ref name="session" />
>                <interceptor-ref name="login" /> <!-- mine -->
>                <interceptor-ref name="prepare" />
>                <interceptor-ref name="chain" />
>                <interceptor-ref name="model-driven" />
>                <interceptor-ref name="fileUpload" /> <!-- it should be 
> here?? -->
>                <interceptor-ref name="static-params" />
>                <interceptor-ref name="params" />
>                <interceptor-ref name="conversionError" />
>                <interceptor-ref name="validation" />
>                <interceptor-ref name="workflow" />
>    </interceptor-stack>
>
>
> My action config:
> -----------------
>
>    <action name="AddPlugin"
>                class="AddPluginAction">
>            <interceptor-ref name="fileUpload"/>
>            <interceptor-ref name="basicStack"/>
>            <result>/HTML/tiles/configuration/Plugins.jspx</result>
>            <result 
> name="input">/HTML/tiles/configuration/Plugins.jspx</result>
>    </action>
>
>
> Form to add plugin:
> ---------------------------------
>
>    <s:form id="addPluginForm" name="addPluginForm" theme="ajax"
>            action="AddPlugin" enctype="multipart/form-data" 
> method="post">
>              <div class="field">
>            <span class="label">
>                <fmt:message key="PluginsTable.File"/>*:
>            </span>
>            <span class="entry">
>                <s:file name="upload"
>                    accept="application/java-archive"/>
>                <span id="errorId" class="errorMessage">
>                    <s:property value="fieldErrors['upload'][0]" />
>                </span>
>                <span id="errorId" class="errorMessage">
>                    <s:property 
> value="fieldErrors['uploadContentType'][0]" />
>                </span>
>            </span>
>        </div>
>              <s:submit type="button"                
> targets="configAjaxContent" executeScripts="true"
>                showLoadingText="false" indicator="indicator" 
> cssClass="submit">
>            <s:param name="value">
>                <fmt:message key="Buttons.accept"/>
>            </s:param>
>        </s:submit>
>          </s:form>
>
> Well, several things:
>
> a) I have a AddPluginAction-validation.xml, but validation never occurrs.
> b) With this interceptors configuration, the AddPluginAction is 
> successfully executed (it is, the plugin is added), but the 
> "indicator" image never stops (it is like if the request to the server 
> never end) and it does not go to the results' page.
> c) I had to change the interceptors stack for this action, because, if 
> not, the action was not executed, but I would like to use my own 
> defaultLoginStack (if possible).
>
>
> Thanks for your help.
>
>
>
>
> Pablo Vázquez Blázquez escribió:
>> Yes, I first tried with the default stack, but the problem is the 
>> same :(
>>
>> Cheng Wei Lee escribió:
>>> Try removing the interceptors? If I'm not mistaken, the default 
>>> stack has
>>> it.
>>>
>>> On Jan 17, 2008 2:32 AM, Pablo Vázquez Blázquez 
>>> <pv...@denodo.com> wrote:
>>>
>>>  
>>>> I am using Struts 2.0.9 and I have the following action:
>>>>
>>>>    <action name="AddPlugin"
>>>>                class="AddPluginAction">
>>>>            <interceptor-ref name="fileUpload"/>
>>>>            <interceptor-ref name="basicStack"/>
>>>>            <result>/HTML/tiles/configuration/Plugins.jspx</result>
>>>>            <result
>>>> name="input">/HTML/tiles/configuration/Plugins.jspx</result>
>>>>        </action>
>>>>
>>>> The action is successfully executed, but the "indicator" does not stop
>>>> and it does not go to Plugins.jspx (it "hands on the air").
>>>>
>>>> Do I have any problem with my interceptors? What else can be?
>>>>
>>>> Thanks.
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> 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
>>
>
>
> ---------------------------------------------------------------------
> 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


Re: File Upload

Posted by Pablo Vázquez Blázquez <pv...@denodo.com>.
Debugging I found I recieve a 
com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor



Pablo Vázquez Blázquez escribió:
> I´ll give you more information so that it helps you to give me a 
> solution:
>
> My Interceptors (defaultLoginStack is my default interceptor stack)
> -------------------------------------------------------------------
>
>    <interceptor-stack name="defaultLoginStack">
>                <interceptor-ref name="servlet-config" />
>                <interceptor-ref name="params" />
>                <interceptor-ref name="session" />
>                <interceptor-ref name="login" /> <!-- mine -->
>                <interceptor-ref name="prepare" />
>                <interceptor-ref name="chain" />
>                <interceptor-ref name="model-driven" />
>                <interceptor-ref name="fileUpload" /> <!-- it should be 
> here?? -->
>                <interceptor-ref name="static-params" />
>                <interceptor-ref name="params" />
>                <interceptor-ref name="conversionError" />
>                <interceptor-ref name="validation" />
>                <interceptor-ref name="workflow" />
>    </interceptor-stack>
>
>
> My action config:
> -----------------
>
>    <action name="AddPlugin"
>                class="AddPluginAction">
>            <interceptor-ref name="fileUpload"/>
>            <interceptor-ref name="basicStack"/>
>            <result>/HTML/tiles/configuration/Plugins.jspx</result>
>            <result 
> name="input">/HTML/tiles/configuration/Plugins.jspx</result>
>    </action>
>
>
> Form to add plugin:
> ---------------------------------
>
>    <s:form id="addPluginForm" name="addPluginForm" theme="ajax"
>            action="AddPlugin" enctype="multipart/form-data" 
> method="post">
>              <div class="field">
>            <span class="label">
>                <fmt:message key="PluginsTable.File"/>*:
>            </span>
>            <span class="entry">
>                <s:file name="upload"
>                    accept="application/java-archive"/>
>                <span id="errorId" class="errorMessage">
>                    <s:property value="fieldErrors['upload'][0]" />
>                </span>
>                <span id="errorId" class="errorMessage">
>                    <s:property 
> value="fieldErrors['uploadContentType'][0]" />
>                </span>
>            </span>
>        </div>
>              <s:submit type="button"                
> targets="configAjaxContent" executeScripts="true"
>                showLoadingText="false" indicator="indicator" 
> cssClass="submit">
>            <s:param name="value">
>                <fmt:message key="Buttons.accept"/>
>            </s:param>
>        </s:submit>
>          </s:form>
>
> Well, several things:
>
> a) I have a AddPluginAction-validation.xml, but validation never occurrs.
> b) With this interceptors configuration, the AddPluginAction is 
> successfully executed (it is, the plugin is added), but the 
> "indicator" image never stops (it is like if the request to the server 
> never end) and it does not go to the results' page.
> c) I had to change the interceptors stack for this action, because, if 
> not, the action was not executed, but I would like to use my own 
> defaultLoginStack (if possible).
>
>
> Thanks for your help.
>
>
>
>
> Pablo Vázquez Blázquez escribió:
>> Yes, I first tried with the default stack, but the problem is the 
>> same :(
>>
>> Cheng Wei Lee escribió:
>>> Try removing the interceptors? If I'm not mistaken, the default 
>>> stack has
>>> it.
>>>
>>> On Jan 17, 2008 2:32 AM, Pablo Vázquez Blázquez 
>>> <pv...@denodo.com> wrote:
>>>
>>>  
>>>> I am using Struts 2.0.9 and I have the following action:
>>>>
>>>>    <action name="AddPlugin"
>>>>                class="AddPluginAction">
>>>>            <interceptor-ref name="fileUpload"/>
>>>>            <interceptor-ref name="basicStack"/>
>>>>            <result>/HTML/tiles/configuration/Plugins.jspx</result>
>>>>            <result
>>>> name="input">/HTML/tiles/configuration/Plugins.jspx</result>
>>>>        </action>
>>>>
>>>> The action is successfully executed, but the "indicator" does not stop
>>>> and it does not go to Plugins.jspx (it "hands on the air").
>>>>
>>>> Do I have any problem with my interceptors? What else can be?
>>>>
>>>> Thanks.
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> 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
>>
>
>
> ---------------------------------------------------------------------
> 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


Re: File Upload

Posted by Pablo Vázquez Blázquez <pv...@denodo.com>.
I´ll give you more information so that it helps you to give me a solution:

My Interceptors (defaultLoginStack is my default interceptor stack)
-------------------------------------------------------------------

    <interceptor-stack name="defaultLoginStack">
                <interceptor-ref name="servlet-config" />
                <interceptor-ref name="params" />
                <interceptor-ref name="session" />
                <interceptor-ref name="login" /> <!-- mine -->
                <interceptor-ref name="prepare" />
                <interceptor-ref name="chain" />
                <interceptor-ref name="model-driven" />
                <interceptor-ref name="fileUpload" /> <!-- it should be 
here?? -->
                <interceptor-ref name="static-params" />
                <interceptor-ref name="params" />
                <interceptor-ref name="conversionError" />
                <interceptor-ref name="validation" />
                <interceptor-ref name="workflow" />
    </interceptor-stack>


My action config:
-----------------

    <action name="AddPlugin"
                class="AddPluginAction">
            <interceptor-ref name="fileUpload"/>
            <interceptor-ref name="basicStack"/>
            <result>/HTML/tiles/configuration/Plugins.jspx</result>
            <result 
name="input">/HTML/tiles/configuration/Plugins.jspx</result>
    </action>


Form to add plugin:
---------------------------------

    <s:form id="addPluginForm" name="addPluginForm" theme="ajax"
            action="AddPlugin" enctype="multipart/form-data" method="post">
       
        <div class="field">
            <span class="label">
                <fmt:message key="PluginsTable.File"/>*:
            </span>
            <span class="entry">
                <s:file name="upload"
                    accept="application/java-archive"/>
                <span id="errorId" class="errorMessage">
                    <s:property value="fieldErrors['upload'][0]" />
                </span>
                <span id="errorId" class="errorMessage">
                    <s:property 
value="fieldErrors['uploadContentType'][0]" />
                </span>
            </span>
        </div>
       
        <s:submit type="button" 
                targets="configAjaxContent" executeScripts="true"
                showLoadingText="false" indicator="indicator" 
cssClass="submit">
            <s:param name="value">
                <fmt:message key="Buttons.accept"/>
            </s:param>
        </s:submit>
       
    </s:form>

Well, several things:

a) I have a AddPluginAction-validation.xml, but validation never occurrs.
b) With this interceptors configuration, the AddPluginAction is 
successfully executed (it is, the plugin is added), but the "indicator" 
image never stops (it is like if the request to the server never end) 
and it does not go to the results' page.
c) I had to change the interceptors stack for this action, because, if 
not, the action was not executed, but I would like to use my own 
defaultLoginStack (if possible).


Thanks for your help.




Pablo Vázquez Blázquez escribió:
> Yes, I first tried with the default stack, but the problem is the same :(
>
> Cheng Wei Lee escribió:
>> Try removing the interceptors? If I'm not mistaken, the default stack 
>> has
>> it.
>>
>> On Jan 17, 2008 2:32 AM, Pablo Vázquez Blázquez <pv...@denodo.com> 
>> wrote:
>>
>>  
>>> I am using Struts 2.0.9 and I have the following action:
>>>
>>>    <action name="AddPlugin"
>>>                class="AddPluginAction">
>>>            <interceptor-ref name="fileUpload"/>
>>>            <interceptor-ref name="basicStack"/>
>>>            <result>/HTML/tiles/configuration/Plugins.jspx</result>
>>>            <result
>>> name="input">/HTML/tiles/configuration/Plugins.jspx</result>
>>>        </action>
>>>
>>> The action is successfully executed, but the "indicator" does not stop
>>> and it does not go to Plugins.jspx (it "hands on the air").
>>>
>>> Do I have any problem with my interceptors? What else can be?
>>>
>>> Thanks.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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
>


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


Re: File Upload

Posted by Pablo Vázquez Blázquez <pv...@denodo.com>.
Yes, I first tried with the default stack, but the problem is the same :(

Cheng Wei Lee escribió:
> Try removing the interceptors? If I'm not mistaken, the default stack has
> it.
>
> On Jan 17, 2008 2:32 AM, Pablo Vázquez Blázquez <pv...@denodo.com> wrote:
>
>   
>> I am using Struts 2.0.9 and I have the following action:
>>
>>    <action name="AddPlugin"
>>                class="AddPluginAction">
>>            <interceptor-ref name="fileUpload"/>
>>            <interceptor-ref name="basicStack"/>
>>            <result>/HTML/tiles/configuration/Plugins.jspx</result>
>>            <result
>> name="input">/HTML/tiles/configuration/Plugins.jspx</result>
>>        </action>
>>
>> The action is successfully executed, but the "indicator" does not stop
>> and it does not go to Plugins.jspx (it "hands on the air").
>>
>> Do I have any problem with my interceptors? What else can be?
>>
>> Thanks.
>>
>>
>> ---------------------------------------------------------------------
>> 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


Re: File Upload

Posted by Cheng Wei Lee <zh...@gmail.com>.
Try removing the interceptors? If I'm not mistaken, the default stack has
it.

On Jan 17, 2008 2:32 AM, Pablo Vázquez Blázquez <pv...@denodo.com> wrote:

> I am using Struts 2.0.9 and I have the following action:
>
>    <action name="AddPlugin"
>                class="AddPluginAction">
>            <interceptor-ref name="fileUpload"/>
>            <interceptor-ref name="basicStack"/>
>            <result>/HTML/tiles/configuration/Plugins.jspx</result>
>            <result
> name="input">/HTML/tiles/configuration/Plugins.jspx</result>
>        </action>
>
> The action is successfully executed, but the "indicator" does not stop
> and it does not go to Plugins.jspx (it "hands on the air").
>
> Do I have any problem with my interceptors? What else can be?
>
> Thanks.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>