Calling servlets from JFrame

Hi,

I am calling the servlet by clicking a JButton on Jframe. By using the URL class i could extablish a connection but the problem araises when i need to send data to the servlet where in i have to collect the data in the servlet using getParameter(). Anyone please help me out... Its better if u give me a sample code.

You can also reply to srikanthchoppara@tataelxsi.co.in

Message was edited by:

srikanth1236

[443 byte] By [bronze-starDukes] at [2007-11-26 12:10:01]
# 1

There are two ways.

1. You can send get requests and just append all the paraneters to your URL

Ex:-

http://yourDomain.com/YourServlet?ParamName1=ParamValue1&ParamName2=ParamValue2...

2. You can send a post requesr with

ParamName1=ParamValue1&ParamName2=ParamValue2...

part in the request body.

Both of above approaches have been discussed here so many times with examples and there are also lots of tutorials and online articals available about them so I dont feel like typing a sample again so please do some search.

silverstar at 2007-7-7 13:47:40 > top of Java-index,Archived Forums,Socket Programming...