Working with two buttons in jsp

hi
My working with jsp's in struts.
I have a jsp with two buttons "Save" and "Delete".
My requirement is, on clicking either the "save button" or "Delete button" in jsp, it should call the corresponding code in the Action class.
wht is the logic required to call the corresponding code in the Action class ?
Thanks

hi
Thanks nani and jHyena for ur reply , but its not working, can u tell me where i went wrong, how to set them in jsp and action class.
This is my Action class
public class EditUserDetailsAction extends Action {
      * Generated Methods
      * Method execute
      * @param mapping
      * @param form
      * @param request
      * @param response
      * @return ActionForward
     public ActionForward execute(ActionMapping mapping, ActionForm form,
               HttpServletRequest request, HttpServletResponse response) throws DaoException {
               System.out.println("---------------in execute() befor try/catch-----------");
//**************************the problem is here calling in if()/else, how should i call i?**************      
      if() {
                try{
                    EditUserDetailsForm editUserDetailsForm = (EditUserDetailsForm) form;
                    System.out.println("------------ execute()-----------------");
                    DaoImplementer daoImpl = new DaoImplementer();
                    Integer editUid       = (Integer) editUserDetailsForm.getUser_Id();
                    String editName       = (String)  editUserDetailsForm.getName();
                    String editTitle      = (String) editUserDetailsForm.getTitle();
                    String editEmail      = (String) editUserDetailsForm.getEmail();
                    Integer editTelephone = (Integer) editUserDetailsForm.getTelephone();
                    String  editUserName  = (String) editUserDetailsForm.getUserName();
                    String editPassword   = (String) editUserDetailsForm.getPassword();
                    daoImpl.registerUser(editUid, editName, editTitle, editEmail, editTelephone, editUserName, editPassword);
                    System.out.println("------------sent to model components---------------");
                    System.out.println("----------forwarding to edituserdetail.jsp----------");
                    return mapping.findForward("editUserDetails");
               catch (Exception e) {
                    System.out.println("@@@ ---Exception in EditUserDetailsAction class--@@@@");
                    throw new DaoException("Error adding userDetails: ",e);
               return mapping.findForward("addUserDetails");
Here is the jsp
<html:html locale="true">
  <head>
    <html:base />
    <title>editUserDetails.jsp</title>
    <script type="text/javascript">
         function save_display(){
              var x = confirm("Save: Are you sure ?")
              if( x == true ){
                   confirm("Save: OK")
              else{
                   text("Save: Cancelled")
         function delete_display(){
              var y = confirm("Delete: Are you sure ?")
              if( y == true ){
                   confirm("Delete: OK")
              else{
                   alert("Delete: Cancelled")
         function funSave(){
              document.form[0].ID.value = id;
              form[0].ID.value.action="<%=request.getContextPath()%>/division/editDesignation.app?save=save";
               form[0].ID.value.method="post";
               form[0].ID.value.submit();
         function funDelete(){
              function funSave(){
                    document.form[0].ID.value=id;
                    form[0].ID.value.action="<%=request.getContextPath()%>.app?save=save";
                    form[0].ID.value.method="post";
                    form[0].ID.value.submit();
    </script>
     <meta http-equiv="pragma" content="no-cache">
     <meta http-equiv="cache-control" content="no-cache">
     <meta http-equiv="expires" content="0">   
     <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
     <meta http-equiv="description" content="This is my page">
     <!--
     <link rel="stylesheet" type="text/css" href="styles.css">
     -->
  </head>
  <body>
  <html:javascript formName="editUserDetailsForm"/>
  <html:form action="/editUserDetails" onsubmit="return validateEditUserDetailsForm(this);">
               user_Id : <html:text property="user_Id"/><html:errors property="user_Id"/><br/>
                  name : <html:text property="name"/><html:errors property="name"/><br/>
                 title : <html:text property="title"/><html:errors property="title"/><br/>
            telephone : <html:text property="telephone"/><html:errors property="telephone"/><br/>
                 email : <html:text property="email"/><html:errors property="email"/><br/>
             userName : <html:text property="userName"/><html:errors property="userName"/><br/>
             password : <html:password property="password"/><html:errors property="password"/><br/>
                       <html:submit property="save" value="Save"  onclick ="funSave()"/>
                       <html:cancel property="delete" value="delete" onclick="funDelete()"/>
  </html:form>
  </body>
pls let me know how to set the hidden variables within the  above jsp .
and  in Action class how to call it.
I would be very thankful to u guys.
Thanks

Similar Messages

  • I have recently installed Mavericks and since then I have been unable to shut down or log out of my mac.  I work with two screens and now I seem to have programmes at the top of both screens which I didn't before.  any advice?

    I have recently installed Mavericks on my desk top and since then I have been unable to switch off my computer without crashing it. I work with two screen and now I seem to have the menu bar on the second screen as well which I did not have before.  Can you please help me?

    Dr Bettina, I had similar problems with Mavericks. I installed it on a Mini and a 13" MacBook Pro. I can't speak to your disdplay issues, but I can confirm the inability to logout, shut down, or restarft without a forced, power button shut down. I can also report frequent System Prefs freezes and finder issues, like folder contents taking half a minuite or more to render, or not appearing at all. And while a few Adobe CC apps actually ran faster, InDesign ran like molasses uphill in Decemner.
    I tried uninstalling or disabling numerous 3rd party apps and pref panes. I unplugged everything but the keyboard, ran DiskWarrier, repaired permissions, did fsck -f, trashed various preference files, reinstalled the OS... You name it, and I tried it — short of a potion using eye of newt.
    After two days of totally hosed productivity, I restored OS 10.8.5 on the Mini so I could actually get some work done. However, I've decided to leave Mavericks on the MBP as a sort of crash dummy, and will install and thoroughly test all updates until stability has been achieved. Then — and only then — will I upgrade the Mini to Mavericks, even if it means waiting 'til a .2 or even .3 update.
    Good luck to you...

  • Is there a way to work with two or more app at the same time on iPhone or iPad

    Is there a way to work with two or more app at the same time on iPhone or iPad?

    What i am attempting to achieve is to work with at least two app at the same time. For example: select any picture from my albums to attach them in an email. Another example is get data from an app to use it with the calc app. And there are more exaples for it. And for sure I need support for an iPad air. I mencioned the other tablet just to try to be a bit clearer.

  • Can you setup handoff to work with two mac computers on the same network?

    I am attempting to setup handoff to work with two computers on the same network. I cannot seem to get it to work. Should I be able to?

    I'm not sure but I haven't seen anything on the Apple site that indicates that it would not work. The following troubleshooting documents may help: Get help using Continuity with iOS 8 and OS X Yosemite - Apple Support
    Note in particular the Mac models supported. The other thing that occurs to me is that in addition to being on the same network they would have to be within Bluetooth range of each other.

  • Apex mixes applications working with two windows at the same time

    Hi all, while developing in Apex I have found the following problem:
    Working with two different applications at the same time, the browser goes from one to another indistinctly.
    To reproduce the problem:
    1. Open the same application builder in two different Firefox windows
    2. Open a different application in each window (In my case: application 103 in window1 and application 105 in window2)
    3. Go to shared components in both windows (window1 first)
    - window1 breadcrumbs show: Home > Application Builder > Application 103 > Shared Components
    - window2 breadcrumbs show: Home > Application Builder > Application 105 > Shared Components
    4. Click in any shared component in window1 (Templates, Authentication Schemes...)
    - window1 breadcrumbs show: Home > Application Builder > Application *105* > Shared Components > Templates (Application 105 instead of 103)
    Is it a bug? I have read the known issues [[Here]|http://www.oracle.com/technetwork/developer-tools/apex/downloads/apex402knownissues-189793.html] but it does not appear.
    Related Data:
    Application Express version 4.0.2.00.07
    Firefox 3.6.15
    SO: Windows XP
    The error is not reproduced with IE7. I have not tested any other browser.
    Regards,
    Molina

    If you tried opening up two pages in the same application each of which modifies the same page items, you would notice the same issue.
    This is because, in a session there is only one set of values for page items(or application items) and every parallel call to the same page would update the same bind variables.
    Now the development environment or Apex Builder is also an apex application , and when try and open up the pages as you mentioned, they both access the same Application Builder page and sets/resets any existing values for those variables(and maybe cookies too if they are being used) , hence the 'mixing up'.
    If that didn't convince you, check the URL of both the pages when you load them, they should show the same page number ( f?p=APP_ID:PAGE_NUMBER syntax). Imagine if the same approach was done with one of your application pages, say an edit form opened from a report with multiple records in multiple tabs like what happened with this case: {message:id=9346663}
    So this really isn't a bug in a way, because that is how session states in apex is/was maintained. Ofcourse if they used another kind of development platform for building pages, it may have been avoided, but thats an altogether different point in itself.

  • HT201343 I bought my macbook pro on August 2011 at an apple store, with the Intel i7. However mirrorring in not working with two of my Apple TVs. These Apple TVs are 2nd and third generation loaded with the latest software. Can someone help?

    I bought my macbook pro on August 2011 at an apple store, with the Intel i7. However mirrorring in not working with two of my Apple TVs. These Apple TVs are 2nd and 3rd generation loaded with the latest software. I can succesfully transmit from my itunes on my Macbook pro to both Apple TVs, but I can not see the airplay icon on the taskbar. Can someone help?

    About AirPlay and Airplay Mirroring
    AirPlay Mirroring requires a second-generation Apple TV or later, and is supported on the following Mac models: iMac (Mid 2011 or newer), Mac mini (Mid 2011 or newer), MacBook Air (Mid 2011 or newer), and MacBook Pro (Early 2011 or newer). For non-qualifying Macs you can try using Air Parrot.
    Several Apple Articles Regarding AirPlay
    Apple TV (2nd and 3rd gen)- How to use AirPlay Mirroring
    How to set up and configure AirPort Express for AirPlay and iTunes
    About AirPlay Mirroring in OS X Mountain Lion
    iTunes 10- About playing music with AirPlay
    Troubleshooting AirPlay and AirPlay Mirroring
    Using AirPlay

  • Works with two component iu in the same PDA

    HI:
    I have two componentes IU in Mobile 7.1 patch07 for handhelds.
    I need to access a view from one componente iu to another view of another componente iu.
    Can I work with two componet iiu n the same PDA and have communication from one to another?
    Best Regards.
    Maria Elena

    HI:
    There any way to configure the main menu of SAP Mobile 7.1 where you have applications that are deployed in the PDA?
    De esta manera podría crear más de un componente dentro de una aplicación y poder tener más de un link en el menu principal
    Best regards
    Maria Elena

  • Why does final cut x not recognize the sharp PN- K321 monitor ( European version ) as output video monitor and premiere it? Working with two cinema display and PN- K321 and I can not preview the output video at 4K for DisplayPort, whereas with premie

    Why does final cut x not recognize the sharp PN- K321 monitor ( European version ) as output video monitor, and premiere yes?
    Working with two cinema display and PN- K321 and I can not preview the output video at 4K by DisplayPort, whereas with premiere and after effects I have no problems

    Look, you can build an HD DVD with an SD movie, just as you can build an SD DVD with an HD movie. This is not a bug, it is most likely user error. Apple will not be addressing it.
    Just start over, and ensure you are building an SD DVD by bringing up the inspector for the disc (click on the background in the Graphical tab).
    Make sure SD DVD is selected:
    (If you do the same thing on your ill fated project, you'll see that HD DVD is selected)
    Build your DVD and you'll be fine.
    Patrick
    P.S. You will need to google HD DVD and Blu-Ray if you want to understand the difference between the formats. The reason that DVDSP included HD DVD was that its format was similar to SD DVD's. Blu-Ray is something else entirely.

  • Working with two or more tables in Numbers

    Working with two or more tables in Numbers
    It is possible to write numbers or names in Table 1 B-2, B-3, B-4, B-5, B-6 etc. and automatically copy in Table 2 only B-2, B-4, B-9, B23 etc.
    What do I need to do???
    Thanks for the help

    The table on the left is named "Source" and on the right "Destination":
    In the table "Destination" on the right:
    B2=Source :: B2
    select B2 and fill down

  • I am working with two computers in my profession (Mac/PC). I want to download testversions, lets say Premiere Elements 13, for Mac and PC using my adobe login. Is this possible?

    I am working with two computers in my profession (Mac/PC). I want to download testversions, lets say Premiere Elements 13, for Mac and PC using my adobe login. Is this possible?

    Sure. Elements is cross-platform, anyway.
    Mylenium

  • Working with two cams

    I have shots from two cams which I am preparing to capture into Adobe Premiere.
    I know there's a way to work with two cams-monitoring, but is it the case when capturing ?
    I am capturing via Firewire.  My card has more than one slot - so guess I can plug-in two cams at same time.  But can I A/B between the two cams prior to capture (record) into Adobe ?
    Or is the multiple cam into Adobe only for ''already captured'' shots ?
    Thanks,
    Rob

    You need to capture the data streams separately (not simultaneously)

  • Working with two RecordSets

    Is it possible to work with two recordsets in one method?
    If so, I havnt been able to figure out how.
    Any Suggestions?
    Stef

    Sure. Why not? But your problem has nothing to with them being "in the same method". It's more likely to do with this quote from the API documentation for java.sql.Statement:
    "Only one ResultSet object per Statement object can be open at any point in time. Therefore, if the reading of one ResultSet object is interleaved with the reading of another, each must have been generated by different Statement objects. All statement execute methods implicitly close a statment's current ResultSet object if an open one exists."

  • Working with two computers. One of them not working

    I've been working with two computers. In one of them where I have already  installed several programs downloaded with the Adobe Application Manager, when I try to open a program is giving me a message to sign in for a 30 day trial of the program? Why is this happening?

    Try http://helpx.adobe.com/creative-suite/kb/trial--1-launch.html

  • Does iMovie 08 work with two external devices?

    Does iMovie 08 work with two external devices without causing latency.  I need to capture the video through an external USB webcam and the audio through a Digital Recording box through firewire.

    YES and there are multiple postings here with complete information
    Also visit:
    http://www.dvinfo.net/conf/forumdisplay.php?f=156
    A Users Group with answers to al your questions.

  • How t o add Link with a button in jsp

    hi,
    I want to add link with a button in jsp. How will i do it? Is there anyone who can help me? Please help me.
    With Regards
    Bina

    Try this,
    <input type='button' onclick='window.location="a.html"'>

Maybe you are looking for