Hi,
I want to send userId and password from my swing Interface to my
servlet as just like as we send it from html file,therefore iam sending those parameter to my servlet as query
string with the url.For that In swing Interface in the action event of submit button:-
public URL u;
public URLConnection uc;
submit.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
String userid1;
String password1;
String
url="http://127.0.0.1:8080/examples/servlet/loginServlet";
userid1 = userid.getText();
password1 = password.getText();
u = new URL(url+"?name=" +userid1 + "&path=" + password1);
uc =u.openConnection();
uc.setDoOutput(true);
uc.setDoInput(true);
uc.setUseCaches(false);
//Then what should I do
And In servlet:-
==============
public void doGet(HttpServletRequest req,HttpServletResponse res)
throws ServletException,IOException
{
res.setContentType("text/html");
PrintWriter out=res.getWriter();
String str1=req.getParameter("name");
String str2=req.getParameter("path");
System.out.println(str1);
System.out.println(str2);
}
Is it work?Plz Guide me Iam really confused what should I do.
Regards
Bikash
[ January 29, 2003: Message edited by: Bikash Paul ]