Results 1 to 9 of 9
  1. #1
    sasi.tati is offline Member
    Join Date
    Jul 2010
    Posts
    18
    Rep Power
    0

    Default Is their any way to show a successfull popup message in web applications.

    Hi

    I am creating some jsp's and for this jsp's action the logic is written in bean's(with set and get method's), so after inserting all the form data in to the table i want to show a message to the user like "Updated Successfully". So kindly tell me the procedure how to display that message, i tried JOptionPane but it is taking too much time to display that, does any alternative is available.

    I am calling this bean's with using useBean tag's in jsp's.

    Does this is possible with javascript.? if yes then how this function will be invoked after the execution of that bean functionality?.

    Kindly guide me how to resolve this issue.

  2. #2
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    If you do this from the server side, then yes it'll take a long time to display the message. Normally those messages are displayed from the client side, suing the request response model with the server and client sides, kind of AJAX based.

    If you could provide more details, by posting part of the relevant code, it's easy to comment in details.

  3. #3
    sasi.tati is offline Member
    Join Date
    Jul 2010
    Posts
    18
    Rep Power
    0

    Default

    Hi, 10q very much for your quick response, here is the code which i used in the Bean after the get & set Methods:

    public String saveCandidateInfo() throws SQLException, ClassNotFoundException{
    try{
    Class.forName(driver);
    conn = (Connection) DriverManager.getConnection(Connection, user, password);
    System.out.println("DB Connected");
    stmt = (Statement) conn.createStatement();
    String query = "INSERT INTO HR_CAND_INFO VALUES (NULL,'"+ fname +"','"+ lname +"','"+ email +"','"+ mobileno +"','"+ phoneno +"','"+ nationality +"','"+ dob +"','"+ gender +"',LOCALTIME())";
    System.out.println("Result is"+query);
    stmt.executeUpdate(query);
    //JOptionPane.showMessageDialog(null,"Saved Successfully");
    return "Saved Successfully";
    }
    catch(SQLException e){
    System.out.println("Exception in savemethod"+e);
    }
    return "";
    }

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,949
    Rep Power
    19

    Default

    You can't mix Swing with an HTML based front end, so you're talking about using AJAX and a Javascript alert probably.

  5. #5
    sasi.tati is offline Member
    Join Date
    Jul 2010
    Posts
    18
    Rep Power
    0

    Default

    I know Javascript, i don't know about AJAX, can u guide how to do this in Javascript.

  6. #6
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,949
    Rep Power
    19

    Default

    Afraid not.
    You'll need to go do some googling.

  7. #7
    murali.java is offline Member
    Join Date
    Oct 2010
    Posts
    7
    Rep Power
    0

    Default

    From the method saveCandidateInfo() you are returning a string to the jsp file
    Assume this method( saveCandidateInfo() ) is in class "Dbase"



    Lets see the code in the JSP

    jsp code

    <%
    Dbase db= new Dbase();
    String message=db.saveCandidateInfo();
    if(message.equals("Saved Successfully"))
    {
    %>
    <script>
    window.alert("Updated Successfully");
    </script>
    <%} //end of if

    else
    {
    %>
    <script>
    window.alert("DB ERROR .. NOT INSERTED");
    </script>
    <%
    }// END OF ELSE
    %>

  8. #8
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,949
    Rep Power
    19

    Default

    Which isn't Ajax.
    And you're code dumping again.
    I would say spoon feeding, but that's not much of a solution.

  9. #9
    murali.java is offline Member
    Join Date
    Oct 2010
    Posts
    7
    Rep Power
    0

    Default

    Hi Mr.Tolls,

    I know it is'nt Ajax .I just suggested how it can be achieved using javascript.To let others understand i dumped my code hope useful to others..

Similar Threads

  1. show Message Dialog
    By akritc in forum AWT / Swing
    Replies: 7
    Last Post: 06-10-2010, 02:49 PM
  2. Replies: 6
    Last Post: 06-04-2010, 08:43 PM
  3. Replies: 3
    Last Post: 05-27-2010, 10:54 AM
  4. Built-in User Popup message boxes ?
    By BobZ in forum AWT / Swing
    Replies: 2
    Last Post: 02-06-2009, 06:23 PM
  5. netbeans 6.0 not show commpunent or show blank page
    By fahimaamir in forum NetBeans
    Replies: 1
    Last Post: 01-26-2008, 06:20 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •