WD FileUpload api ...

Is there some WD FileUpload api example code to try?
Im trying to use the File upload in a WD project but i get "com.sap.tc.webdynpro.services.sal.util.cache.WDResourceNotFoundException: Object could not be found in cache, key is null"
I apply all the advises written here in the forum, but I still have the same error.
my problem is, I have to receive two binary files.
so I have two fileUpload components (named fileCert an fileKey)
I have in the custom controller context two nodes (one for each file) with two value atributes (certFile.fileData binary and certFile.fileName String,
keyFile.fileData and keyFile.FileName)
both nodes have 1..n cardinality and 1..n Selection in the node properties
I mapped this nodes to the context of the view and bind them to the data property of the FileUpload UI element
in the action of the button submit i have this code:
wdThis.wdGetNDISAdminCustController().EncodeFileData();
in the wdInit of the custom controller i have:
    ICertFileElement certElement = wdContext.createCertFileElement();
    wdContext.nodeCertFile().bind(certElement);
     IWDAttributeInfo CattInfo = certElement.node().getNodeInfo().getAttribute("fileData");
     IWDModifiableBinaryType CbinaryType = (IWDModifiableBinaryType) CattInfo.getModifiableSimpleType();
     CbinaryType.setFileName("d:
temp
TestCert.cer");
and the same thing for the keyData attribute:
in the encodeFileData method i have
     BASE64Encoder enc64 = new BASE64Encoder();
     byte[] bCert = wdThis.wdGetContext().currentCertFileElement().getFileData();
     byte[] bKey =  wdThis.wdGetContext().currentCertFileElement().getFileData();
     String sCert =      enc64.encode(bCert);
     String sKey =      enc64.encode(bKey);
BUT THAT CODE IS NOT EXECUTED cause i get the error  just after the submit click and before the execution of the SubmitConfig action linked to the on action property of the button.

Yes, I solve that problem, the problem was the context variable had to be created and binded before it were used, the code was:
IInvoiceImgFileElement invImgFile = wdContext.createInvoiceImgFileElement();
wdContext.nodeInvoiceImgFile().bind(invImgFile);
thnks

Similar Messages

  • How to get file input stream from the client machine by JSF Fileupload API?

    Dear Friends,
    How to get the file input stream from the client machine by JSF HtmlFileupload or fileupload API. At present, if i execute the file upload code in the client machine, it is able to get the local path of the file and looking for the file in server machine. So i am getting FileNotFoundException.
    E.g., If a file is located at client machine at following location means "C:\Test\Test.txt",
    uploadClass.getFileuploadComponent().getFilename().toString() returns "C:\Test\Test.txt". But it is looking for that file in server and throwing FileNotFoundException.
    Please post your replies soon.
    Thanks,
    JP

    Depends on which version of JSF you're using. If JSF 1.2, I wouldn't even bother trying to hack this into JSF itself unless you can use something like Seam 2 or richfaces.
    http://docs.jboss.org/richfaces/latest_3_3_X/en/devguide/html/rich_fileUpload.html
    http://docs.jboss.org/seam/2.2.1.CR3/reference/en-US/html/controls.html#d0e29259 (look for s:fileUpload)
    But if I were you, a simple non-jsf form with a servlet works best for taking file uploads.
    As for JSF 2.0, there are other ways of getting it done.
    http://balusc.blogspot.com/2009/12/uploading-files-with-jsf-20-and-servlet.html

  • YouTube fileupload api error.

    Hello;
    I'm building a small site using YouTubes API system. I downloaded a YouTube.cfc from Ray Camden, and it works excellent. I am having an issue with a fileupload and the content I'm sending. It's outside the cfc function, it's the information I'm sending off to youtube. I've changed it around and I know it's my key words that is making it error. I am attaching the piece of code and the error
    Error:
    YouTubeCFC Upload Error: Domain=yt:validation, Code=invalid_value
    my code:
    <cfset yt = createObject("component", "youtube")>
    <cfset yt.setDeveloperKey("<my key>")>
    <cfset yt.login("<username>", "<password>")>
    <cfset r = yt.upload(expandPath('#uploadedfile#'),'#title#','#description#','Category','key,word')>
    The way this works is as follows:
    this form uploads the video to the server, then youtube takes it to their server so the uploaded file is the actual file that is being sent

    Hi,
    there is not a lot which can be done and independently from you I am using for my
    site [url=http://privatekrankenversicherungtestpkv.com/]PKV[/url]
    cfset yt = createObject("component", "youtube")> 
    <cfset yt.setDeveloperKey("<my key>")>
    <cfset yt.login("<username>", "<password>")>
    <cfset r = yt.upload(expandPath('#uploadedfile#'),'#title#','#description#','Category','keyword')>
    which is idenciral (like minds) ... and - no wonder
    I am receiving: domain=yt:validation, Code=invalid_value
    and I´d be grateful for someone who sees the beasty, tiny little thing which is wrong
    Have a nice day
    .... Wolfgang

  • PROBLEM IN INTERNET EXPLORER WITH THE  fileupload API

    i written a servlet to upload a file which will upload a file to a specific directory..............
    this program is working with opera or Mozilla browser.......but it is not working in internet explorer 8.
    i can not understand what is the problem..............
    code working with opera or Mozilla and also for other browser but not with explorer 8..
    my code is
    index.jsp is a welcome file which is used to select a file  which i want to upload
    index.jsp
    <html>
    <head><title>Upload page</title></head></p> <p><body>
    <form action="uploadFile" method="post" enctype="multipart/form-data" name="form1" id="form1">
    <center>
    <table border="2">
    <tr>
         <td align="center"><b>Multipale file Uploade</td>
         </tr>
    <tr>
         <td>
              Specify file: <input name="file" type="file" id="file">
         <td>     </tr>
         <tr>
         <td>
    <div align="center">
    <input type="submit" name="Submit" value="Submit files"/>
    </div></td>
    </table>
         <center>
    <p>
         </p>
    </form>
    </body>
    </html>
    uploadFile.java is servlet file which is used to upload the file in the specific location....
    the code of uploadFile.java is
    uploadFile.java
    import java.io.IOException;
    import java.util.Iterator;
    import java.lang.Object;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.util.List;
    import java.io.*;
    import java.io.File;
    import org.apache.commons.fileupload.servlet.ServletFileUpload;
    import org.apache.commons.fileupload.disk.DiskFileItemFactory ;
    import org.apache.commons.fileupload.*;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    public class uploadFile extends HttpServlet
    public void doPost(HttpServletRequest request,HttpServletResponse response)
    throws IOException,ServletException {
    HttpSession session=request.getSession();
    PrintWriter out=response.getWriter();
    ServletConfig config=getServletConfig();
    boolean isMultipart = ServletFileUpload.isMultipartContent(request);
    if(!isMultipart)
    else
         FileItemFactory factory = new DiskFileItemFactory();
         ServletFileUpload upload = new ServletFileUpload(factory);
         List items = null;
         try {
              items = upload.parseRequest(request);
         } catch (FileUploadException e) {
              e.printStackTrace();
         Iterator itr = items.iterator();
         while (itr.hasNext()) {
         FileItem item = (FileItem) itr.next();
         if (item.isFormField()) {
         } else {
              try {
                   String itemName = item.getName();
                   if(itemName.equals(""))
                   session.setAttribute("itemName",itemName);
                   response.sendRedirect("index.jsp");
                   File savedFile = new File(config.getServletContext().getRealPath("/")+"uploadedFiles/"+itemName);
                   item.write(savedFile);
                   out.println("Your file has been saved at the loaction:"+"\n"+config.getServletContext().getRealPath("/")+"uploadedFiles"+"\\"+itemName);
              } catch (Exception e) {
                   e.printStackTrace();
    Now i want to solve my problem in my code...............
    pleasde help me.............

    First of all, please do not shout in topic titles. It is rude.
    Secondly, please buy a new keyboard. Your dot key hangs all the time, it reads annoying.
    Back to your problem: did you read the FAQ available at the [FileUpload homepage|http://commons.apache.org/fileupload]? There´s something stated about a misbehaviour in IE and how to fix it using Commons IO. It is namely sending the complete client´s file path instead of only the file name.

  • Enctype header problem while using FileUpload

    Dear fouramites,
    I am using apache commans-fileupload1.1 api for uploading file to a servlet. For the file upload to take place I am using submit button and I am placing enctype header as form attribute. Doing so I could upload the file but the problem is, when I click on other tabs in the application(which were routed to different controller servlet) the request parameters themselves were not getting passed.
    If I use javascript function to send values to servlet it could not recognize enctype header so fileupload api is throwing exception
    Can any one plz help me out to resolve this situation.
    Thanks & Regards
    Kavya Kesineni

    Dear cc,
    Thanks for trying to help me. I resolved my problem but I dont know theory behind it. I am not using struts frame work. My application uses FrontController architecture.
    By request parameters I mean Hidden form fields. Not the values of hidden fields but the parameters themselves are not getting passed to controller if I use submit button in the form. If I use java script function to set values to hidden fields, headers were not getting passed.
    I solved the problem using onsubmit.
    Thanks alot
    kk

  • Unable get complete filepath from jsp page using request.getParameter()

    Hey all,
    i am actually trying to get the selected file path value using request.getParameter into the servlet where i will read the (csv or txt) file but i dont get the full path but only the file name(test.txt) not the complete path(C:\\Temp\\test.txt) i selected in JSP page using browse file.
    Output :
    FILE NAME : TEST
    FILE PATH : test.txt
    Error : java.io.FileNotFoundException: test.txt (The system cannot find the file specified)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.<init>(FileInputStream.java:106)
    at java.io.FileReader.<init>(FileReader.java:55)
    at com.test.TestServlet.processRequest(TestServlet.java:39)
    at com.test.TestServlet.doPost(TestServlet.java:75)
    JSP CODE:
    <%@page contentType="text/html" pageEncoding="UTF-8"%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>DEMO SERVLET</title>
    </script>
    </head>
    <body>
    <h2>Hello World!</h2>
    <form name="myform" action="TestServlet" method="POST"
    FILE NAME : <input type="text" name="filename" value="" size="25" /><br><br>
    FILE SELECT : <input type="file" name="myfile" value="" width="25" /><br><br>
    <input type="submit" value="Submit" name="submit" />
    </form>
    </body>
    </html>
    Servlet Code :
    protected void processRequest(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException, FileNotFoundException {
    response.setContentType("text/html;charset=UTF-8");
    PrintWriter out = response.getWriter();
    try {
    String filename = request.getParameter("filename");
    out.println(filename);
    String filepath = request.getParameter("myfile");
    out.println(filepath);
    out.println("<html>");
    out.println("<head>");
    out.println("<title>Servlet TestServlet</title>");
    out.println("</head>");
    out.println("<body>");
    out.println("<h1>Servlet TestServlet at " + request.getContextPath() + "</h1>");
    if (filepath != null) {
    File f = new File(filepath);
    BufferedReader br = new BufferedReader(new FileReader(f));
    String strLine;
    String[] tokens;
    while ((strLine = br.readLine()) != null) {
    tokens = strLine.split(",");
    for (int i = 0; i < tokens.length; i++) {
    out.println("<h1>Servlet TestServlet at " + tokens[i] + "</h1>");
    out.println("----------------");
    out.println("</body>");
    out.println("</html>");
    } finally {
    out.close();
    protected void doPost(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
    processRequest(request, response);
    Needed Output :
    FILE NAME : TEST
    FILE PATH : C:\\Temp\\test.txt
    Any suggestions Plz??

    As the [HTML specification|http://www.w3.org/TR/html401/interact/forms.html] states, you should be setting the enctype to multipart/form-data to be able to upload files to the server. In the server side, you need to process the multipart/form-data binary stream by parsing the HttpServletRequest#getInputStream(). It is a lot of work to get it to work flawlessly. There are 3rd party API's around which can do that for you, such as [Apache Commons FileUpload|http://commons.apache.org/fileupload] (carefully read the User Guide how to use it).
    You can also consider to use a Filter which makes use of the FileUpload API to preprocess the request so that you can continue writing the servlet code as usual. Here is an example: [http://balusc.blogspot.com/2007/11/multipartfilter.html].

  • How to retrieve data from a jsp page

    I have created a page with some text boxes, file, submit button. In my Ist jsp, i am dynamically add Text boxes and File (for Uploading).
    In the 2nd jsp, i am used Jakarata FileUpload API. I am able to retrieve all data and files except that value of dynamicall added text boxes. That is, I cannot retrieve data from dynamically added text boxes.
    Using Jakarata FileUpload API, i can retrieve values of form data using
    getString() method.
    I want to know that there is any way or method for retrieving form data values into String Array.
    regards
    madhu
    [email protected]

    Use parseRequest(request) to get the file information as you already are doing. However, I dont know how you can use request.getParameter("textField1") to get the other fields from the page. My work-around is as follows:
    Change your submit button to an ordinary button and add an onClick event to it. Then in the javascript function that supports the onClick, add the textField1 as follows:
    <form name="fileUploadForm" method="post" action="someAction" (((more code code here)))))
    function submitButtonClick(){
    document.fileUploadForm.action=
    document.fileUploadForm.action+
    "?textField1="+document.fileUploadForm.textField1.value"+
    "&textField2="+document.fileUploadForm.textField2.value"+
    "&textField3="+document.fileUploadForm.textField3.value";
    document.fileUploadForm.submit();
    As you can see in the above code, I append the textField1 name/value pair to the end of the action. Now in the server, you can use getParameter("textField1");

  • Saving image in ms sql database.

    Hi all, i have a problem saving image in the database.i used
    request.getParameter("imagename"), to get the content of the textfield in the html file but the problem is that it omits the filepath and gives me just the image name and that gives me an error.. Pls help me

    Your actual problem is less or more web browser related. The right way is that the browser should only send the filename, but a certain widely used browser developed by a team in Redmond would send the full file path as it is at the client side, which is completely wrong.
    The bigger picture what you're trying to achieve, uploading a file from the client to the server, shouldn't be done that way, simply because this isn't going to work at all if the client runs at a completely different machine on the other side of the network than where the server runs. You need to send the actual file contents to the server. Just set the form's enctype to multipart/form-data and parse the body of the request to get the actual file contents. To ease the work I recommend you to use Apache Commons FileUpload API for parsing the multipart/form-data request. Go to their homepage and check out the 'User guide' and 'Frequently Asked Questions' how to use it and for some tricks.

  • URGENT:PLEASE TELL ME HOW TO RUN BOTH "ITEXT & MYFACES1.0" TOGETHER?

    URGENT: HELP PLEASE. ITEXT AND MYFACES1.0.9 COMBINATION USE BLOCKS THE PDF GENERATED ITEXT.
    We are using ITEXT for PDF report generation in JSF web appliaction, We needed to implement the Fileupload, we tried both MYFACES1.0.9 and TOMAHAWK, both ways we also got the file uploading working. For this we needed to add the filter in the web.xml file ( <filter-name>ExtensionsFilter</filter-name> as below). NOW by doing this, it BLOCKS THE PDF OUTPUT OF THE ITEXT and the result in sumthing like corrupted PDF is spitted in the browser (%PDF-1.4 %âãà Ó 2 0 obj <>stream ÿØÿà JFIF� �`�`�ï¿................................................)
    When i remove the MYFACES1.0.9 only then the good PDF output is viewable in the BROWSER.
    PLEASE TELL ME HOW TO RUN BOTH ITEXT(for pdf report) and MYFACES1.0.9 (for fileuploading) TOGETHER?????
    ========================
    <?xml version = '1.0' encoding = 'windows-1252'?>
    <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee">
    <description>Empty web.xml file for Web Application</description>
    <servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.faces</url-pattern>
    </servlet-mapping>
    <session-config>
    <session-timeout>35</session-timeout>
    </session-config>
    <mime-mapping>
    <extension>html</extension>
    <mime-type>text/html</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>txt</extension>
    <mime-type>text/plain</mime-type>
    </mime-mapping>
    <filter>
    <filter-name>ExtensionsFilter</filter-name>
    <filter-class>
    org.apache.myfaces.component.html.util.ExtensionsFilter
    </filter-class>
    <init-param>
    <param-name>uploadMaxFileSize</param-name>
    <param-value>10m</param-value>
    </init-param>
    <init-param>
    <param-name>uploadThresholdSize</param-name>
    <param-value>100k</param-value>
    </init-param>
    </filter>
    <filter-mapping>
    <filter-name>ExtensionsFilter</filter-name>
    <servlet-name>Faces Servlet</servlet-name>
    </filter-mapping>
    </web-app>
    ========================

    calm down!
    You always have the option of dumping the file uploading component and just using the Apache FileUpload API in a servlet - then you'll have full control over what happens when without any additional configuration needed.

  • How to send data (file and text both) from jsp to servlet

    upload JSP 
    case 1>> if i am using this  <form enctype="multipart/form-data" the file value is comming on the servlet side
             and other vales are not comming when i am using request.get parameter(....);
    case 2>>  if i am using this <form  type="text/html" the "submissionperiod" and "Types" value is comming on the servlet but the file is not comming ........
         How to resolve this issue .  i need to send all the three parameter on single submit and retrieve the parameter values  in my servlet .
    please help !
    <form enctype="multipart/form-data" name="form" method="post" action="Upload" >
                    <table font size="3" style="color:brown;font-family:Arial" >
                    <tr>
                    <td>Submission Year:    </td>
                    <td><select  name="submissionperiod">
                         <option value="">--select--</option>
                         <option value="2000">2000</option>
                         <option value="2001">2001</option>
                         <option value="2002">2002</option>
                         <option value="2003">2003</option>
                         <option value="2004">2004</option>
                         <option value="2005">2005</option>
                         <option value="2006">2006</option>
                         <option value="2007">2007</option>
                         <option value="2008">2008</option>
                         <option value="2009">2009</option>
                    </select><label class="Required">*</label></br></td>
                    </tr>
                    <tr>
                    <td>Submission Type :    </td>
                    <td><select  name="types"   onchange="showDescription()">
                         <option value="">--select--</option>
                         <option value="CRF">CRF</option>
                         <option value="NIR">NIR</option>
                         <option value="NC">NC</option>
                         <option value="SEF">SEF</option>
                    </select><label class="Required">*</label></br></td>
                   </tr>
                   <tr><td></td><td>
                   <div id="divTypeDetails">
                    <textarea  id= "subTypeDes" name="subTypeDes"  value=""></textarea></br></br>
                  </div>
                  </td>
              </table>     
              <td>Select a file (< 100 MB):   </td>
              <td><input id="importFile" name="importFile" type="file"></br>          
              </td>
              <input type="hidden" name="types">
              <input type="hidden" name="submissionperiod">
              <input type="submit" id="submitButton" name="submit" value="Upload" onclick = "checkUploadValidity();"/>
              <input type="button" name=btncancel id=btncancel value="cancel" onclick= "btncancel_click()"/>
    </form> 

    Both the file and text values are included in the binary inputstream of the request. The parametermap is always empty.
    There exist 3rd party API's to parse multipart/form-data streams, such as [Apache Commons FileUpload API|http://commons.apache.org/fileupload].
    Read at least the 'User Guide' and 'Frequently Asked Questions' sections.

  • Upload file using jsp

    hi all i am trying a code that uploads file to the server using jsp the code goes like this
    <%@ page import = "java.io.*" %>
    <%
    String contentType = request.getContentType();
    String file = "";
    String saveFile = "";
    FileOutputStream fileOut = null;
    if((contentType!=null)&&(contentType.indexOf("multipart/form-data")>=0))
       DataInputStream in = new DataInputStream(request.getInputStream());
       int formDataLength = request.getContentLength();
       byte dataBytes[] = new byte[formDataLength];
       int byteRead = 0;
       int totalBytesRead = 0;
       while(totalBytesRead<formDataLength)
          byteRead = in.read(dataBytes,totalBytesRead,formDataLength);
          totalBytesRead +=byteRead;
       try
          file = new String(dataBytes);
          saveFile= file.substring(file.indexOf("filename=\"")+10);
          saveFile = saveFile.substring(0,saveFile.indexOf("\n"));
          saveFile =
          saveFile.substring(saveFile.lastIndexOf("/")+1,saveFile.indexOf("\""));
          int lastIndex = contentType.lastIndexOf("=");
          String boundary =
          contentType.substring(lastIndex+1,contentType.length());
          int pos;
          pos = file.indexOf("filename=/" +1);
          pos = file.indexOf("\n",pos)+1;
          pos = file.indexOf("\n",pos)+1;
          pos = file.indexOf("\n",pos)+1;
          int boundaryLocation = file.indexOf(boundary,pos) - 4;
          int startPos = ((file.substring(0,pos)).getBytes()).length;
          int endPos =
          ((file.substring(0,boundaryLocation)).getBytes()).length;
          String folder = "07ics01/jsp/"; //is this the folder where i intend to save the file?
          fileOut = new FileOutputStream(folder + saveFile);
          fileOut.write(dataBytes);
          fileOut.write(dataBytes,startPos,(endPos-startPos));
          fileOut.flush();
       catch(Exception e)
          out.println(e);
       finally
          try
             fileOut.close();
          catch(Exception err)
    %> i have been trying to use this code but i can't understand the code. is String folder = "07ics01/jsp" the folder where i intend to save the page on the server? because when i do that i get an exception like
    java.io.FileNotFoundException: 07ics01/jsp/C:\Documents and Settings\s9sharma\Desktop\tt\commons-digester-1.8\commons-digester-1.8.jar (No such file or directory) where C:\Documents and Settings\s9sharma\Desktop\tt\commons-digester-1.8\commons-digester-1.8.jar is the file i am trying to upload to the directory 07ics01/jsp which is a unix directory.
    Can anyone please help..

    So you've copypasted this code from somwhere and are expecting our support on the code, instead of the author's support? That's sad.
    I recommend you to look to the Apache Commons FileUpload API [1]. Then you don't need to write (or copypaste) a multipart parser yourself. Putting business logic in JSP files is also bad practice by the way. Use Java classes for it instead (Servlets, Filters, Beans, Utilityclasses, etc).
    [1] http://commons.apache.org/fileupload/
    To understand the actual code, it might help a lot to first read and understand the HTML spec about multipart request data and read the API documentations of the Java classes involved, e.g. the java.io API.

  • ServletFileUpload.parseRequest return empty list in Struts 1.3?

    I used ServletFileUpload.parseRequest(request) to get my list of items, with Struts 1.3, JBoss 4.2.2GA(migrated from JBoss 4.0.5GA) I am using JDK 1.5, on myEclipse 6.6 ( migrated from myEclipse 5.5.1GA).
    My file upload application used to work and ServletFileUpload.parseRequest(request) used to return non empty results as a List<FileItem>. I am not sure ( that's the frustrating part) what has changed, but now I am getting a empty list!
    I have switched to previous version of JBoss 4.0.5.GA, and myEclipse 5.5.GA and still it didn't work. I know what I need to have for this to work, i.e. :
    JSTL tag in JSP:
    <html:form enctype="multipart/form-data"....>
    <html:file styleId="uploadFile" property="uploadFile" size="40" />
    My FormBean has uploadFile as FormFile and getter and setter for it.
    I wrote a Utility class to include this apache commons fileupload API and my action class calls the Util class.
    The Util class looks like this:
    DiskFileItemFactory factory = new DiskFileItemFactory();
    ServletFileUpload upload = new ServletFileUpload(factory);
    List<FileItem> items = (List<FileItem>) upload.parseRequest(request);
    Like I said, items used to return non-empty results and I was uploading file just fine. I am using Struts 1.3, Spring 2.0, which hasn't changed. And even though my myEclipse and JBoss version changed, I did revert back to the previous version just to test them and still am getting empty list.
    I am pulling my hair out on this, I'd really appreciate any input and if you need more info, I'd be happy to replenish them!
    Thanks in advance!

    The current release BEA Workshop 3.2 (build 569), does not bundle Struts 1.3.5 and is also not aware of Struts 1.3 release.
    However, this should not stop you from manually importing the Struts 1.3 libraries or samples into Workshop.
    Preferences | Workshop Studio Facet Libraries | Struts Libraries, is used by the New Web app and Project Facet wizard to import the libraries on creation. Instead you can manually copy/overwrite Struts 1.3 libraries in your existing Struts project.We will keep you posted on the 1.3 support release.

  • Commons HTTPClient : Sending file as well as parameters

    Hi,
    I want to send some parameters as well as a file in request body. I have been doing this via PostMethod by Commons HTTPClient.
    Client Code:
              HttpClient client = new HttpClient();
                   PostMethod method = new PostMethod("http://localhost:7080/exchange/receive");
                   //Parameters
                   method.addParameter("username","test");
                   method.addParameter("password","a311xhq23");
                   //File
                   String strXML = FileTest.readTextFile("C:/in.xml");
                   method.setRequestBody(strXML);
                   int statusCode = client.executeMethod(method);
                   if (statusCode != HttpStatus.SC_OK) {
                        System.err.println("Method failed: " + method.getStatusLine());
                   String responseString = method.getResponseBodyAsString();
                   System.out.println("Response : \n\n"+responseString);Server Code:
                    String username = request.getParameter("username");
                  System.out.println("Username : "+username);
              InputStream is = request.getInputStream();
              byte buf[]=new byte[1024];
              int len;
              OutputStream out = new FileOutputStream(new File("c:/out.xml"));
              while((len=is.read(buf))>0)
                     out.write(buf,0,len);
              out.close();
              is.close();Here the file is written successfully but request parameters are null. What could be the issue?
    Is it right way to send both parameters as well as file?
    In http client I haven't specify content type. So what will be default content type? is it multipart request?
    Thank is advance.
    Regards,
    Amit
    Edited by: amit_patel_java on Apr 14, 2010 11:38 PM

    I'd say your setRequestBody() call is overwriting the parameters. Read the javadocs of the API to get more details about how they work.
    What you are trying to mimic is a multipart request, where you can send a file as part of the request to the server. HttpClient should have capabilities to do a multipart request, and on the server side you can use the FileUpload API to read the file and the parameters back.
    [http://hc.apache.org/httpclient-3.x/methods/multipartpost.html|http://hc.apache.org/httpclient-3.x/methods/multipartpost.html]
    [http://commons.apache.org/fileupload/using.html|http://commons.apache.org/fileupload/using.html]

  • Upload a PDF file

    Hi all,
    I have post url and PDF file path
    how do i upload pdf file. As i did in .net like
    webclient.UploadFile(posturl,pdfpath);
    please let me know if nay body has an idea
    thanks
    Naveen

    Use Commons-FileUpload API.

  • Help on file upload

    Hello,
    I am using apache fileupload and have following code.
    DiskFileItemFactory factory = new DiskFileItemFactory();
    ServletFileUpload upload = new ServletFileUpload(factory);
    List items = new ArrayList() ;
    try {
         items = upload.parseRequest(request);
    } catch (FileUploadException fue) {
         System.out.println("Error uploading file: " + fue.toString());
         fue.printStackTrace();
    Iterator iter = items.iterator();
    while (iter.hasNext()) {
         FileItem item = (FileItem) iter.next();
         if (!item.isFormField()) {
              String name = item.getFieldName();
              String value = item.getString();
         } else {
              String name = item.getFieldName();
              String value = item.getString();
         System.out.println("Found field " + name + " and value " + value) ;
    I get the following error when I run it. The error is pointing to code underlined (_ServletFileUpload upload = new ServletFileUpload(factory);_). I have all apache required files as part of WEB_INF/lib. As you see the error is pointing to NoSuchMethodError. I wonder if any one one come across this error and how was it resolved. I appreciate your help.
    Error 500--Internal Server Error
    java.lang.NoSuchMethodError: org.apache.commons.fileupload.FileUpload.<init>(Lorg/apache/commons/fileupload/FileItemFactory;)V
         at org.apache.commons.fileupload.servlet.ServletFileUpload.(ServletFileUpload.java:105)
         at com.freeman.hr.bean.FileUpload.doPost(FileUpload.java:42)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1072)
         at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:465)
         at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:348)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6981)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
         at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
         at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3892)
         at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2766)
         at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:224)
         at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:183)
    Thank you,
    Balaji

    java.lang.NoSuchMethodError: org.apache.commons.fileupload.FileUpload.<init>(Lorg/apache/commons/fileupload/FileItemFactory;)V
         at org.apache.commons.fileupload.servlet.ServletFileUpload.(ServletFileUpload.java:105)Doublecheck the JAR's in all classpaths. There are somewhere two JAR's of the FileUpload API but they are from different versions. Your code is compiled against the right version, but runt against the wrong version where this method is missing. Start checking the classpath of the application server.

Maybe you are looking for

  • ITunes Match no longer works

    Hello, I've been using iTunes Match since it came out and it was perfect ! Until ... Tuesday. Like every week I've been adding new music to my library and then send it to the cloud throught iTunes Match. But for some reasons the sync failed. So I did

  • Problems with Page Break in an Interactive Reporting report

    Hello everybody, Platform: Hyperion System 9.3.1. I have serious problems in managing the 'page break' in an Interactive Reporting report. The report shows sales data by store, with article and colour details and it is organized like this: group 1: g

  • Error raising new Leave Request

    Hi guys, Some of our users are trying to raise a leave request in ESS and getting an error Use the input help to select an approver. The only change that has happened is that we recently upgraded from ECC 5.0 to ECC 6.0. Other than that there has bee

  • Transport tablespace related problem

    Hi all, I have a problem i want to export tablespaces as i have to migrate my db from oracle 9.2 to oracle 10.2 from win to RHEL4.......but i am getting an error ,pls suggest me for the same.... SQL> @G:\oracle\ora92\rdbms\admin\dbmsplts.sql; Package

  • Problems with my Airport Snow. Please someone help!

    I had an airport snow base station for a couple of years. I bought it used, and after some initial difficulty, I manage to set it up and it worked fine for a little while. At some point it started failing to connect and started giving me a message th