Click to See Complete Forum and Search --> : Using java code in javascript in jsp-page


rbollen
05-07-2003, 08:58 AM
Hiya,

I'm using Java in javascript. with a Jsp-page. In the <script> tag I've placed this piece of code.

<% String loginString = %> scriptLogin.value;

but this piece doesn't work, i get errors.

can anyone help me please?

khalidali63
05-07-2003, 10:04 AM
You have to understand the functionality behind that line of code.

<% String loginString = %>

The line above has nothing to do with client or browsers current state.It only happens or its visible only on the webserver.
Where as this line of code

scriptLogin.value;

Line has nothing to do with webserver its only visible at the client side or in browser.

To pass a value from the web page to the jsp code you will need to use HTTP request object.

You will have to submit the formto this jsp page and get the valuein the jsp code using request.getParameter("paramName");