tags:

views:

30

answers:

1

Can i send object or bean instead of sending parameters in jsp request to servlet, if yes , How can i get the value from each input field and use it inside jsp.

E.g:

//define user object
<jsp:useBean id="user" class="iug.edu.entities.UserBean"/>
//here is the input inside fomr
<input type="text" name="userName"/>
//here jsp code , to add object attributes
   <%
            user.setFullName**(?????**);  // how can i get userName from input field
   %>

i can make it via java script but can i use js var inside jsp ? what should i do ??plz help!

+1  A: 

No, you can't. JSP is evaluated on the server side, and you want client interaction. With HTTP clients can send data to server-side components only via request parameters (strings)

Bozho
what should i do if i want to send unkown parameters numebr for each time jsp page run ? i was thinking of using list but what can i do now?
Alaa
you have `request.getParameterMap()` which you can iterate.
Bozho
it's not woking Mr Bozho , i misunderstand u yesterday , i want to send from JSP to servlet and in the request there is no setParameterMap() ???? i return back to the main problem , how can i send different number of attributes each time from jsp tp servlet?
Alaa