Return-Path: Delivered-To: apmail-struts-user-archive@www.apache.org Received: (qmail 22383 invoked from network); 10 Sep 2009 05:05:33 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 10 Sep 2009 05:05:33 -0000 Received: (qmail 69852 invoked by uid 500); 10 Sep 2009 05:05:30 -0000 Delivered-To: apmail-struts-user-archive@struts.apache.org Received: (qmail 69808 invoked by uid 500); 10 Sep 2009 05:05:30 -0000 Mailing-List: contact user-help@struts.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Struts Users Mailing List" Reply-To: "Struts Users Mailing List" Delivered-To: mailing list user@struts.apache.org Received: (qmail 69798 invoked by uid 99); 10 Sep 2009 05:05:30 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 10 Sep 2009 05:05:30 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of kenshin520@gmail.com designates 209.85.210.194 as permitted sender) Received: from [209.85.210.194] (HELO mail-yx0-f194.google.com) (209.85.210.194) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 10 Sep 2009 05:05:21 +0000 Received: by yxe32 with SMTP id 32so8023568yxe.23 for ; Wed, 09 Sep 2009 22:05:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type; bh=DM9vNNX4y/oaXLCx6W948wPNI6FjTV9+1iXg3m5ZP4c=; b=lBbO5eUwvrk7ve/AKeSEFmn0RaKqw3cCA+o7x5MgseUQnssJpVizqvGLUBckK/A2bl vRmyHMl/2QUbwAZvKwcSnMh3XupdLIfoRpBSSDGGsUNB2d9wh4jfT1iQaQ8q/uyMN5N4 O4nHWTzDdnNFA6Y3y2D6A6DR5MaN3igc9XG/Y= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=Jw8/81GicHkABIpJG3nZvMKGCCXhXjRbCuVGjYodn2Rnu32cu8Fr0j2WVa1Mh1opP5 Zn7aFeDvfAW0xSRRRlJMy4vyWQQcCBhNL6Clsg+TqXNwwsgQTajjKCnvTxNEtsfIP25T 9bg/TagjmZ/Ltfj1R7mXZoIH5Z8+tLxnwXQ40= MIME-Version: 1.0 Received: by 10.150.44.28 with SMTP id r28mr1974375ybr.36.1252559100049; Wed, 09 Sep 2009 22:05:00 -0700 (PDT) In-Reply-To: <25377242.post@talk.nabble.com> References: <25377242.post@talk.nabble.com> Date: Thu, 10 Sep 2009 13:04:59 +0800 Message-ID: Subject: Re: uploading a .xls file From: Steven Yang To: Struts Users Mailing List Content-Type: multipart/alternative; boundary=000e0cd5f0fe381f580473322407 X-Virus-Checked: Checked by ClamAV on apache.org --000e0cd5f0fe381f580473322407 Content-Type: text/plain; charset=ISO-8859-1 are u getting anything from the uploadContent? because i think i should be File file String fileContentType String fileFileName On Thu, Sep 10, 2009 at 12:50 PM, KIRTI CHOPRA wrote: > > 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"%> > > >
> >
> theme="simple"> > > > > > > > >
> >
label="upload xls" align="left" cssStyle="margin-left:100px;"/>
>
>
>
> > -- > 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-unsubscribe@struts.apache.org > For additional commands, e-mail: user-help@struts.apache.org > > --000e0cd5f0fe381f580473322407--