tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben Souther <bsout...@fwdco.com>
Subject Re: forward to a form with enctype="multipart/form-data" fails
Date Tue, 28 Sep 2004 20:06:11 GMT
If you can hit it with a browser you should be able to forward to it.

Bring the page up in a browser, copy the address, and paste in in your
reply so we can see it.

On Tue, 2004-09-28 at 15:12, Mufaddal Khumri wrote:
> Yes. I had tried that before my first email here. It had worked.
> 
> Right now I have a work around that I am using by using  
> response.sendRedirect(...). I still
> havent got it to work with the forward.
> 
> On Sep 28, 2004, at 10:37 AM, Ben Souther wrote:
> 
> > Are you able to hit UserPhoto.jsp from your browser?
> >
> > If so, bring it up and paste the URL from your browser's address  
> > window.
> >
> >
> > On Tue, 2004-09-28 at 13:26, Mufaddal Khumri wrote:
> >> Yes :) . It is.
> >>
> >> My ImageServlet gets a form submission of a form thats
> >> enctype="multipart/form-data".
> >>
> >> 	I am using the DiskFileUpload class from Apache using the
> >> commons-fileupload-1.0.jar
> >>
> >> 	DiskFileUpload upload = new DiskFileUpload();
> >> 	........
> >> 	........		
> >> 	List items = upload.parseRequest(request);
> >> 	.......
> >> 	........
> >>
> >> 	Since the request contains a multipart form submission, I can get  
> >> data
> >> from that request object once. The
> >> 	DiskFileUpload object does this for me and returns a List object i.e.
> >> items.
> >>
> >> 	In doing so my request object looses all the parameters that I had
> >> sent with it.
> >>
> >> 	Now, when I do the following:
> >>
> >> 	path = "/c/shared/UserPhoto.jsp";
> >> 	....
> >> 	....
> >> 	request.setAttribute("errorMsg", message);
> >> 	
> >> getServletConfig().getServletContext().getRequestDispatcher(path).forw 
> >> ar
> >> d(request, response);
> >> 	
> >> 	This forward fails !!!! . And I am still at a loss of explanation.
> >>
> >> Any help is appreciated.
> >>
> >> Regards,
> >> 	
> >> 	
> >> 	
> >> Now doing this in my
> >> On Sep 28, 2004, at 10:07 AM, Shapira, Yoav wrote:
> >>
> >>>
> >>> Hi,
> >>> And is /c/shared within the docBase of your webapp? ;)
> >>>
> >>> Yoav Shapira
> >>> Millennium Research Informatics
> >>>
> >>>
> >>>> -----Original Message-----
> >>>> From: Mufaddal Khumri [mailto:mufaddal@wmotion.com]
> >>>> Sent: Tuesday, September 28, 2004 1:06 PM
> >>>> To: Tomcat Users List
> >>>> Subject: Re: forward to a form with enctype="multipart/form-data"
> >>>> fails
> >>>>
> >>>> Yes. :) I do. Thats what is confusing the hell out of me.
> >>>>
> >>>> Thanks.
> >>>>
> >>>> On Sep 28, 2004, at 9:22 AM, Ben Souther wrote:
> >>>>
> >>>>> Do you have a JSP at:
> >>>>> /c/shared/UserPhoto.jsp
> >>>>> ?
> >>>>>
> >>>>>
> >>>>>
> >>>>> On Tue, 2004-09-28 at 12:15, Mufaddal Khumri wrote:
> >>>>>> 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).for 
> >>> w
> >>>>>> ar
> >>>>>> 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
> >>>>>>
> >>>>>>
> >>>>>
> >>>>>
> >>>>> -------------------------------------------------------------------

> >>>>> --
> >>>>> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> >>>>> For additional commands, e-mail:  
> >>>>> tomcat-user-help@jakarta.apache.org
> >>>>>
> >>>> 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
> >>>
> >>>
> >>>
> >>>
> >>> This e-mail, including any attachments, is a confidential business
> >>> communication, and may contain information that is confidential,
> >>> proprietary and/or privileged.  This e-mail is intended only for the
> >>> individual(s) to whom it is addressed, and may not be saved, copied,
> >>> printed, disclosed or used by anyone else.  If you are not the(an)
> >>> intended recipient, please immediately delete this e-mail from your
> >>> computer system and notify the sender.  Thank you.
> >>>
> >>>
> >>> ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> >>> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> >>>
> >>>
> >> 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
> >
> 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
> 
> 


---------------------------------------------------------------------
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