Corey Lundon wrote:
Oleg, Thanks for the reply.
yes i have looked at that beginners link
examples just help me learn.  I can see the NameValue pairs used in the 
tutorial.
I was just curious as to the form you were directing them to.
I can't seem to find where you are trying to log in at developer.java.sun.com.


I wrote that example 5 years ago. Things must have changed.


this is the javascript function and form i am using.
I can just make a get request to page2.html but that just bypasses the whole 
login.
I want to simulate filling out the form.
Can you help me understand what NVPairs i would need to do this.
I thought i would just need one for the password. is it not that simple?
function pasuser(form) {
if (form.pass.value=="123456") {
location="page2.html"
} else {
alert("Invalid Password")
}
}

<form method="POST" >
<center>
<table bgcolor="white" cellpadding="12" border="1">
<tr><td colspan="2"><center><h1><i><b>Login
Area</b></i></h1></center></td></tr>
<tr><td><h1><i><b>Password:</b></i></h1></td><td><input name="pass"
type="password"></td></tr>


<tr><td><center><input type="button" value="Login"
onClick="pasuser(this.form)"></center></td></tr></table></center>

I am just using this simple script for my index.html page

This all looks very wrong to me. HttpClient is not a browser. It cannot execute Javascript. Why don't you put together a simple webapp that uses form based authentication and run it in Tomcat?

Oleg



. I know it is very insecure. I am starting small to try to grasp using HttpClient correctly.
Oleg Kalnichevski <[EMAIL PROTECTED]> wrote: On Sat, 2008-03-29 at 22:27 -0700, Corey Lundon wrote:
Is my problem that my Login is based on javascript and HttpClient doesn't execute javascript like a browser does. So is what I am doing impossible.

Corey

No, it is not impossible. You just need to manually simulate the effect
of a form submission performed through a javascript invocation.
 I still don't see that developer sun java login that the tutorial talks about. 
 I need to see how others handle logging in and then I need to make a log in 
page like that i guess.  An example of an html form login page and 
corresponding NVPairs would be highly helpfull still.


Have you looked at the HttpClient primer? If not, please do. It explains
in details how to go about form-based authentication using HttpClient
http://wiki.apache.org/HttpComponents/ForAbsoluteBeginners

Oleg


Corey Lundon  wrote: Hi I need some help using HttpClient
I would love an example of a form and the corresponding name value pairs needed.
Your tutorial talks about some sun site with a form that i can't even get to.
I have a form that uses a button type that executes a javascript and then in 
turn redirects you to another site

there is only one field ... a password field
so i was thinking i only need one name value pair for it
but i can't seem to get past the login page

do i need a name value pair for the button press and if so what would it 
consist of

your tutorial has lots of name value pairs
an action, url, username, and password


also you talk about only way to see if log on was correct is to check cookie
my html form doesn't use cookies as far as i know
it is just a form with a field for password
you hit button which runs a javascript function and if password is correct you go to new site
i was just trying to check status code for a redirection status code
or maybe i could just getResponseAsString and see if i am on the right site

---------------------------------
You rock. That's why Blockbuster's offering you one month of Blockbuster Total 
Access, No Cost.

---------------------------------
You rock. That's why Blockbuster's offering you one month of Blockbuster Total 
Access, No Cost.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------
You rock. That's why Blockbuster's offering you one month of Blockbuster Total 
Access, No Cost.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to