You can't do that- the java is compiled and run on the server- all the
browser does is display the html/javascript.

You need (something like) a post after putting u and p in hidden fields- in
this case you probably don't wven want them as hidden since the user has to
enter them :) you'll need a link or something to call the js from


<form name="myForm">
<input type="text" name="userName">

.
<script...>
.
            document.forms['myForm'].method = 'post';

                // the line below copies a javascript variable value into a
hidden
                // on the form so it is posted back to the jsp
            document.forms['myForm'].u.value = u;



            document.forms['myForm'].action = '/jsp/myJsp.jsp';
            document.forms['myForm'].submit();

</script>

</form>
.

the browser fires a request back to the server and you can then get at u in
your jsp (say login.jsp)

userId = request.getParameter("u");


so you have two files, skeletons...

login.html

<input type="text" name="u">

<script...>
.
            document.forms['myForm'].method = 'post';
            document.forms['myForm'].action = '/jsp/login.jsp';
            document.forms['myForm'].submit();

</script>

.
etc


<login.jsp>


<%

  String userName = request.getParameter("u");

%>


Again, you will probably find this in the archives of the list in more
detail than my hurried description abobe.

Regard, Paul

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to