nishanth sai kumar addanki
html input passing to jsp method
4 Answer(s)      3 years and 7 months ago
Posted in : Java Beginners

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>
Advertisement
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 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
Advertisements
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
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 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
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 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
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 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="
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
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
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
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
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 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
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><
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 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
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
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 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
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
Parameter passing from jsp page to jsp page - JSP-Servlet
Parameter passing from jsp page to jsp page  Hi I intends to pass... :  For more information on JSP visit to : 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
Passing variable
Passing variable  How to pass variable to HTTP object in HTMl or PHP
input
input  a java program that will exchange the last names of two students that were input by a user
passing textbox value from one page to another page using html n javascript
passing textbox value from one page to another page using html n...;First Name:</td> <td><input type=text name=firstname size=10>...;input type=text name=lastname size=10></td> </tr> <tr> <