Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Unable to invoke servlet from client (simple java class)

 
Raja Sekhar Tiruveedula
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I had written simple servlet and client.I am able to invoke servlet from browser and from JSP page.My servlet is not getting invoked from client (simple java program used URL).
-------------------------------------------------------
Here is my client code



Thanks in advance to all
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64856
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please be sure to use code tags when posting code to the forums. Unformatted code is extremely hard to read and many people that might be able to help you will just move along to posts that are easier to read. Please read this for more information.

You can go back and change your post to add code tags by clicking the button on your post.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How are you invoking it from the browser? I would have thought you'd have to give it a parameter name.
 
Raja Sekhar Tiruveedula
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi david,
I am simply placing this URL in browser(address bar)

http://localhost:8080/B2BServer-war/B2BConnectorServlet
 
Katty Knk
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sekhar,
Could you explain bit more about your servlet, like what kind of input your servlet would expect from the client? and expected response?. As per the client code you have written, it looks to me that the servlet is expecting "File" kind of input from the client, but in your reply to Davit you mentioned that you have just pasted the URL in browser, this is totally confusing me.

Explain your expected servlet input/output in detail.



 
Katty Knk
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Katty Knk wrote:Sekhar,
Could you explain bit more about your servlet, like what kind of input your servlet would expect from the client? and expected response?. As per the client code you have written, it looks to me that the servlet is expecting "File" kind of input from the client, but in your reply to Davit you mentioned that you have just pasted the URL in browser, this is totally confusing me.

Explain your expected servlet input/output in detail.





Refer this link, i hope this would give you more detail.
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
well, basically it wont trigger the URL, it create the connection.

to make a request you need to do this
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
seetharaman venkatasamy wrote:to make a request you need to do this "connection.getInputStream();"

... which is what the code is doing in line 29.

So the response from the server is completely empty, and the servlet's doPost method is not called?
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf Dittmer wrote:... which is what the code is doing in line 29.


i miss that Completely
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic