• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

response generation issue.

 
Greenhorn
Posts: 25
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Bartender
Posts: 4116
72
Mac TypeScript Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
satnam singh negi
Greenhorn
Posts: 25
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 4116
72
Mac TypeScript Chrome Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 25
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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 !!
 
This cake looks terrible, but it tastes great! Now take a bite out of this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic