Re: how to read the contents of uploaded file

2009-09-10 Thread KIRTI CHOPRA

Thank you so much

-kirti
-- 
View this message in context: 
http://www.nabble.com/how-to-read-the-contents-of-uploaded-file-tp25384149p25395100.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



how to read the contents of uploaded file

2009-09-10 Thread KIRTI CHOPRA

hi all
can you please help me with how can i start with how i can read the content
of the file uploaded using struts 2.0 and display them in jsp in table
format.

since i am new to struts i am not able to think of where should i start from
and for saving that uploaded file i should give which path real or absolute
-- 
View this message in context: 
http://www.nabble.com/how-to-read-the-contents-of-uploaded-file-tp25384149p25384149.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: uploading a .xls file

2009-09-10 Thread KIRTI CHOPRA

Thank you so much for the help!!!
-- 
View this message in context: 
http://www.nabble.com/uploading-a-.xls-file-tp25377242p25383919.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



how to save uploaded file

2009-09-10 Thread KIRTI CHOPRA

hi 
i have uploaded file successfully but i am now trying to save the file using
following code it is not taking FileUtils and pls suggest if there is any
other alternative.
import static java.io.File.separator;
 import java.io.File;
 import java.lang.Object;
 import java.text.MessageFormat;

  import org.apache.commons.io.FileUtils
;
 import com.sun.deploy.cache.Cache;


/**
 * Created by IntelliJ IDEA.
 * User: Owner
 * Date: Sep 9, 2009
 * Time: 10:22:18 AM
 * To change this template use File | Settings | File Templates.
 */
public class UploadXlsAction extends BaseAction {
private File file;
private String fileFileName;
private String fileContentType;
private UploadXlsAction upload;


public File getFile() {
return file;
}

public void setFile(File file) {
this.file = file;
}

public String getFileFileName() {
return fileFileName;
}

public void setFileFileName(String fileFileName) {
this.fileFileName = fileFileName;
}

public String getFileContentType() {
return fileContentType;
}

public void setFileContentType(String fileContentType) {
this.fileContentType = fileContentType;
}

public String execute() throws Exception{
this.file=getFile();
this.fileFileName=getFileFileName();
String filepath=file.getAbsolutePath();
System.out.println(file+fileFileName);
return "success";
}
public void uploaded(File file, String fileName){
   /*  File dir = new File(directoryName);
 if (!dir.exists()) {
 dir.mkdir();
 }*/
 String targetPath = MessageFormat.format("C:/Program Files/Apache
Software Foundation/Tomcat
5.5/webapps/jnewsletter/WEB-INF/classes/com/neevtech/newsletter/resources{0}{1}",
File.separator, fileName);
 File fileDestination = new File(targetPath);
try{
  FileUtils fl=new FileUtils();
 fl.copyFile(file, fileDestination);
}catch(Exception e)
{
System.out.println(e);
}

}

}
-- 
View this message in context: 
http://www.nabble.com/how-to-save-uploaded-file-tp25381036p25381036.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: uploading a .xls file

2009-09-10 Thread KIRTI CHOPRA

Thank you so much but  can you please tell me how can i save the uploaded
file
-- 
View this message in context: 
http://www.nabble.com/uploading-a-.xls-file-tp25377242p25378975.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: uploading a .xls file

2009-09-09 Thread KIRTI CHOPRA

hi
but does it make any difference it is just variable name if i am not wrong
but i am not sure about it also
please let me know if it makes any difference.

Thanks!!!
-- 
View this message in context: 
http://www.nabble.com/uploading-a-.xls-file-tp25377242p25377629.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



uploading a .xls file

2009-09-09 Thread KIRTI CHOPRA

hi all
i am new to struts and trying to upload a file in struts 2.0
i am using  tag and have given simple getter setters in action class
i am getting null value in file name pls help and let me know how i can do
it.
code is given below:
Action class

package com.neevtech.newsletter.action;

 import java.io.File;

/**
 * Created by IntelliJ IDEA.
 * User: Owner
 * Date: Sep 9, 2009
 * Time: 10:22:18 AM
 * To change this template use File | Settings | File Templates.
 */
public class UploadXlsAction extends BaseAction {
private File file;
private String uploadContent;
private String fileName;

public String execute() throws Exception
{
this.file=getFile();
this.fileName=getFileName();
/*String filepath=file.getAbsolutePath();
System.out.println(filepath);*/
System.out.println(fileName);
return "success";
}
public File getFile() {
return file;
}

public void setFile(File file) {
this.file = file;
}

public String getUploadContent() {
return uploadContent;
}

public void setUploadContent(String uploadContent) {
this.uploadContent = uploadContent;
}

public String getFileName() {
return fileName;
}

public void setFileName(String fileName) {
this.fileName = fileName;
System.out.println(fileName);
}

public String uploaded(){
this.file=getFile();
this.fileName=getFileName();
 System.out.println(fileName);
return "success";
}

}
Jsp page

<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib uri="http://java.sun.com/jstl/core"; prefix="c"%>












 
 
 





-- 
View this message in context: 
http://www.nabble.com/uploading-a-.xls-file-tp25377242p25377242.html
Sent from the Struts - User mailing list archive at Nabble.com.


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