aspose file tools
The moose likes Struts and the fly likes Why my action class in not executing? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Why my action class in not executing?" Watch "Why my action class in not executing?" New topic

Why my action class in not executing?

Priyanka Das

Joined: Mar 01, 2011
Posts: 15

This is my struts-configfilecode
<forward name="success" path="/FileUploadandDownload.jsp"></forward>

this is my action class
package com.ochre.ewash.hfodetails.web.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.log4j.Logger;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.util.LabelValueBean;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.*;
import org.apache.struts.upload.FormFile;
//import org.apache.commons.fileupload.FileItemFactory;

import java.util.*;

import com.ochre.ewash.hfodetails.web.form.*;
import com.ochre.ewash.hfodetails.viewhelper.*;

import org.apache.struts.upload.FormFile;
* @author

* Struts File Upload Action Form.
public class FileUploadandDownloadAction extends Action {
private static Logger LOG = Logger .getLogger(FileUploadandDownloadAction.class);
public ActionForward execute(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws Exception{"Inside Action");
FileUploadandDownloadForm myForm = (FileUploadandDownloadForm)form;
// Process the FormFile
FormFile myFile = myForm.getTheFile();
String contentType = myFile.getContentType();
String fileName = myFile.getFileName();
int fileSize = myFile.getFileSize();
byte[] fileData = myFile.getFileData();
System.out.println("contentType: " + contentType);
System.out.println("File Name: " + fileName);
System.out.println("File Size: " + fileSize);

return mapping.findForward("success");

Please reply as soon as possible.

Thanks in advance..
Christophe Verré

Joined: Nov 24, 2005
Posts: 14688

Please reoply as soon as possible.

Please EaseUp.

And take some time to UseCodeTags to make all this code more readable.

[My Blog]
All roads lead to JavaRanch
sri ramvaithiyanathan
Ranch Hand

Joined: Nov 20, 2010
Posts: 109
can you please show your FileUploadandDownload.jsp file to us.
use code tag properly.


For java examples,ebooks,interview questions,visit this blog
Priyanka Das

Joined: Mar 01, 2011
Posts: 15
Rajagopal Mani
Ranch Hand

Joined: Mar 24, 2011
Posts: 84

Please check the action class path in struts-config.xml and action class package are different.

In struts-config.xml,

In action class,
It is sorta covered in the JavaRanch Style Guide.
subject: Why my action class in not executing?
It's not a secret anymore!