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









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
Find currenly which field is having focus on html page? - Ajax
Find currenly which field is having focus on html page?  Hi All... in Category. My problem is I have two form on single html page with two different... don't know which form user want's to be submit. So I am trying to get which field
Advertisements
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
get a value when a radio button clicked - JSP-Servlet
get a value when a radio button clicked  sorry sir my actual probs... button to access a value(also used u r code),then in this jsp i m having a forms to call a servlet,then in a servlet i m using a switch case to call a jsps
get a value when a radio button clicked - JSP-Servlet
get a value when a radio button clicked  Here is my code sir please...(servlet) package com.antares.servlet...(); response.setContentType("text/html"); String strAct = request.getParameter
HTML Button Size
HTML Button Size       Button in HTML is used to submit HTML page. Understand with Example ADS... we create a HTML page, which display you  HTML Button  with 
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
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
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
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
html button
html button  when i click the submit button the entered data will be displayed below the submit button please help me
How to pass parametes from JSP page to HTML page? - JSP-Servlet
with the username in HTML which I have called in JSP page. So I just want to pass the values from my JSP page to HTML page. Pls help me out. Hitendra ...How to pass parametes from JSP page to HTML page?  Hi all, In my
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
Using a image for Browse button instead of normal html Browse button for Uploading files from a JSP - JSP-Servlet
Using a image for Browse button instead of normal html Browse button... a Upload button, when I upload the file selected, it gives me errors. Is it not possible to use a image instead of normal html Browse button for uploading files
Struts + HTML:Button not workin - Struts
Struts + HTML:Button not workin  Hi, I am new to struts. So pls... ----------- System.out.println(searchForm.get_button_Clicked()); The above statement displays "null"; I have defined button_clicked in bean class. I thought when i
how to remove spell check in flex when button is clicked
how to remove spell check in flex when button is clicked  how to remove spell check when button is clicked in rich text editor control
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
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><
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
Html/JavaScript code - JSP-Servlet
-- ${row.id} --JSP2-- which has the return button and action leads... to the corresponding page and highlight the corresponding row that was clicked...Html/JavaScript code  I have 2 JSPs JSP1 and JSP2. 1.in JSP1 i
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
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
Calendar window is not coming for the Dynamic rows in html page - JSP-Servlet
Calendar window is not coming for the Dynamic rows in html page  Calendar window is not coming for the Dynamic rows in html page. I have 3 textboxes. one column is having the date textbox .I need to add the calendar icon
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
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
create a button in html
create a button in html  How do I create a button which acts like a link
PHP HTML Form Submit Button
Topic : HTML FORM SUBMIT BUTTON Part - 4 The another part which is important... and the Method attribute will ask in which it should be sent to the other page. The Submit button in Html is used to submit form data to the page mentioned
Servlet Generates HTML
Servlet Generates HTML  How Servlet Generates HTML ?   Servlet chaining is a technique in which two or more servlets can cooperate in servicing a single request. In servlet chaining, one servlet?s output is the input
HTML Code for registration form
form their is a "ADD" button behind which any desired link can be used. Once clicked it will redirect to that particular destination. HTML online forms...HTML Code for registration form Here is an example of Registration form using
Find out the prime number
Find out the prime number       This lesson of Java programming language will teach you the coding to find out whether a given number is prime or not. Here we have used the 'for loop
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
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
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
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
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 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
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
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
Sending form data from HTML page to SQLserver 2005 database by calling servlet code
Sending form data from HTML page to SQLserver 2005 database by calling servlet... from html page to database by calling servlet code from html page .   ...; ResultSet rs; res.setContentType("text/html"); PrintWriter out
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... But in this tutorial you will learn to create a login page in HTML and validate
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
Displaying image when clicked on URL in jsp - JSP-Servlet
*.jpg images displayed depending upon the page url clicked. Please guide me...Displaying image when clicked on URL in jsp  Hi, I am using... For Screenshot : abc.jpg here abc.jpg is a url and when clicked would show me an image
Print out html markup with h:outputText
Print out html markup with h:outputText  How to print out html markup with h:outputText
Radio Buttons in HTML
Radio Buttons in HTML       The Radio Button in HTML are type of input form, which allows... element in  html page, when it is clicked. The  Output result is sent
Write an applet that prints "Lear Java it is useful" at the current cursor position whenever the mouse left button is clicked.
Write an applet that prints "Lear Java it is useful" at the current cursor position whenever the mouse left button is clicked.   Write an applet... the mouse left button is clicked
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. <
html menu button drop down
html menu button drop down  How to create a menu button in HTML?   <select id="category"> <option value="1">One</option> <option value="2">Two</option> </select> <select id

Ads