How to call a function with parameters in a java file from a jsp file? -


i have emp.java file method as

    boolean create(int empid,string empname,int supid ); 

i have register.jsp page

 <form name="register" action="#" method="post">         <table>                                 <tr>                                     <td>employee id</td>                                     <td><input type="text" name="empid"                                         placeholder="enter employee id " size="30"></td>                                 </tr>                                 <tr>                                     <td>employee name</td>                                     <td><input type="text" name="empname"                                         placeholder="enter employee name " size="30"></td>                                 </tr>                                 <tr>                                     <td>supervisor id</td>                                     <td><input type="text" name="sup_id"                                         placeholder="enter supervisor id" size="30"></td>                                 </tr>                                 <tr>                                     <td colspan="2" align="justify"><input type="submit"                                         value="submit"></td>                                   </tr>                                 </table>     </form> 

my requirement click submit button emp.create() must called parameters entered in register.jsp page.... there way solve this? necessary things have change can reach requirement!

or there way can pass values employee-->create(employee e)

.... {  callablestatement = openconnection().preparecall("{call insert_employee(?,?,?)}");                 callablestatement.setint(1,employee.getempid());                 callablestatement.setstring(2,employee.getempname());                 callablestatement.setint(3,employee.getsupid());     } ... 

as object(*) values when click submit?

you need servlet class call emp.java classes' method. servlet class should work action register.jsp. in servlet can request.getparameter/attribute()and collect values of input types using name/id.

pass these values either method or callable anywhere want use. if want stay on same jsp after processing need use ajax.


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

html - Unable to style the color of bullets in a list -

c# - must be a non-abstract type with a public parameterless constructor in redis -