tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mufaddal Khumri <mufad...@wmotion.com>
Subject forward to a form with enctype="multipart/form-data" fails
Date Tue, 28 Sep 2004 16:15:17 GMT
Hi,

I have the following code in a  Servlet:

     // .......
    // ........
     request.setAttribute("sPhoto", new Integer(setPhoto));
     error("/c/shared/UserPhoto.jsp",
              "Uploaded Images should be of type JPG or GIF and maximum  
of 800KB",
               request, response);
     // .....
     // ....

        private void error(String path, String message,  
HttpServletRequest request, HttpServletResponse response)
	{
		try
		{
			request.setAttribute("errorMsg", message);

			 
getServletConfig().getServletContext().getRequestDispatcher(path).forwar 
d(request, response);
		}
		catch(Exception ex)
		{
			ex.printStackTrace();
		}
	}

I have a multipart form on the UserPhoto.jsp.

	<form name="editPhoto" method="post" action="/c/shared/ImageServlet"  
enctype="multipart/form-data">
          ........
	........
		<%
		String errorMsg = (String)request.getAttribute("errorMsg");
		if(errorMsg != null && errorMsg.equals("null") == false)
		{
		%>
			<cw:errorBox>An error occurred while updating user photograph  
settings. <%=errorMsg%></cw:errorBox>
		<%
		}
		%>
	.........
          ........
           </form>


When I submit this form to the servlet above and then the servlet sets  
the attribute "sPhoto" and forwards the request back to the jsp, I get  
the
following error:

HTTP Status 404 - /c/shared/UserPhoto.jsp

type Status report

message /c/shared/UserPhoto.jsp

description The requested resource (/c/shared/UserPhoto.jsp) is not  
available.
Apache Tomcat/5.0.28

I do not understand why the forwarded request to the JSP does not find  
the JSP?

Any help on this is appreciated.

Regards,

Mufaddal Khumri
Software Developer
Waves In Motion
Phone: 602 956 7080 x 26
Email: mufaddal@wmotion.com


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message