find out in servlet which button was clicked on an html page

find out in servlet which button was clicked on an html page

i have two buttons on my jsp page... and i want two call two seperate codes in a servlet on pressing of those 2 buttons.. how do i find out which button was clicked so as to call that respective method.

View Answers

April 9, 2012 at 4:36 PM

<html>
<head>
<SCRIPT>
function submitFunction(i) {
if (i=='Roseindia') document.theForm.action="http://www.roseindia.net";;
if (i=='Newstrackindia') document.theForm.action="http://www.newstrackindia.com";;
if (i=='Javajazzup') document.theForm.action="http://www.javajazzup.com";;
document.theForm.submit()
}
</SCRIPT>
</head>
<body>
<h1>Multiple Buttons Example</h1>
<FORM NAME="theForm">
<INPUT TYPE="button" VALUE="Roseindia" onClick="submitFunction('Roseindia')">
<INPUT TYPE="button" VALUE="Newstrackindia" onClick="submitFunction('Newstrackindia')">
<INPUT TYPE="button" VALUE="Javajazzup" onClick="submitFunction('Javajazzup')">
</FORM>

</body>
</html>

For more information, visit the following link:

http://www.roseindia.net/servlets/web-application.shtml

Ads









Related Tutorials/Questions & Answers:
find out in servlet which button was clicked on an html page
find out in servlet which button was clicked on an html page  i have two buttons on my jsp page... and i want two call two seperate codes in a servlet on pressing of those 2 buttons.. how do i find out which button was clicked so
extract data fom table when a button is clicked in front end page using mysql5.0 and tomcat6.0
extract data fom table when a button is clicked in front end page using mysql5.0 and tomcat6.0   sir, i want to extract data from table which is stored in mysql5.0 databse, when a button is clicked in front end page using
Advertisements
Which request executed first Out of multiple requests in servlet
Which request executed first Out of multiple requests in servlet  Servlet handles multiple request simultaneously.Every new request will be assigned... to servlet ,which request will be executed first , please correct me if question
HTML Button Size
HTML Button Size       Button in HTML is used to submit HTML page. Understand with Example... a HTML page, which display you  HTML Button  with  attribute width
how to execute the below servlet with html page
how to execute the below servlet with html page  //vallidate user n...,ServletException { res.setContentType("text/html"); PrintWriter out=res.getWriter...(); response.setContentType("text/html"); PrintWriter out=response.getWriter(); pw.println
Login Box appears when a button on the webpage is clicked
Login Box appears when a button on the webpage is clicked  How to create a Login Box on a web page that appears only when a button that is already present on the page is clicked
Login Box appears when a button on the webpage is clicked
Login Box appears when a button on the webpage is clicked  How to create a Login Box on a web page that appears only when a button that is already present on the page is clicked
Login Box appears when a button on the webpage is clicked
Login Box appears when a button on the webpage is clicked  How to create a Login Box on a web page that appears only when a button that is already present on the page is clicked
Save the content in my wysiwyg editor into specified location of user when clicked on save button in my web page
Save the content in my wysiwyg editor into specified location of user when clicked on save button in my web page  I am using wysiwyg editor to display some static content.My requirement is that This static content can be edited
html button
html button  when i click the submit button the entered data will be displayed below the submit button please help me
Button Size HTML
HTML Button Size can be changed according to programmer use. HTML button submits HTML page. In the following example we will learn how to change the size of a HTML button. First we create a HTML page. Then we display a HTML Button
how to call servlet from html page at anchor tag ?
how to call servlet from html page at anchor tag ?  I have a very... to other page and at that place i give url of a servlet but in server that url... it is not working properly. I split and merge template. In the header part of my page i use
how to add the calendar to the dynamic rows in html or jsp page - JSP-Servlet
how to add the calendar to the dynamic rows in html or jsp page   Hi Sir, i have 3 columns in my jsp page date of payment,amount recieved,no and i have 2 button in my jsp page ADD and delete button. when i click on add
Find focus of the keyboard cursor when ctrl+f is clicked in swing
Find focus of the keyboard cursor when ctrl+f is clicked in swing  Hi, I have created one small swing applications with two textarea. I want... somebody please tell me ..How to find a component which had the focus
Maven Dependency html-servlet >> 0.0.2
You should include the dependency code given in this page to add Maven Dependency of cat.inspiracio >> html-servlet version0.0.2 in your project
Maven Dependency html-servlet >> 0.0.3
You should include the dependency code given in this page to add Maven Dependency of cat.inspiracio >> html-servlet version0.0.3 in your project
html and servlet file
html and servlet file  where to place the html and the servlet class... html file with the jsp files amd servlet file insdie classes folder of tomcat. You have to specify the full path of servlet on html action if you want to call
regarding out put display in html text field
regarding out put display in html text field  how to dispaly the output coming from servlet in a particular text field of html
facebook login button html
facebook login button html  facebook login button html i have a facebook login button code ..but not sure how to use it. Can any one please explain? Here is the facebook login button code in html <fb:login-button
next button in servlet
next button in servlet  i want to add next,previous button to get next record in my servlet. can you explain the logic to do
Find out last character of array
Find out last character of array  How we can find out the last character of array in java program
Create an HTML file AddCookies.html which contains four text boxes
Create an HTML file AddCookies.html which contains four text boxes  Create an HTML file AddCookies.html which contains four text boxes .When user enters the values in these text boxes and press the submit button, the values
jsp :how to edit table of data displayed using jsp when clicked on edit button
the data when clicked on save button.. how can i do...jsp :how to edit table of data displayed using jsp when clicked on edit button  i have a jsp program which displays data in the form of table ..now i
HTML Button onclick get ID of Button
HTML Button onclick get ID of Button  How i can get the ID of HTML Button on click?? I wanted to do it using JavaScript function. Thanks
How to find a servlet object by name?
How to find a servlet object by name?  How can we locate a servlet object in the code by it's object name?   A. In web.xml you map servlet and define url pattern. Now this url-pattern is used for calling servlet. <
Find out the prime number
Find out the prime number      ... to find out whether a given number is prime or not. Here we have used the 'for loop...;} } Download this page
Radio Buttons in HTML
Radio Buttons in HTML       The Radio Button in HTML are type of input form, which allows...; html page, when it is clicked. The  Output result is sent to the specified
jsp :how to edit table of data displayed using jsp when clicked on edit button
want to edit this information in table when clicked on edit button and save the data when clicked on save button.. how can i do this   The given..., there is a button which consists of that particular id. When the user clicks
HTML Login Page Code
HTML Login Page Code Here is an example of html login page code... on their credentials. For making login page for websites HTML form and HTML elements... using JavaScript. In this tutorial we are creating a HTML Login page code
HTML Code for registration form
form their is a "ADD" button behnd which any desired link can be used. Once...HTML Code for registration form Here is an example of Registration form using HTML. Here a programmer can display as many "Text Field" as he/she wants
Refresh Button returns null point exception when clicked
Refresh Button returns null point exception when clicked  Dear all Please assist with the following: How to rectify a piece of code for the refresh button in java. When clicking the button it returns an error "null point

Ads