cancel
Showing results for 
Search instead for 
Did you mean: 

reg. Passing Form inputfiled value from javascript to bean as parameter

Former Member
0 Kudos

Dear Experts,

I have a JSP form and on click of the submit i call a Java script. In the javascript i call a method in a bean (and pass string parameters) which would return me boolean value. Now On click of submit in the Javascript i'm able to call the bean method and pass hardcoded values successfully. But i'm not able to pass to the bean thee form input field values as parameter. I was able to get the form value in a variable say Var Str1, but not able to pass 'Str1' to the bean as parameter.

<%

boolean statuschk = test123.checkuserid("JOHN","johnpass");

%> ---> This code is working good.

<%

boolean statuschk = test123.checkuserid(document.loginForm.j_user.value,document.loginForm.j_password.value);

%> --> This is Not Working

var Str1 = document.loginForm.j_user.value;

var Str2 = document.loginForm.j_password.value;

<%

boolean statuschk = test123.checkuserid(Str1,Str2)%> --> This is also Not Working

Points will surely be awarded.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello,

To my knowledge you are mixing client side scripting(javascript/vbscript) and server side scripting (JSP/ASP/PHP). To pass the parameters to JSP or Java Bean. you need to make use of Request.getParameter("<parametername>"); This statement will return the paramater value submited. Please make sure you submit the page.

Let me know, how it goes

HTH

Vivek Nidhi

Former Member
0 Kudos

Javascript is client side where as jsp is server side.so we can get the server side values in client side but we cannot get client side values in server side

so as vivek told you have to use request.getParameter("") to get the values

hope this helps

Answers (0)