• 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
  • Devaka Cooray
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Jeanne Boyarsky
  • Tim Cooke
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
Bartenders:

Record inserted successfully problem

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

I am a new to JSP. I got one JSP page where I have to take input from user. On click of save button data gets saved in database.
Now, after clicking save button I want to move on the same JSP. But with one extra line "Record inserted successfully" in the same JSP.

Can any one help me!!!
 
Ranch Hand
Posts: 152
Eclipse IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi sachin,
welcome to javaranch
Can you please tell us like what are you doing for saving your record to database, when clicked on save button, are you using servlets (MVC framework) or using struts framework? please elaborate on that front.

 
Sachin Ramesh Patil
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for reply pravin,

I am using struts2 framework. I am able to save data to the database.

I want to show some message to the user like data submitted .
 
Ranch Hand
Posts: 93
IntelliJ IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Sachin Ramesh Patil wrote:Hello Friends,

I am a new to JSP. I got one JSP page where I have to take input from user. On click of save button data gets saved in database.
Now, after clicking save button I want to move on the same JSP. But with one extra line "Record inserted successfully" in the same JSP.

Can any one help me!!!



You need to learn AJAX to do so.... maybe if you're using a framework, it has something to help you in doing that, but you must read about AJAX.
 
Sachin Ramesh Patil
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Eduardo Yañez Parareda

But can't we do with out AJAX. Since I am using Struts2 Framework
 
Eduardo Yañez Parareda
Ranch Hand
Posts: 93
IntelliJ IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Sachin Ramesh Patil wrote:Thanks Eduardo Yañez Parareda

But can't we do with out AJAX. Since I am using Struts2 Framework



Struts2 have AJAX integration, so you need to use AJAX, directly or indirectly.

 
Pravin Shirke
Ranch Hand
Posts: 152
Eclipse IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi sachin,
we can live without ajax framework if you are ok with the round trip of the request from server to client. in that case just add action message after you insert you record successfully. create an object of actionmessages and save it in using savemessages function

like this and on jsp print it using

tag

Hope this solves your problem.
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@Pravin: that code is for Struts 1; the original poster is using Struts 2.

Fortunately the answer is even a bit simpler--just look at the ValidationAware interface and the ActionSupport class that provides a default implementation. (Assuming you're doing it without Ajax--but there's no reason to *not* use Ajax just because you're using Struts 2; Ajax can be added to any application.)
 
You know it is dark times when the trees riot. I think this tiny ad is their leader:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic