aspose file tools*
The moose likes Servlets and the fly likes response generation issue. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "response generation issue." Watch "response generation issue." New topic
Author

response generation issue.

satnam singh negi
Greenhorn

Joined: Aug 13, 2011
Posts: 25

hello everyone,

Greetings !!

i am working with a web application where i have written a servlet to validate the request data.

here is the scenario.

i have servlet on my localhost,which generates the request page with all the neccessory data, and the task of this servlet is just this means to create html page with some values in it,or later they can be entered.when i submit the details then it goes to another server

e.g like i am using tomcat ,so my server is http://localhost:8080/requestGenrator.html and this servlet will create an html page with many details.

now i have hardcoded the server details in my requestGenerator servlet like "http://otherserverdetails :8020/ValidateServlet"

on other server i have a ValidateServlet which will validate the servlet and send the response to Me.

everything working fine, but when i click the submit button from my requestGenertor.html then url becomes "http://otherserverdetails:8020/ValidateServlet" which i think is fine because that is where the request has to be validated, but when i get the response from server the url remain the same. which i guess should be "http://myserverdetails:myPort/responseMessage" .

how can i achieve this ,or am i right on understanding . that ValidatorServlet is written by me and i have deployed the code in another tomcate server in some other machine and now i am sending request from my machine to that server. i am getting the response but my browser still showing me the server url and details...is it something like, that i have moved to server. if yes how can receive the response from server.

i have used simple out.println() to send the response from server. no forwards and dispatchers are being used.

Please share your suggestions.

Thanks in advance.
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3838

but when i click the submit button from my requestGenertor.html then url becomes "http://otherserverdetails:8020/ValidateServlet" which i think is fine because that is where the request has to be validated, but when i get the response from server the url remain the same. which i guess should be "http://myserverdetails:myPort/responseMessage" .

Why? What is that "http://mysever...." URL? When you send a request to a URL it doesn't change unless server sends a redirect to the browser, rather you'll see the response.


SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
satnam singh negi
Greenhorn

Joined: Aug 13, 2011
Posts: 25

Vijitha Kumara wrote:
but when i click the submit button from my requestGenertor.html then url becomes "http://otherserverdetails:8020/ValidateServlet" which i think is fine because that is where the request has to be validated, but when i get the response from server the url remain the same. which i guess should be "http://myserverdetails:myPort/responseMessage" .

Why? What is that "http://mysever...." URL? When you send a request to a URL it doesn't change unless server sends a redirect to the browser, rather you'll see the response.



Actually "http://myserver..." is my tomcat server from where i am making a request to other server.when server respond back to me the url remain same as it was at the time of request. so here my confusion is ,when server respond back than the that url should be client url. is it correct ? this is just as when we made a request to any server from our browser then it respond with desired result but without server details . i am confused. in server side how should i handle the request,it may be any http post or get request,after capturing the data and validating it ,i want to send the response to same requestor from where request came.how can i achieve this .
i have written code for server side ,now i am generating a request and using that code to validate it.but response handling become a problem to me now. my technical knowledge about servlets is not so good.

Hope i am able to describe my problem.Please suggest!
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3838

when server respond back to me the url remain same as it was at the time of request. so here my confusion is ,when server respond back than the that url should be client url. is it correct ?

Your browser(client) send a request to a server which will be the URL at the time you send it, and you'll see the response on the same. This does not change whether you send the request to any other server than the one you used before.
satnam singh negi
Greenhorn

Joined: Aug 13, 2011
Posts: 25

Vijitha Kumara wrote:
when server respond back to me the url remain same as it was at the time of request. so here my confusion is ,when server respond back than the that url should be client url. is it correct ?

Your browser(client) send a request to a server which will be the URL at the time you send it, and you'll see the response on the same. This does not change whether you send the request to any other server than the one you used before.



Thanks for your comments vijitha !!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: response generation issue.