• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem with Form File

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using a Form File for file Upload in my application.In this i am getting a strange problem.

Input.jsp

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%@ page contentType="text/html;charset=windows-1252"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<html:form action="/LoadPowerForecast" method="post" enctype="multipart/form-data"> </html:form>
External Power Forecast Data File : <html:file property="theFile"/></[/b]td>
   
<html:submit property="method"><bean:message key="LoadPower.Load"/></html:submit>


Form Bean:
package com.ngt.wpfs.forms;

import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.upload.FormFile;


public class LoadPowerForm extends ActionForm {
private FormFile theFile;
public void setTheFile(FormFile theFile) {
this.theFile = theFile;
}

public FormFile getTheFile() {
return theFile;
}
}

By clicking "Load" submit button,all the data is submitted and then processing is done in Action Class and the action class will forward back it input.jsp. But while displaying input.jsp from action class the file name which i have selected earlier is not showing in input.jsp .




 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Consider turning off HTML and USeCodeTags... surely you can see that something went wrong?
 
naveen chedella
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have removed unneccessary HTML tags and still it does not work....

Modeified Input.jsp

Input.jsp

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<%@ page contentType="text/html;charset=windows-1252"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>

<html:form action="/LoadPowerForecast" method="post" enctype="multipart/form-data">


<html:file property="theFile"/></td>


<html:submit property="method"><bean:message key="LoadPower.Load"/></html:submit>

</html:form>

 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
See the "Disable HTML" checkbox? Check it, in a new post, with the real code.
 
I think she's lovely. It's this tiny ad that called her crazy:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic