Handling multiple buttons in jsp

hi guyz,
I have a requirment where i need to handle different buttons in a single jsp form, where each button has different actions. For example, submit button , cancel button, reset button. It would b really helpful for me if any of u guyz can poste me the code . I know java script method but it wont meet my requirement.
I appreciate any suggestions or help from ur side. Thanks in advance,
B.S

by the word 'different actions' u meaned the value of action attibute in ur form tag, then i guess u will hv to use java scripts..
but if u want those buttons to perform diff actions
then for submit button u cd say < type="submit" value="submit" name="btn"submit" > it will submit the current pg to the one specified in the action attribue. similarly for reset u cd say type="reset"...
and for cancel button, if u wish to go back, then < type=button value=cancel onclick="history.back();" >

Similar Messages

  • Multiple buttons in jsp page

    Hi to all
    afteradminlogin.jsp:--
    <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
        pageEncoding="ISO-8859-1"%>
          <%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
    <%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>Insert title here</title>
    </head>
    <body>
    <h4>Select your Department</h4>
    <br>
    <html:link forward="adminbooks">Java</html:link>
    <br>
    <br>
    <html:link forward="adminbooks">.Net</html:link>
    </body>
    </html>in this page when we click on java link it has to move to the adminbooks .but it is not moving it is showing empty page in that place
    adminbooks.jsp:--
    <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
        pageEncoding="ISO-8859-1"%>
          <%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
    <%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>Insert title here</title>
    </head>
    <body>
    <input type="hidden" name="method">
    <h4>Welcome To Selection</h4>
    <table border="1">
    <tr>
    <th>
    sno
    </th>
    <th>
    Book Name
    </th>
    <th>
    Author
    </th>
    <th>
    Available No.of Books
    </th>
    <th>
    Select
    </th>
    </tr>
    </table>
    <html:submit name="add" value="add" >Add</html:submit>
    <html:submit name="edit" value="edit">Edit</html:submit>
    </body>
    </html>in this above jsp page i am using two buttons .in this page when we click on add button it has to go to another page and after submit that page that data has to add the the above table how can done that one
    where add button jsp page
    adminaddbooks.jsp:--
    <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
        pageEncoding="ISO-8859-1"%>
        %@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
    <%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>Insert title here</title>
    </head>
    <body>
    <br>
    Book Name <input type="text" name="bookname">
    <br>
    <br>
    Author <input type="text"  name="author">
    <br>
    <br>
    Available No.of Books <input type="text" name="availablebooks">
    <br>
    <br>
    <input type="submit"  value="submit" name="submit">
    </body>
    </html>strutsconfig.xml:--
    <struts-config>
        <form-beans>
        <form-bean
               name="AdminForm"
               type="org.struts.library.admin.AdminForm">
    </form-beans>
    <global-forwards>
    <forward   
                     name="userlogin"
                     path="/Logon.do"/>
            <forward
                     name="adminlogin"
                     path="/adminlogin.do"/>   
           <forward name="adminbooks"
                    path="/adminbooks.do"/>         
            <forward
                name="home"
                path="/home.do"/>
        </global-forwards>
    <action-mappings>
    <action
             path="/adminlogin"
             forward="/pages/adminlogin.jsp"/>
             <action
                  path="/adminaction"
                  type="org.struts.library.admin.AdminAction"
                  name="AdminForm"
                  scope="request"
                  validate="true"
                  input="/pages/adminlogin.jsp">
             <forward   name="success"
                        path="/pages/afteradminlogin.jsp"/>
             <forward    name="failure"
                         path="/pages/adminlogin.jsp"/>
                         </action>        
                  <action path="/adminbooks"
                         type="org.struts.library.admin.AdminBooksAction"
                        forward="/pages/adminbooks.jsp">
                  <forward name="add"
                          path="/pages/adminaddbooks.jsp"/>
                  <forward name="edit"
                           path="/pages/admineditbooks"/>
                         </action>                           
                  </struts-config>

    if you link to an action doesnt work then maybe your action is wrong but you didnt post it.
    You cannot submit a form if you dont use a form in your code
    Other general advice:
    Study Struts better and make sure you know HTML/JSP
    Get an example running and then start with a simple "Hello Struts" test with an Action that doesnt do much

  • Handling multiple buttons

    Hello all,
    I am working on project to control fluke multimeter. I got the communication and am able to read the values from it  and representing the values in graph. Here the problem comes, when i am switching the multimeter to voltmeter,ammeter and ohmmeter  it is reperesenting all the values in the single graph. Thats unfair. what i have to do is to seperate the graphs  when the event has occured like if i switch to voltmeter it has to get the values in to voltmeter graph and for the others in different graphs  w.r.t time.I attached the VI
    can anyone give suggestions on this pls!
    Thanks
    Kumar2249
    Attachments:
    basic.vi ‏31 KB

    Your basic architecture is not set up to allow changes (Volts/Ohms/Amps) after the program is started.
    You wait until the user clicks one of those and then you don't pay attention any more.
    Usually, you want the EVENT structure to be INSIDE the WHILE loop.
    When an event happens, you handle it, and then loop back for another event.
    In this case, I would have a TIMEOUT event, so that you can check the serial port every X mSec,
    Something like this:
    Repeat  {while loop }
        case EVENT of
        VOLTS button - Value Change:
            Send command for VOLTS mode to instrument
            Shift Register = 0 (VOLTS mode)
        OHMS button - Value Change
            Send command for OHMS mode to instrument
            Shift Register = 1 (OHMS mode)
        AMPS button - Value Change
            Send command for AMPS mode to instrument
            Shift Register = 2 (AMPS mode)
        TimeOut:
            if Incoming Data
                Process data into numbers.
                case Shift Reg of
                0:  Pass number to VOLTS chart
                1:  Pass number to OHMS chart
                2:  Pass number to AMPS chart
                default: do nothing
               end case
            end if
          Stop Button - Value Change
              Stop Loop
          end case
    until Stopped (end loop)
    Steve Bird
    Culverson Software - Elegant software that is a pleasure to use.
    Culverson.com
    Blog for (mostly LabVIEW) programmers: Tips And Tricks

  • Multiple buttons in JSP

    hi,
    I am using a form in a JSP page with a back-end Oracle database. The JSP page displays a row of data from a table in the database, and i have an update button next to each one of them.
    The following code is used to create the buttons:
    <INPUT type="submit" name="u<%= i %>" value="Update">
    where i is the id of the row.
    I use the following code on the next page to know which button was pressed
    if (request.getParameter("u"+i) != null){
    All I want to know if how to replace the buttons on the first page with an image source without loosing the name/value property.
    thanks

    hi,
    i found a soln of the web.
    on the form page
    <input type="image" name="image" src="image.gif" alt="image" value="image">
    on the forwarded page:
    if (request.getParameter("image.x")!=null) {
    // image button pressed
    It works as i want to, but can someone explain why I need this '.x', and why it wont work simply with request.getParameter("image")
    thank you

  • Handling Multiple buttons in WDA Intercative forms

    Hi,
    I have two buttons on Adobe interctive form in WDA, namely 1. submit  2. Reset .
    can you please help me how to determain which button has been clicked.
    with Regards,
    ShaiK Shadulla.

    Hi,
    the Submit button is special button in interactive form.
    So in web dynpro u get a SUBMIT ACTION for this (Interactive form).
    for the rest of the buttons you can use java script in form itself.
    hope this will help u.
    Regards,
    Arvind

  • Handling multiple submits in single form with JSP

    HI,
    I need to handle multiple submits in single form in a JSP.
    <html>
    <body>
    <form action="/Compute" method="post">
    <input type = "Submit" value="Find"/>
    <input type = "Submit" value="Add"/>
    <input type = "Submit" value="Delete"/>
    </form>
    <body>
    <html>
    /Compute wld take the control to a servlet named ComputeController.java .
    In this servlet how should I distinguish which Submit has been clicked(Find or add or Delete).
    TIA

    Give the submit button a name. It will be sent as well, so you can see it in the request variables.

  • Is it possible to handle multiple events using Jscript for a button in Apex

    Hi,
    I've application wherein in one of the pages for a button, I need to trigger 2 events as: 1. redirect to a new page upon 'click' of the button
    2. display a set of values on 'mouse over' that button.
    I'm able to handle both separately, but not in one button. I would like to know if there is any limitation in Apex that we cant handle multiple events? Currently I've put a text item near the button, and called the Jscript for mouse over event in that as a temporary workaround. Can someone let me know if this is feasible? If not any other alternative to handle this?
    Thanks in advance,
    gsachidh

    Hi Gsachidh,
    well interesting problem you're facinng. Indeed, it can't be specified using the 'Button Attributes' So we have to come up with an workaround.
    A quick en dirty solution would be to specify it with the 'Optional URL Redirect options'. In a normal button, with processing on same page, this would be 'no target'. but in case of additional things to be done this can be used, using an target URL. I used this many times, in example with popUp windows for refreshing the caller object when changes are made. In your case we have to add next to the href an onmouseover event. this can be done with;
    Target set to => URL
    URL - target => javascript:doSubmit('<button_name>');" onMouseOver="javascript:showTooltip('tooltip');"
    Here the " is the key, letting ApEx know the target (href) is doSubmit('<button_name>'), just like when no target would be specified and adding a new javascript event; onMouseOver.
    Although this is a dirty solution in my opinion, it is the best i could come up with. I have another idea in how to do this, that is by adding this event dynamically with javascript with an addEvent. But i don't have an example at the moment for this scenario.
    Simon
    Message was edited by:
    S1M0N

  • How to create multiple toolbar buttons in jsp ?

    hi all,
    how to create multiple toolbar buttons in jsp ?
    plz help me

    mgmt
    plzhttp://www.catb.org/~esr/faqs/smart-questions.html#writewell
    How To Ask Questions The Smart Way
    Eric Steven Raymond
    Rick Moen
    Write in clear, grammatical, correctly-spelled language
    We've found by experience that people who are careless and sloppy writers are usually also careless and sloppy at thinking and coding (often enough to bet on, anyway). Answering questions for careless and sloppy thinkers is not rewarding; we'd rather spend our time elsewhere.
    So expressing your question clearly and well is important. If you can't be bothered to do that, we can't be bothered to pay attention. Spend the extra effort to polish your language. It doesn't have to be stiff or formal ? in fact, hacker culture values informal, slangy and humorous language used with precision. But it has to be precise; there has to be some indication that you're thinking and paying attention.
    Spell, punctuate, and capitalize correctly. Don't confuse "its" with "it's", "loose" with "lose", or "discrete" with "discreet". Don't TYPE IN ALL CAPS; this is read as shouting and considered rude. (All-smalls is only slightly less annoying, as it's difficult to read. Alan Cox can get away with it, but you can't.)
    More generally, if you write like a semi-literate b o o b you will very likely be ignored. So don't use instant-messaging shortcuts. Spelling "you" as "u" makes you look like a semi-literate b o o b to save two entire keystrokes.

  • Multiple submit button on jsp

    Hello,
    Can I have multiple submit button on single JSP page?
    if its possible then tell me how?
    And how to call multiple functions in JSP?
    reply me urgent

    I think this code will help you
    <html>
         <head></head>
         <script>
              function submitForm(clickedButton){
                   if(clickedButton.name =="button1"){
                        alert("button1");
                        document.multipleSubmitDemoForm.action="linkToJSPWhenFirstButtonClicked.jsp";
                   }else if(clickedButton.name =="button2"){
                        alert("button2");
                        document.multipleSubmitDemoForm.action="linkToJSPWhenSecondButtonClicked.jsp";
                   }else if(clickedButton.name =="button3"){
                        alert("button3");
                        document.multipleSubmitDemoForm.action="linkToJSPWhenThirdButtonClicked.jsp";
                   document.multipleSubmitDemoForm.submit();
         </script>
         <body>
              <form name="multipleSubmitDemoForm" method="POST" action="" >
                   <input type="button" name="button1" onClick=submitForm(this) />
                   <input type="button" name="button2" onClick=submitForm(this) />
                   <input type="button" name="button3" onClick=submitForm(this) />
              </form>
         </body>
    </html>

  • How to handle Back button, Browser Refresh problem at server side.

    Hi Friends,
    How to handle Back button, Browser Refresh problem at server side in java?.
    I am able to trace that,
    request.getHeader("ACCEPT") is returning value- */*
    when the browser was refreshed and returning different MIME types
    for all other actions from browser.
    I have doubt, will the above solution works always for all servers,browsers?.
    Please also specify any solution to handle back button at server side?.
    Thanks in Advance.
    Venkat..

    I'm sorry I don't think tht's the right solution for
    the above question....
    We must be aware that whatever scripting methdologies
    we either javascript/vbscript would executed @
    client(browser) side not @ server side....
    Dud If U get a good solution keep me updated.....
    THANKS & REGARDS,
    RAHULMy dear friend ...
    the bad news is that u simply cant disable or add any listener to the back button of the browser.
    When u hit the back button of ur browser the URL gets re-executed. So in case u have a JSP then the history.forward() is the best solution. [only if the page doesnt get expired similar to secure https sites]
    Now dont say that user can have javascript disabled ...those users will have a pretty touch time browsing websites since javascripts r used extensively by almost all websites.
    But in case u have an action.do or servlet call then u need to manage it using a session variable since the request will be sent to the server rather than client.
    For multiple form submittion issues read the following article in javaworld...
    Client vs. server solutions
    Different solutions can solve this multiple form submission situation. Some transactional sites simply warn the user to wait for a response after submitting and not to submit twice. More sophisticated solutions involve either client scripting or server programming.
    In the client-only strategy, a flag is set on the first submission, and, from then on, the submit button is disabled based on this flag. While appropriate in some situations, this strategy is more or less browser dependent and not as dependable as server solutions.
    For a server-based solution, the Synchronizer Token pattern (from Core J2EE Patterns) can be applied, which requires minimal contribution from the client side. The basic idea is to set a token in a session variable before returning a transactional page to the client. This page carries the token inside a hidden field. Upon submission, request processing first tests for the presence of a valid token in the request parameter by comparing it with the one registered in the session. If the token is valid, processing can continue normally, otherwise an alternate course of action is taken. After testing, the token resets to null to prevent subsequent submissions until a new token is saved in the session, which must be done at the appropriate time based on the desired application flow of control.
    for more details refer :
    http://www.javaworld.com/javaworld/javatips/jw-javatip136.html
    Hope u got the idea.
    FYI I have been using both these ideas in my credit card payment gateway project. This concept has worked really well.

  • IE running under XP can't handle multiple SWF files, Why?

    I noticed that IE 8 running under Windows XP cannot handle multiple swf files in one page.
    Up to about 10 files is no problem they are loaded and we can play them ( buttons that start a small audio file).
    But more of these files in one page will stop IE.
    Firefox ( 3.6.28) runs them fine.
    And also IE 8 and/or Firefox under Windows 7 handles them perfectly.
    Has anyone any idea what can cause this and how to resolve this?
    Thanks,
    Onno Tomson
    The Netherlands

    Sorry...I still don't get it. What is it about Windows FUS that keeps iTunes from running running the process twice? It can run many other non-Apple windows apps in multiple user sessions (commercial apps, open source apps, audio/video apps, networked apps). I can even run two different virtual machines at the same time under two different user sessions.
    Why can iTunesHelper.exe run twice but iTunes.exe cannot? Why can I run Safari at the same time? Quicktime Player runs fine under multiple user sessions.
    Blaming it on Windows and/or FUS sounds like FUD. Can anyone give a valid technical reason? Semaphores? Mutexes? An admission (and explanation) that the Windows version is purposely crippled?

  • MVC �Best Practice� (handling multiple views per action/event)

    Looking for the best approach for handling multiple views for one action/event class? Background: I have a small application using a basic MVC model, one controller servlet, multiple event classes, and multiple JSP views. For performance reasons, the controller Servlet is loaded once, and each event class is an instance within it. Each event has an �eventProcess()� and an �eventForward()� method called by the controller, standard stuff.
    However, because event classes should not use instance variables, how should I communicate which view to forward to should based upon eventProcess() logic (e.g. if error, error.jsp, if success, success.sjp)? Currently, there is only one view mapped per event, and I'm having to put error handling logic in the JSP, which goes against the JSP being for just view only.
    My though was 1) A session object/variable that the eventProcess() sets, and the eventForward() reads, or 2) Have eventProcess() return a mapping key and have the conroller lookup a view page based upon that key, as opposed to 1-1 event/view mapping.
    Would like your thoughts!
    Thanks
    bRi

    Your solution seems ok to me, but maybe the Struts framework from Apache
    that implements MVC for JSP is a better solution for you:
    http://jakarta.apache.org/struts/index.html
    You should take a look at it. It has in addition some useful taglibs that makes life much easier.
    We have successfully used it in a project with about 50 pages.

  • Urgent : OBIA - Handling multiple Global, Local and Document Currencies

    All,
    I need input on how to configure multiple currency codes in DAC for OBIA 7.9.6.x
    My client's business goes around the the world and with multiple local currencies.They also need reporting currency to be multiple like in Euro, USD etc.
    I went through a couple of threads in this forum,like -
    Re: Configuring Global Currencies in BI Apps 7.9.6 for EBS 11.5.10 Source
    Re: How we are using Global, Local and Document Currencies  in DAC.
    But I have some confusion regarding the configuration of DAC's 3 Global currency codes.
    In order to fulfill my requirement - should I add additional codes in DAC?
    Basically How am I supposed to handle multiple Local,Document and Global currencies? And then possible changes in rpd/reports required also?
    Regards,
    Krish

    Currencies are discussed in the Setup and Configuration Guide here:
    7.1.1.2 How to Configure Global Currencies
    To configure the global currencies you want to report in your warehouse:
    In the DAC Client, display the Design view.
    For more information about logging into the DAC, see Section A.1, "How to Log Into the DAC Client".
    Select a container from the drop down list to the right of the Execute button.
    Display the 'Source System Parameters' tab.
    Locate the following parameters and set the currency code values for them in the 'Value' box:
    $$GLOBAL1_CURR_CODE (for the document currency).
    $$GLOBAL2_CURR_CODE (for the local currency).
    $$GLOBAL3_CURR_CODE (for the global currency).
    Make sure that you spell the currencies as they are spelled in your source OLTP system.
    Save your changes.
    As far as for PLP items, those are Post Load Processing elements that perform cleanup tasks after the Base Warehouse tables have been loaded. They should never be modified and frankly run without any issues provided the rest of the plan executes properly. Do you have a specific quesiton about a PLP?

  • Handling Multiple Error Messages through EXIT_SAPMM06E_012 for ME28

    Dear Team,
                           After Executing ME28, system will give List of PO's that are to be Released . User will select Multiple  PO's and
    Press Release button in Application toolbar. once it is relased, User will press save Icon for all released PO's. 
    Once Save icon is presed, I need to  do  Validation for Multiple PO's in the user Exit EXIT_SAPMM06E_012 and capture my
    ErrorMessages for all Released PO's for which Validation fails.
    Here in the given user Exit, one PO will be processed at a time as PO is defined as Import Parameter but it will handle all PO's
    and give the output in status bar saying 'Relased Saved' for all PO's which succesfully gonethrough.
    once we execute ME28, system is showing list output with PO's to be Released(As system is handling with Write statments). In this case, we dont have scenario of PBO and PAI Modules( where user can correct error if any validation fails) like we have for ME22,etc.
    I have Written simpel Error Message in the  User Exit.
    once i tried to trigger my user exit  by Releasing and Saving with One PO, Error Message is displayed ( as information Message
    appears) and if i Press Exit button in Error Message, it is coming out of Transaction.
    Is there any Possibilty to Handle Multiple Error Messages ( in my case for  Valdiation Failed Po's)  in ME28 ,after Releasing and Saving , and also user should not come out of Transaction once  Error Messages are Displayed.
    Thanks and Regards
    Suresh

    Hi Suresh,
    there is a tekpo table to handle all po items. you can put it in loop and do validations.
    if any errors through, there may be a ex_messages table of type bapiret2.
    or
    try like this:  MESSAGE E368(00) WITH TEXT-001 TEXT-002.
    thanks
    srinu
    Edited by: srinu rao on Sep 22, 2009 3:43 AM

  • Handling Multiple checkboxes iin ALV list??

    Hi,
    I have a requirement of generating a list with multiple checkboxes corresponding to each line/row of the list..Based on the selection of some/all the rows of the list I have to invoke some functionality on the click of some button..
    I am able to get the chk-boxes on the list also i have got the button on the std PF-status of ALV list, but I am not able to handle multiple selection of the chk-boxes??
    plz help..

    On the field catalog definition for the amount field pass CFIELDNAME as the <currency> fieldname. if this is maintained, i would assume it will solve your issue.
    Say for example, the amount field is AMOUNT and the corresponding currency fieldname is 'CURRENCY', the field catalog for this field should be filled in something like this.
    t_fieldcat-fieldname = 'AMOUNT'.         "amount field name
    t_fieldcat-tabname = 'IT_FINAL'.           "internal table name
    t_fieldcat-cfieldname = 'CURRENCY'.   "currency field name which will be referred
    append t_fieldcat.
    Hope this helps.
    Thanks,
    Balaji

Maybe you are looking for

  • Mac Mini slow to respond

    Hi. I've had this unibody Mac Mini for a while, but over the last few months it has been very slow to repond - to clicks, app launches, everything. Almost all menu clicks take 3 seconds to react, and sometimes incur pinwheeling for up to a minute. So

  • RE 2 bent machines

    I replaced mb, testing it first out of case, just psu 1cpu, 1 stick of mem and graphic card, powered up right away, and no probs at that point. tested old board 3 beeps, and no function. Sooooooooooo. Here is where i stand, new mb almost works flawle

  • How to view crawled documents of file system in the browser using sharepoint search

    Hi, I think this should be pretty obvious. However, somehow I am not able to do it. Here is what i am working on: I created a folder on my D:\ drive on the SharePoint server. Added a few word documents there.Created a new content source in my Search

  • Invoice tabs in po

    hi, i am new to sap pl help me in po in item , in invoice tab-what are the use of below tab :- inv-receipt final invoice gr-based iv ers Thanks in advance Regards Prashanth.v

  • DVT-26000: unable to find connection in 'mapConfig1'

    I am using the Oracle MapViewer. Map Viewer: http://elocation.oracle.com/mapviewer Geocoder: http://elocation.oracle.com/geocoder/gcserver Everytime I run the application I get the following error: DVT-26000: unable to find connection in 'mapConfig1'