• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

response to JSP

 
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

Sorry for the subject line.

I have a JSP file inside which I'm having an AJAX call which opens another JSP as a dropdown on clicking.

One of the options in the dropdown JSP is "Save data". When I click here, it would save data in the database and return some true or false back to the JSP.

I want to show a temporary message "Saved successfully" on the JSP page after the method return. Can anyone suggest me methods to print a temporary message?

Thanks,
Aditya
 
Ranch Hand
Posts: 45
Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can use the method return value which will be set to certain value (e.g. boolean true or false) to show the message after successful execution of the method.
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I have a JSP file inside which I'm having an AJAX call which opens another JSP as a dropdown on clicking.



I suspect you mean that you have a JSP which generates a HTML page which includes JavaScript responsible for making the AJAX call on the browser side.

Using the term JSP where you should be saying HTML and JavaScript leads to confusion about where things are happening.

We see a lot of this confusion on this forum.

Bill
 
Sheriff
Posts: 67752
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moved to the JavaScript forum.
 
Adi Kulkarni
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually I have a question in the JSP and JavaScript.

I call a method from a JSP page. This method exists in a model class which in turn calls a sql. The data gets saved in a table.

The response of this method is a boolean variable which I get in a JSP. Now I wan't to show a temporary message like "Save successful" in the JSP page, which should flash for around say 4-5 seconds and disappear. Or probably a JavaScript alert which will show that the save is successful.

So my question here is can I use JavaScript alerts under script tag without actually calling a JavaScript function ?

Thanks,
Aditya

 
Bear Bibeault
Sheriff
Posts: 67752
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is not a JSP issue.
 
Adi Kulkarni
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks,

I've tried putting random JavaScript under script tags, but it didnt reflect. Can I put a JavaScript alert in a JSP page without calling without an onClick JavaScript function or form submit ?
 
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
AJAX and div tags is the solution for your question .
 
Won't you be my neighbor? - Fred Rogers. tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic