This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem with Form File  RSS feed

 
naveen chedella
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • 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 .




 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • 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
  • 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
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See the "Disable HTML" checkbox? Check it, in a new post, with the real code.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!