Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ajax-file-upload-plugin-0.4.0.jar issue while integrating with struts2.1.6. #5

Open
GoogleCodeExporter opened this issue Apr 9, 2015 · 3 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. the jsp page is shown below
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib uri="http://www.devedup.com/taglibs" prefix="afile"%>
<head>
<script
src="http://yui.yahooapis.com/2.4.1/build/yahoo/yahoo-min.js"></script>  
<script
src="http://yui.yahooapis.com/2.4.1/build/event/event-min.js"></script>  
<script
src="http://yui.yahooapis.com/2.4.1/build/connection/connection-min.js"></script
>


<afile:head />

</head>
<style>
body {font-family:"Tahoma";}
.file_container {width:480px;font-size:11px;border: 1px solid
black;margin:0px;border-collapse:collapse;}
.filelist {font-size:11px;width:100%;margin:0px;border-collapse:collapse;}
#ajaxFileUploadForm .label {font-size:11px;}
#ajaxFileUploadForm input {font-size:11px;}
.filelist tr.odd {background-color:#eef;}
.filelist tr.even { background-color:#dde;}
.filelist tr td {padding:4px;}
</style>

<script>
    var callback =   
    {   
        cache:false,
        success: function(o) {document.getElementById('did').innerHTML =
o.responseText;}   
    }   
    function show_list() {
        var transaction = YAHOO.util.Connect.asyncRequest('GET',
'/jctaylor/FileUploadDetailsAction.action', callback, null); 
    }
</script>

<body>
    <table class="file_container">
        <tr><td>This demonstrates the use of Struts2 Ajax upload plugin and YUI
Ajax connect library.
        For more details see <a href="">here</a>.
        </td></tr>
        <tr>
            <td><afile:ajaxfileuploadform action="FileUploadDemoAction" dobefore=""
doafter="show_list" /></td>
        </tr>
        <tr>
            <td><div id='did'></div></td>
        </tr>
    </table> 
</body>



2. call this page assuming creating all the action classes and action
mapping provided by this link:
http://www.struts2.org/ajax-file-upload-in-struts2-using-ajax-file-upload-plugin
/

What is the expected output? What do you see instead?
1. I should see the page to browse the files
2. But I am seeing the 500 error page with the following error:
org.apache.jasper.JasperException: Template
/template/simple/progressbar-close.ftl not found. - Class:
freemarker.template.Configuration
File: Configuration.java
Method: getTemplate
Line: 489 - freemarker/template/Configuration.java:489:-1
    org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:515)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:411)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:322)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:249)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    org.apache.struts2.dispatcher.ServletDispatcherResult.doExecute(ServletDispatcherResult.java:154)
    org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:186)
    com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:361)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:265)
    com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:163)


What version of the product are you using? On what operating system?
I am using version ajax-file-upload-plugin-0.4.0.jar
with struts2.1.6 

Please provide any additional information below.
here is my action classes and mappings:
package ajaxupload.action;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts2.interceptor.ServletRequestAware;

import com.devedup.ajaxfileupload.action.FileUpload;
import com.opensymphony.xwork2.Action;

public class FileUploadDemoAction extends FileUpload implements
ServletRequestAware{

    HttpServletRequest request;
    @SuppressWarnings("unchecked")
    public String execute() {
        File uploadedFile = this.getUpload();
        String contentType = this.getUploadContentType();
        String fileName = this.getUploadFileName();

        List<String> l =
(List<String>)request.getSession(true).getAttribute("uploaded_list");
        if(l== null) {
            l  = new ArrayList<String>();
            request.getSession(true).setAttribute("uploaded_list", l);
        }

        l.add("FileName: "+fileName+"\n"+"ContentType: "+contentType+"\n");
        return Action.SUCCESS;
    }

    public void setServletRequest(HttpServletRequest req) {
        request = req;
    }

}


Mapping file:

<action name="FileUploadDemoAction"
            class="ajaxupload.action.FileUploadDemoAction">
            <interceptor-ref name="fileUploadStack" />
            <result name="success" type="httpheader">
                <param name="status">200</param>
            </result>
        </action>
        <action name="FileUploadDetailsAction"
            class="ajaxupload.action.FileUploadDetailsAction">
            <result>/jctaylor/pages/insuranceApplication/uploadedFilelist.jsp</result>
        </action> 





Original issue reported on code.google.com by br.ka...@gmail.com on 25 Sep 2009 at 9:45

@GoogleCodeExporter
Copy link
Author

for each instance of the plugin struts2 upload,can you help me!

Original comment by lhlua...@gmail.com on 8 Jun 2010 at 8:36

@GoogleCodeExporter
Copy link
Author

http://www.struts2.org/ajax-file-upload-in-struts2-using-ajax-file-upload-plugin
/

is no longer existed. Anyone can help me? How to upload the file to the server 
of ftp and monitor the progress?

Original comment by Ying.Uco...@gmail.com on 22 Sep 2010 at 2:09

@GoogleCodeExporter
Copy link
Author

Original comment by dungroi...@gmail.com on 10 Feb 2012 at 12:18

Attachments:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant