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









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 Parameter - JSP-Servlet
Passing Parameter  I would like to ask how to pass a parameter from javascript section into the jsp section.It will be something like...; answer<%; <---I'm stuck here passing the var
Advertisements
passing parameter from html to applet
passing parameter from html to applet  how to pass the following from HTML to applet in Java code - font size,font style,font size?give me suitable code
passing from 1 jsp to another - JSP-Servlet
passing from 1 jsp to another  Hi Sir, What are the ways and means of passing from 1 jsp page to another page.what are the different types of methods?  Hi Friend, You can use tag,sedRedirect() method
Passing Parameters - JSP-Servlet
Passing Parameters  Hi I have to pass parameter like... session // use POST method to avoid show data in url... is For more information on JSP visit to : http://www.roseindia.net/jsp
Passing Parameter - JSP-Servlet
Passing Parameter  Hi, it'me again. Below is the set of code that I..., there's var answer. I need to pass this parameter back into the jsp part, how should i do it which means the String answer in jsp part will equal to the var answer
passing parameters - JSP-Servlet
passing parameters  hi this is my jsp page Reserved...,Mobileno: details using method resultsinsert()*/ public boolean
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
passing values - JSP-Servlet
passing values  hi this is my jsp page Reserved By: Conference Hall...=null; /*Inserting Name,Hallno:,Time,Date,Mobileno: details using method
PHP HTML forms and Post Method Code
PHP HTML forms and Post Method Code PHP html function With the given PHP HTML... HTML Code <HTML><BODY> <FORM METHOD=?POST... to create html forms and display data using PHP Post Method in PHP
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 value in hyperlink - JSP-Servlet
Passing value in hyperlink  How to pass value in anchor tag or HTML link from one JSP page to another JSP page ?and how to retrieve values in another...="0"><tr><td width="100%"><form method="
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
calling java method from html form with out using javascript - JSP-Servlet
calling java method from html form with out using javascript  How can i call java method from a HTML form, java script should be disabled?  Hi <html><head><title>Test Input Validation</title><
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
passing value from javascript to jsp - JSP-Servlet
passing value from javascript to jsp  Hi... Is there any way to get the value from the javascript and print it on the current jsp page or print an array onto the current jsp page using javascript  Hi Friend, We
passing values form javascript - JSP-Interview Questions
passing values form javascript  please i want to pass values from javascript function to jsp code how can i do
store input and display previous input as well current input. in jsp
store input and display previous input as well current input. in jsp  Hi Friend, In this JSP program i want display the previous input as well current inputs also. currently only current input i am able to display whenever i
html-jsp - getparameter() - JSP-Servlet
html-jsp - getparameter()  Hi! friedns, This is my front end and I want to retrieve username and password in two different jsp pages. I used... the correct code. name password: input type="submit" value="submit
Passing array to jsp - JSP-Interview Questions
Passing array to jsp   Hi, I've a page with multiple check boxes, i can select multiple boxes at a time. On submit, i wish those all records to be populated in next screen. Pls suggest how can i achieve this. Thanks
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
Parameter passing from jsp page to jsp page - JSP-Servlet
Parameter passing from jsp page to jsp page  Hi I intends to pass... Welcome :  For more information on JSP visit to : http://www.roseindia.net/jsp/ Thanks
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
JSP Comment and HTML Comment
JSP Comment and HTML Comment  Difference between JSP Comment & HTML Comment ?   JSP Comments are removed by the JSP Engine during the translation phase (JSP Comments are not even part of the compilation unit
passing the form values with image upload - JSP-Servlet
passing the form values with image upload  Hii . I want to get the solution for passing values with an image uploading form. I cant access... another text field to take the user input. Form example: 1. Enter field one
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
JSP:Passing query as parameter - Java Beginners
JSP:Passing query as parameter  Hi Friends, I have a real tough..."; String qry3="select age from table13"; string q=Insert into emp values(?,?,?); int update=prep.executeUpdate(q); prep.setString(1,qry1); prep.setString
JSP:Passing query as parameter - Java Beginners
JSP:Passing query as parameter  Hi Friends, I have a real tough..."; String qry3="select age from table13"; string q=Insert into emp values(?,?,?); int update=prep.executeUpdate(q); prep.setString(1,qry1); prep.setString
passing value fron script to scriplet - JSP-Servlet
passing value fron script to scriplet  how to pass value from Java... to the loginPage.jsp page on the server. The loginPage,jsp should something.... The loginPage,jsp should something like
html form - JSP-Servlet
html form  how to retrieve database value in dropdown list box placed in html form  Hi friend, Visit for more information. http://www.roseindia.net/jsp/ Thanks
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
Html Template - JSP-Servlet
Html Template   I use a template to design my website,but some problems arised using template.I pass flag update and insert as a hidden field on to the servlet,the response of the servlet is a jsp page.on this page template
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
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
javascript-html - JSP-Servlet
javascript-html  i want to dynamically create textfield with option button as another/remove when user presses in jsp page which will be in table.for example table contains one row with 2 columns,one textfield,second dropdown
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
HTML get Method
HTML get Method       The HTML get Method is used to submit the data of the page... Method. In this Tutorial, we create a html page name post.htm.The <form
Method in jsp - Development process
Method in jsp  Hi, wen i click submit button following data has to be store in database. Can u give me code
Implement method in Jsp - JSP-Interview Questions
Implement method in Jsp   Hi Friends, where should we implement methods in jsp(In webApplication.) in _jspService() method
HTML - JSP-Servlet
HTML   To process a value in jsp project I have to set the text box as non editable. what is the attribute and value to be submitted... code. Visit for more information. http://www.roseindia.net/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...; <html> <head><title>Using Get Method in JSP Form.<
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
Data fetching from JSP or HTML - JSP-Servlet
Data fetching from JSP or HTML  Hi Deepak, Can u pls help me as i have a problem with jsp/html frameset. my question is how can i fetch the data from frameset which is in html format.pls help me. Thanks
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: <
Override any method in servlet or jsp - JSP-Servlet
Override any method in servlet or jsp   Hi Friend, Can we override any life cycle methods in servlet and jsp.  Hi Please click on this url: http://www.roseindia.net/jsp/simple-jsp-example
html - JSP-Servlet
explain in detain and send me code. login application in jsp...; } Login Application in JSP...; ------------------------------------------ Visit for more information. http://www.roseindia.net/jsp/ Thanks Amardeep
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... be passed by using <jsp: param> This tag contains two attributes: 1) name 2
javascript-html - JSP-Servlet
javascript-html  i want to dynamically create textfield with option button as another/remove when user presses in jsp page which will be in table.for example table contains one row with 2 columns,one textfield,second dropdown
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

Ads