Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

catch response returned by PHP in jsp  RSS feed

 
Adrian Airmil
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a jsp which will submit an image to a php script. The script will resize the image and return true if it was successful or return and error. How can i catch the response from the php method and render the appropriate response on the jsp? The only way I can think of the redirecting from the php script upon completion to the jsp with a parameter in the url, doing a get and analyzing it to render the response in the jsp. Is there a better way of doing this?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65826
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moved to the JSP forum.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65826
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You'll need to explain what you are trying to do better. For example:
Adrian Airmil wrote:I have a jsp which will submit an image to a php script.
has no meaning.

You don't "submit" images. What do you mean by this? Are you submitting the URL of an image to the php script? Are you using an input of type image to trigger the request? Are you specifying the URL of the php script in an image tag? What?

As it's central to the discussion, not understanding what this means makes the question impossible to address.
 
Adrian Airmil
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:You'll need to explain what you are trying to do better.

Sorry for the confusion. What 'submit' means is that the jsp has a form. The user will use it to upload an image. The form action will be set to point to 'imageResizer.php'. The php script will acquire the POST details from the jsp, process the resize and return a response of true if the resize was successful or an error.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65826
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As with other responses, the response is sent to the browser, not the JSP. So your JSP isn't going to be able to do anything. It's gone.

Ajax wont help because it can't do file uploads (though jQuery will let you fake it).

Perhaps an iframe?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!