html input passing to jsp method

html input passing to jsp method

i want code in which jsp method takes html input value which is in same page......

<html>
<head>
<%!public void method1() 
{

 **???how to read pid value here???**

}%>
</head>
<body>
    <table>
        <tr>
            <td>Product ID</td>
            <td>Product Name</td>
            <td>Cost</td>
            <td>Quantity</td>
        </tr>
    </table>
    <form>
        <input type="text" name=pid onblur="m1()" />
        <input type="text" name=pname />
        <input type="text" name=pcost />
        <input type="text" name=pcost />
        <input type="text" name=qty />
    </form>

</body>
</html>
View Answers

October 17, 2011 at 10:39 AM

Hi please Find the Following code

<%
    if (request.getMethod() == "POST") {
        out.println(request.getParameter("userId"));
        out.println(request.getParameter("password"));
    }
%>

<html>
<head>
<title>Input JSp</title>
</head>
<body>
<h2 align="center">Login Here</h2>
<center>
<form name="myForm" method="post">
<table>
    <tr>
        <td>User Id</td>
        <td><input type="text" name="userId" id="userId" /></td>
    </tr>
    <tr>
        <td>Password</td>
        <td><input type="password" id="password" name="password" /></td>
    </tr>
    <tr>
        <td align="right" colspan="2"><input type="submit" value="login" /></td>
    </tr>
</table>
</form>
</center>
</body>
</html>

You can Specify the action also in the form.............


October 17, 2011 at 6:10 PM

how can i get the value without using request.getParameter();


October 18, 2011 at 6:37 PM

you can also do as

get the value in javascript, set those values in session using javascript


October 18, 2011 at 7:32 PM

thank you very much..it solved my problem

Ads









Related Tutorials/Questions & Answers:
html input passing to jsp method
html input passing to jsp method  i want code in which jsp method takes html input value which is in same page...... <html> <head>...;input type="text" name=pid onblur="m1()" /> <input type="text" name
passing data between the jsp pages ?
passing data between the jsp pages ?  i developed a project on student marks system.in this project their is one html page which asks user to enter the roll number and when we press submit button on that page it moves a jsp page
Advertisements
html-jsp
html-jsp  If i want to get dynamic value in html textbox or in jsp,then how can I get the value,how the value will be transfered from servlet page to the html textbox.Thanx in advance.....Kindly help me
Passing parameters in JSP using forward.
Passing parameters in JSP using forward.  If a page is forwarded to another page using jsp:forward, is it necessary that the page should be already............   Pass Parameters using jsp:forward
Input / Output in Easiest Method in Java
Input / Output in Easiest Method in Java  How to input from keyboard... with the easiest method in Java?   Hi Friend, Try the following code: import...)throws Exception{ Scanner input=new Scanner(System.in
JSP parameter passing throught out web app
JSP parameter passing throught out web app  i want to pass one param from page1.jsp page to page4.jsp page but in between this i need to navigate page3.jsp and page2.jsp.Please help me to understand how could i transfer param
Passing Parameter Values to another jsp in Query Strings
Passing Parameter Values to another jsp in Query Strings  HI ALL, I m trying to pass a variable value to another JSP using query string... response.sendRedirect("http://localhost:8080/SWIFT/index.jsp?loginid='"+loginid
Post Method of the Form In JSP
Post Method of the Form In JSP   ... of the post method of the form in JSP. The HTTP post method sends data to the server from the HTML form elements. This method does not show the value of elements
passing rs.getString values between the jsp pages using hidden fields
passing rs.getString values between the jsp pages using hidden fields  I want to pass rs.getString values from 1st.jsp to 2nd.jsp using hidden fields like <input type="hidden" value="<%=rs.getString(1
convert this html form to jsp
convert this html form to jsp  <html> <head> <script...;/tr> <form name="VillageDetailsForm" action="AddVillage.jsp" method...;/td> <td style="padding-top: 10px;" valign="top"> <input class
send HTML Email with jsp and servlet
send HTML Email with jsp and servlet  Can You please show me how to send html Email using JSP and Servlet thank you
Passing Parameters in jsp
Passing Parameters in jsp       This section illustrates you how to pass parameters in jsp. JSP can... file. We are passing the parameters using the tag <jsp:param> which contain
how to use sendRedirect in doGet method in jsp?
how to use sendRedirect in doGet method in jsp?  i am getting problem in jsp that when we are directly writing address to a jsp page in addressbar the jsp page should redirect it to the html page.   can any one tell me
passing values between jsp file through hyperlink in div tag
passing values between jsp file through hyperlink in div tag  <...='Content-Type' content='text/html; charset=utf-8' /&gt; &lt;link...;script src="js/AdminHeader.js"&gt;&lt;/script&gt; &lt;jsp
Get Method of the Form In JSP
Get Method of the Form In JSP     ... of the form in JSP. The HTTP get method sends data to the server. In your JSP...; <head><title>Using Get Method in JSP Form.</title></head>
Passing java variables from JSP to Servlet - return null values
Passing java variables from JSP to Servlet - return null values  I want to pass some variables from a JSP page to a servlet. These variables are from the java code of my JSP. In JSP page I did, String msg="hello
Passing Parameters using <jsp: param>
Passing Parameters using <jsp: param>   ... from one jsp file to another file. The targeted file can be a Html file, jsp file...; In this example we are passing a parameters to a file by using <jsp
how to write a jsp form using html
how to write a jsp form using html  hi, i have written the code as below... but it is showing error. please help me how to resolve it. .html file...; <body> <form method="POST" action="Form1.jsp"> EmployeeNo: <
HTML tags in JSP
HTML tags in JSP      ... the html tag inside the JSP code.  In this example we have used the html tag inside the println() method of the out implicit object which is used
Problem passing a value from one jsp to another using href
Problem passing a value from one jsp to another using href  first page.jsp <a href="common.jsp?param=<%l.get(k).parentname%>"> common.jsp <%String attr=request.getAttribute("param"); out.print(attr
Problem passing a value from one jsp to another using href
Problem passing a value from one jsp to another using href  first page.jsp <a href="common.jsp?param=<%l.get(k).parentname%>"> common.jsp <%String attr=request.getAttribute("param"); out.print(attr
Html+jsp+database is enough to do the small operation
Html+jsp+database is enough to do the small operation  Hai , If u... not to bother about whole code.just u consentration on html,ajax,jsp,any db.here i am using db2. Html for insertion: <form name="StudentForm" method="post
How to work with POST method in jsp page
How to work with POST method in jsp page... POST method instead of GET method in jsp page. GET is default method for sending... hidden! jsp_with_post_method.jsp: Using POST method is nothing different
Passing Parameters to Another JSP Page
Passing Parameters to Another JSP Page      By using the include action we can pass the parameters to another jsp page... in the jsp post from the html form or the jsp page.   The code
HTML get Method
HTML get Method       The HTML get Method is used to submit the data of the page... The Tutorial helps you to understand an example from HTML get Method
How to call java method on Button click in jsp?
How to call java method on Button click in jsp?  How to call java method on Button click in jsp
how to save an input to jsp page in a text file?ave an input given b
how to save an input to jsp page in a text file?ave an input given b  how to save the input given by the user in jsp page to a text file
how to insert data in database using html+jsp
;form action="index.jsp" method="get"> <input style="width: 850px... method="post" action="http://localhost:8080/examples/jsp/insert.jsp"> <...how to insert data in database using html+jsp  anyone know what
passing xml created using DocumentBuilderFactory as input to oracle stored procedure using java JDBC
passing xml created using DocumentBuilderFactory as input to oracle stored procedure using java JDBC  I want to send the xml as input parameter... input parametes and an output parameter.first input parameter is an integer
JSP to add details to a database from a HTML form.
JSP to add details to a database from a HTML form.  Hi I'm a second year CS student who has to use JSP to validate a HTML form and add the details..... Can anyone tell me what is wrong with my code? html code first
Passing variable
Passing variable  How to pass variable to HTTP object in HTMl or PHP

Ads