Pages Navigation Menu

Coding is much easier than you think

Ajax in Java

How to use JQuery dialog as Confirm dialog?

Posted by on Aug 14, 2015 in jQuery, jQuery UI | 0 comments

  There are quite a few articles you might have read on SimpleCodeStuffs on jQuery like jQuery Tutorial for Beginners, AJAX implementation in Servlets using jQuery and jQuery UI etc.   This example will help you if you have any one of below queries: How to implement “confirmation” dialog in jQuery UI dialog? How to use jQuery UI dialog as JavaScript confirm BOX? How to use JQuery dialog as Confirm dialog? jQuery UI Replacement for alert() Issue: How many times did you have to code some confirmation logic on your website to...

read more

Struts2 AngularJS integration

Posted by on May 2, 2015 in Ajax, AngularJS, Struts-2 | 5 comments

  In this post, we will learn to implement AJAX calls from a JSP page to a Struts 2 Action class using AngularJS and update the same JSP page back with the Json response from the Struts 2.   Library Required   Since Angular can send and receive only in json format, to handle it you need struts2-json-plugin-2.x.x.jar. This plugin allows you to serialize the Action class attribute which has getter and setter into a JSON object.   How to use?   First of all create a “Dynamic Web Project” in Eclipse and...

read more

AngularJS Interacting with Java Servlet using JSON

Posted by on Apr 26, 2015 in Ajax, AngularJS, Servlet | 5 comments

  In this post, I am going to demonstrate a simple example on how to make AJAX calls from a JSP page to a Servlet using AngularJS and update the same JSP page back with the JSON response from the Servlet. In other words, this post will give you an overview on how to integrate AngularJS in a Java web applications.   There are many JSON libraries available that can be used to pass AJAX updates between the server and the client. I am going to use google’s gson library in this example.   Below are the steps to reproduce to...

read more

Ajax Cascading DropDownList in JSP & Servlet using JQuery and JSON

Posted by on Apr 12, 2015 in Ajax, jQuery, Servlet | 5 comments

    There are times in a web application where you want to populate a dropdown list based on the value of another drop down list. In this example, we will be creating a dropdown list for favorite spots and favorite player; since this scenario involves in returning complex java objects like lists, maps, etc, so I’m using JSON for this purpose. In the article on AJAX in Servlet & jsp using JQuery I have demonstrated on returning simple object from servlet to jsp via jquery.   Library required   Google...

read more

Refresh DIV Content Without Reloading Page using jQuery

Posted by on Apr 9, 2015 in jQuery | 0 comments

  In my previous post, I explained about making AJAX calls to a servlet from a JSP page and updating a part of the JSP page with the response from the Servlet.   This article will help you to Refresh DIV Content Without Reloading Page using jQuery with simple html page.     <HTML> <HEAD> <TITLE>Refresh Div without Reloading Page</TITLE> <script src="http://code.jquery.com/jquery-1.11.2.min.js"></script> <script> $(document).ready(function()...

read more

AJAX Tooltip in Java Web Application using qTip2 jQuery plugin

Posted by on Mar 29, 2015 in Ajax, J2EE, jQuery, Servlet | 0 comments

  This article discusses AJAX Tooltip in Java Web Application using qTip2 jQuery plugin. This library is used for creating Asynchronous display of tool tip.   Library required jQuery Library qTip2 Google gson   Project Structure   Now Create a dynamic web project in Eclipse with following folder structure     Set up from browser perspective: jQuery qTip2   Jsp form which ToolTip via ajax   <!DOCTYPE html> <html> <head> <link rel="stylesheet"...

read more

Ajax implementation in Servlet without jQuery plugin

Posted by on Mar 7, 2015 in Ajax, Servlet | 0 comments

  AJAX is a technique for creating better, faster, and more interactive web applications. With AJAX, your JavaScript can communicate directly with the server, using the JavaScript XMLHttpRequest object. With this object, your JavaScript can transfer data with a web server, without reloading the page.   This post elaborates on how to implement Ajax in Servlet application.   ** UPDATE: Servlet Complete tutorial now available here.   Folder Structure     Jsp...

read more

jQuery Tutorial for Beginners

Posted by on Feb 22, 2015 in Ajax, jQuery | 0 comments

  In this article we are going to take a look at introduction to jQuery, what it is, what is does and why we should use in our website.   If you are looking to perform Ajax operations in your website with lot of cool effects on it and you are not completely familiar with java script, then jQuery is a very easy and flexible way to integrate thing like effects, Ajax, animation and so on.   A Little Bit About jQuery   jQuery is Open-Source JavaScript library that contains variety of functions and other functionality that...

read more

Pagination in Struts 2 using jQuery jTable plugin

Posted by on Oct 6, 2014 in Ajax, jQuery, Struts-2 | 1 comment

    This is the third article on jQuery jTable plugin in Struts 2 that describes on how to implement pagination feature to do server side paging in struts 2 using the JQuery jTable plugin and here I have not explained about how to setup jTable plugin in struts 2. So If you have not read my previous articles “Setting up JQuery jTable plugin in Struts 2″ and “Ajax based curd operation in Struts 2 using JQuery jTables plugin”, I will recommend that you read that article first because first one explains how you...

read more

AJAX implementation in Struts 2 using JQuery and JSON

Posted by on Oct 5, 2014 in Ajax, jQuery, Struts-2 | 54 comments

    In this post, we will learn to implement AJAX calls from a JSP page to a Struts 2 Action class using JQuery and update the same JSP page back with the Json response from the Struts 2.   Library required   Since the response to be sent to jQuery is of type JSON, to handle it you need struts2-json-plugin-2.x.x.jar. This plugin allows you to serialize the Action class attribute which has getter and setter into a JSON object.   Steps done to set up our action for JSON   From the browser perspective:...

read more