• 0

[JAVA] Log in to a URL using java code.


Question

Hi guys,

I have a problem and hope someone can assist me so here goes.

I have a website that requires a form login (JSP using POST METHOD). I will like to use JAVA code to actually log in and navigate to a particular page in the website.

I have previously tried apache's common lib -> HttpClient but it was unsuccessful. I am not sure if it is due to my coding errors or not but I could not get it to navigate to the page I want.

When i tried logging in using HttpClient, i printed out the status and it was "200" which means it is OK and i also managed to get the cookie. But when i requested to be redirected to the page i want, it did not go to it because I did a printout of the html coding of that page and it printed out the log in page html coding so it seems i am still stuck at the log in page.

The main task I want to do is very simple, go to a particular page in that website that is password-protected by a JSP form login.

If it is of any help, the website i am trying to log on to is a webserver's console page - TOMCAT. (Http://localhost:8080)

Any help will be much appreciated as this is pretty important to me. Thank you guys in advance.

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

I dont have much experience in dealing with low level JEE navigation... however

It seems like you are using weblogic from the other thread?

If you can , I suggest you use the Workshop studio's pageflows framework they provide which is based on struts....

either that or use struts or spring or someother framework...JEE navigation is simplier when using a framework.

basically the Pageflows framework is this. You drop a page, drop an action and drag an arrow to it. you then drag an arrow from the action to another page.... pretty sweet :) - though workshop 8.1 was better than the later versions...

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.