Results 1 to 7 of 7

Thread: HTTP Status 404

  1. #1
    prasanthi is offline Member
    Join Date
    May 2013
    Posts
    5
    Rep Power
    0

    Default HTTP Status 404

    Hi
    I am working with tomcat 7.0.39 and i m facing HTTP Status 404 error while uploading a file.
    And i am getting like

    type Status report

    message /APM/fileupload.jsp

    description The requested resource is not available.

    how can i solve this please help me in it...

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,224
    Rep Power
    20

    Default Re: HTTP Status 404

    Where is that resource?
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  3. #3
    prasanthi is offline Member
    Join Date
    May 2013
    Posts
    5
    Rep Power
    0

    Default Re: HTTP Status 404

    fileUpload.jsp

    <body>
    <h1>Struts 2 &lt;s:file&gt; file upload example</h1>

    <s:form action="resultAction" namespace="/"
    method="POST" enctype="multipart/form-data">

    <s:file name="fileUpload" label="Select a File to upload" size="40" />

    <s:submit value="submit" name="submit" />

    </s:form>

    </body>

    Struts.xml

    <action name="resultAction" class="com.exe.FileUpload">
    <interceptor-ref name="exception" />
    <interceptor-ref name="i18n" />
    <interceptor-ref name="fileUpload">
    <param name="allowedTypes">application/octet-stream</param>
    <param name="maximumSize">10240</param>
    </interceptor-ref>
    <interceptor-ref name="params">
    <param name="excludeParams">dojo\..*,^struts\..*</param>
    </interceptor-ref>
    <interceptor-ref name="validation">
    <param name="excludeMethods">input,back,cancel,browse</param>
    </interceptor-ref>
    <interceptor-ref name="workflow">
    <param name="excludeMethods">input,back,cancel,browse</param>
    </interceptor-ref>
    <result name="success">/uploadSuccess.jsp</result>
    <result name="input">/fileupload.jsp</result>
    </action>


    fileuploadAction.java

    int flag = 0;
    int flag1 = 0;
    private static final long serialVersionUID = 1L;
    private File fileUpload;
    private String fileUploadContentType;
    private String fileUploadFileName;

    public String getFileUploadContentType() {
    return fileUploadContentType;
    }

    public void setFileUploadContentType(String fileUploadContentType) {
    this.fileUploadContentType = fileUploadContentType;
    }

    public String getFileUploadFileName() {
    return fileUploadFileName;
    }

    public void setFileUploadFileName(String fileUploadFileName) {
    this.fileUploadFileName = fileUploadFileName;
    }

    public File getFileUpload() {
    return fileUpload;
    }

    public void setFileUpload(File fileUpload) {
    this.fileUpload = fileUpload;
    }

    @SuppressWarnings("static-access")
    public String execute() throws Exception {
    System.out.println("in execute....");
    try {
    List<Employee> empList = new ArrayList<Employee>();
    File f = getFileUpload();
    FileInputStream file = new FileInputStream(f);
    System.out.println("f....." + f);
    System.out.println("file...." + file);
    System.out.println(f.getAbsolutePath());
    HSSFWorkbook workbook = new HSSFWorkbook(file);
    System.out.println("workbook....");
    HSSFSheet sheet = workbook.getSheetAt(0);
    Iterator<Row> rowIterator = sheet.iterator();

    while (rowIterator.hasNext()) {
    if (flag == 0) {
    rowIterator.next();
    flag = 1;

    }
    Row row = rowIterator.next();
    Employee employee = new Employee();
    List<Object> cellList = new ArrayList<Object>();
    empList.add(employee);
    Iterator<Cell> cellIterator = row.cellIterator();
    while (cellIterator.hasNext()) {
    Cell cell = cellIterator.next();
    // employee.setEmpId(cell.getStringCellValue());
    switch (cell.getCellType()) {
    case Cell.CELL_TYPE_BOOLEAN:
    cellList.add(cell.getBooleanCellValue());
    // System.out.print(cell.getBooleanCellValue() +
    // "\t\t");
    break;
    case Cell.CELL_TYPE_NUMERIC:
    cellList.add(cell.getNumericCellValue());
    // System.out.print(cell.getNumericCellValue() +
    // "\t\t");
    break;
    case Cell.CELL_TYPE_STRING:
    // System.out.print(cell.getStringCellValue() + "\t\t");
    cellList.add(cell.getStringCellValue());
    // for(String s:cellList){ System.out.println(s); }
    break;
    }
    }


    this is the code that i wrote to upload the excel sheet

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,224
    Rep Power
    20

    Default Re: HTTP Status 404

    No, where is the jsp physically located?
    Because Tomcat can't find it.

    Also, when posting code, please wrap it in [code] tags [/code] so it retains its formatting.

    Note that the error says this:
    /APM/fileupload.jsp
    And according to your post, the file is called this:
    fileUpload.jsp
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  5. #5
    prasanthi is offline Member
    Join Date
    May 2013
    Posts
    5
    Rep Power
    0

    Default Re: HTTP Status 404

    the jsp source file in

    APM\WebContent folder

  6. #6
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,224
    Rep Power
    20

    Default Re: HTTP Status 404

    Look at the name, though.
    Java is case-sensitive.

    Your error says fileupload.jsp and your file is called fileUpload.jsp.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  7. #7
    prasanthi is offline Member
    Join Date
    May 2013
    Posts
    5
    Rep Power
    0

Similar Threads

  1. Replies: 3
    Last Post: 10-15-2012, 12:53 PM
  2. http status 500
    By sudha333 in forum Advanced Java
    Replies: 11
    Last Post: 05-09-2011, 03:41 PM
  3. HTTP Status 500 -
    By aiesha in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 03-23-2011, 05:16 AM
  4. http://localhost:8080/helloservice/HelloService?Tester HTTP Status 404 -
    By vietnamusa in forum Enterprise JavaBeans (EJB)
    Replies: 0
    Last Post: 03-13-2011, 01:02 AM
  5. Replies: 7
    Last Post: 11-11-2009, 09:29 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •