I am hitting one url for login
public void hittingurl(){
String url = "http://test/login.jsp?username=hello&password=12345";
URL obj = new URL(url);
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
// optional default is GET
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
System.out.println("\nSending 'GET' request to URL : " + url);
System.out.println("Response Code : " + responseCode);
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
//print result
System.out.println(response.toString());
}
after the successful hit url for login when i hit another url
http://test/afterLogin.jsp
I do not get output because of afterLogin.jsp not able to get session valule of username and password and i am also setting one variable in session in the login.jsp page
session.setAttribute("someparamValue", "value");
Is there any way by using core java to hit second url within the session of first url? so that afterLogin.jsp able to get every value of session that i have in login.jsp