Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
  • 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Could not find a Content-Type for upload in struts2

 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ranchers,
I am not able to get the contents for the csv file but for other files its working fine.

The code is

<s:form action="doUpload" method="POST" enctype="multipart/form-data">
<tr>
<td colspan="2"><h1>File Upload Example</h1></td>
</tr>

<s:file name="upload" label="File"/>
<s:textfield name="caption" label="Caption"/>
<s:submit />
</s:form>


---------------------------------------------------------------------------
in Struts.xml i have placed the below code
<action name="upload" method="upload" class="UploadAction" >

<result name="success">/pages/uploadsuccess.jsp</result>
</action>
---------------------------------------------------------------------------
uploadsuccess.jsp has

<%@ page
language="java"
contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<html>
<head>
<title>Showcase</title>

</head>

<body>
<table class="wwFormTable">
<tr>

<td colspan="2"><h1>File Upload Example</h1></td>
</tr>




<tr>
<td class="tdLabel"><label for="doUpload_upload" class="label">File:</label></td>
<td><s roperty value="upload" /></td>
</tr>




</table>

</body>
</html>

Can you please tell me how to upload a csv file. I badly need this to be solved. So please help out
 
Ranch Hand
Posts: 689
Scala Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi.


Please make sure you put this code in Struts.xml file or not.

<interceptor-stack name="fileUploadStack">
<interceptor-ref name="fileUpload"/>
<interceptor-ref name="basicStack"/>
</interceptor-stack>

Thanks,
Nishan Patel.
 
sridhar gandikota
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have included and tried but still the same. It works for other type of files like xml,txt,zip formats.

and it says "Could not find a Content-Type for upload"
 
sridhar gandikota
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
sorry i mean to say "Could not find a Content-Type for upload" for csv files only not for other files
 
I am not young enough to know everything. - Oscar Wilde This tiny ad thinks it knows more than Oscar:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic