Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

show user credentials in target jsp which all are from swing form

 
siva perumal
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I have to open target jsp in iexploere along with user credentials which are from swing application by clicking submit in swing .

I need to show the user credentials in my target jsp Which user credentials are coming from swing login form .


I have used java.net URL to send the HTTP request to my target jsp from my swing window . this swing window has user name , password fields , Actually HTTP request are sending fine i am able to print those user name in my target jsp . but i unable to open target jsp in internet explorer along with user name .


here my code for ref:

String data = URLEncoder.encode("username", "UTF-8") + "=" + URLEncoder.encode("hi", "UTF-8");
data += "&" + URLEncoder.encode("password", "UTF-8") + "=" + URLEncoder.encode("hru", "UTF-8");

// Send data

URL url = new URL("http://12.14.12.1:1212/Applicffation1-ViewCofffntroller-context-root/targetjsp.jsp");
URLConnection conn = url.openConnection();
conn.setDoOutput(true);
OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
wr.write(data);
wr.flush();

// Get the response
BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String line;
while ((line = rd.readLine()) != null) {

}

rt.exec("C:/Program Files/Internet Explorer/IEXPLORE.EXE http://12.14.12.1:1212/Applicffation1-ViewCofffntroller-context-root/targetjsp.jsp");

wr.close();
rd.close();


thanks in advance
siva
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic