• Post Reply Bookmark Topic Watch Topic
  • New Topic

getting data from a form directly  RSS feed

 
Peter Guillebaud
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I need to process the data sent by a form using the "POST" method to a JSP page directly, ie. not using request.getParameter ( "paramName" ).
In other words I need to do a request.getInputStream (), but the JSP engine seems to have already read it, and doesn't let me, giving me an error.
How do I get to stop the JSP engine from reading the input stream ?
Thanks.
 
Bosun Bello
Ranch Hand
Posts: 1512
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can't you just forward the request using requestDiapatcher?
------------------
Bosun
SCJP for the Java� 2 Platform
 
Peter Guillebaud
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bosun, thanks - I've not used requestDispatcher - how does that work?
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My $0.02 worth:
If you are trying to process an InputStream (e.g. you're doing complex logic) then you should put the code in a SERVLET and not a JSP. It will be much clearer and easier to understand if you do things that way...
Kyle
------------------
Kyle Brown,
Author of Enterprise Java (tm) Programming with IBM Websphere
See my homepage at http://members.aol.com/kgb1001001 for other WebSphere information.
 
Tim Holloway
Bartender
Posts: 18716
71
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JSP probably won't do it. As a matter of fact, I'm doubtful that even HttpServlet will. You'll probably have to go all the way down into the basic java Servlet class and build on that.
I did something like that a while back.
 
Peter Guillebaud
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks Tim, could I see some of the relevant code that you worked on for this? I haven't had much experience in this area...
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!