• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to implement Like button(as in facebook) in jsp?

 
Manas Saxena
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am making a social networking website for photos and videos sharing.I want each post to have a like button which should work as facebook's like button works.
Please give me an approach to do this,also tell me how my database should be involved in this
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65522
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I assume you would store "likes" in the database. How else could they be remembered?

JSP isn't really of much help here. I'd implement this with JavaScript and Ajax.

 
Manas Saxena
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Got it done.Following is my methodology:

database has a table called likes which has attributes image_id and user_id(the person liking the post)
before displaying the like button i check if the user in session has already liked the image.
If yes then the text value of the like button is set to "You have already liked this post".If no then the like button is displayed.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65522
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So what happens when they visit the site again tomorrow?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!