Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Struts
Search Coderanch
Advance search
Google search
Register / Login
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
Tim Cooke
paul wheaton
Jeanne Boyarsky
Ron McLeod
Sheriffs:
Paul Clapham
Liutauras Vilda
Devaka Cooray
Saloon Keepers:
Tim Holloway
Roland Mueller
Bartenders:
Forum:
Struts
http 404 error in uploading the file
madhuri kunchala
Ranch Hand
Posts: 350
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
hi,
i had done sample application program i.e.,
http://www.vaannila.com/struts-2/struts-2-example/struts-2-file-Upload-example-1.html
.i had done as it is but im getting 404 error if im uploading the image file..can any one provide me the solution.
David Newton
Author
Posts: 12617
I like...
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
How about if you post the *relevant* portions of the config,
JSP
, and action instead of making us hunt for it? And provide the exact circumstances of when you get the 404: is it on submit?
madhuri kunchala
Ranch Hand
Posts: 350
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
hi David,
by clicking the submit button im getting that error
UserImage.jsp
<%@ page contentType="text/html; charset=UTF-8"%> <%@ taglib prefix="s" uri="/struts-tags"%> <html> <head> <title>Upload User Image</title> </head> <body> <h2>Struts2 File Upload & Save Example</h2> <s:actionerror /> <s:form action="userImage" method="post" enctype="multipart/form-data"> <s:file name="userImage" label="User Image" /> <s:submit value="Upload" align="center" /> </s:form> </body> </html>
rendered HTML Page
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Insert title here</title> </head> <body> <form id="fileUpload" action="fileUpload" method="post" enctype="multipart/form-data"> <table class="wwFormTable"> <tr> <td class="tdLabel"><label for="fileUpload_userImage" class="label">User Image:</label></td> <td><input type="file" name="userImage" value="" id="fileUpload_userImage"/></td> </tr> <tr> <td colspan="2"><div align="right"><input type="submit" id="fileUpload_0" value="Submit"/> </div></td> </tr> </table></form></body></html>
and im getting Error on Clicking
Submit
button
HTTP Status 404 - There is no Action mapped for namespace / and action name fileUpload. [b]type[/b] Status report [b]message[/b] There is no Action mapped for namespace / and action name fileUpload. [b]description[/b] The requested resource (There is no Action mapped for namespace / and action name fileUpload.) is not available.
David Newton
Author
Posts: 12617
I like...
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
message
There is no Action mapped for namespace / and action name fileUpload.
Is there?
madhuri kunchala
Ranch Hand
Posts: 350
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
it is present in struts.xml file..here is struts.xml file code.
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd"> <struts> <constant name="struts.enable.DynamicMethodInvocation" value="false" /> <constant name="struts.devMode" value="false" /> <constant name="struts.custom.i18n.resources" value="ApplicationResources" /> <package name="default" extends="struts-default" namespace="/"> <result-types> <result-type name="tiles" class="org.apache.struts2.views.tiles.TilesResult" /> </result-types> <interceptors> <interceptor name="mylogging" class="net.viralpatel.struts2.interceptor.MyLoggingInterceptor"> </interceptor> <interceptor-stack name="loggingStack"> <interceptor-ref name="mylogging" /> <interceptor-ref name="defaultStack" /> </interceptor-stack> </interceptors> <action name="login" class="net.viralpatel.struts2.LoginAction"> <interceptor-ref name="loggingStack"></interceptor-ref> <result name="success" type="tiles">/welcome.tiles</result> <result name="error">Login.jsp</result> </action> <action name="customer" class="net.viralpatel.struts2.CustomerAction"> <interceptor-ref name="loggingStack"></interceptor-ref> <result name="success" type="tiles"> /customer.success.tiles </result> <result name="input" type="tiles">/customer.tiles</result> </action> <action name="customer-form"> <interceptor-ref name="loggingStack"></interceptor-ref> <result name="success" type="tiles">/customer.tiles</result> </action> <action name="userImage" class="net.viralpatel.struts2.FileUploadAction"> <interceptor-ref name="fileUpload"> <param name="maximumSize">2097152</param> <param name="allowedTypes"> image/png,image/gif,image/jpeg,image/pjpeg </param> </interceptor-ref> <interceptor-ref name="defaultStack"></interceptor-ref> <result name="success">SuccessUserImage.jsp</result> <result name="input">UserImage.jsp</result> </action> </package> </struts>
David Newton
Author
Posts: 12617
I like...
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Really? There's an action configured at fileUpload? Show me where in the config you posted it is.
You can also use the
Struts 2 Config Browser plugin
to see what
Struts
2 thinks your configuration is.
There is no greater crime than stealing somebody's best friend. I miss you tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Struts-Menu with Struts 2
The requested resource () is not available.
Struts Help
Can i have multiple struts-config files in struts1.1
problem in checking the dimensions of an image.
More...