I-Report Bands

                                                                                                        I-Report Bands


A jasper report is composed by a set of sections named as “bands”.  Every band contains few properties such as height. Band height should be greater than 0, otherwise it will never be visible to user.  The band height can grow if elements inside it are stretched.

Default Bands in Report:

Title Band

Printedonly one time and it’s the first band. It can be printed on a separate page. You can print report title in this band.


Page Header

Printed on each page.


Column Header

It prints on each page if page contains detail band. If page splits it prints on each page. You can use this to crate manual table and put column name in this band.



It prints for each record in the source.


Column Footer

It is same as column header band, but it prints in footer instead of header.


Page Footer

Same as Page header, but it is footer section.



It prints only once at the end of the report. It can be printed on separate page also.



It can be used to define a page background. You can also use image in this band.


The position of bands cannot be modified. For each band, you can modify only band height.

This is the sequence of bands in any jasper report (Fig 1.0). You can hide/unhide bands according to your needs.

If you click on any band, you can see the properties of that band in your right hand side panels (Fig 2.0). (If properties panel is not visible, Click on menu Window > Properties.


FIg 1.0

FIg 1.0

Fig 2.0

Fig 2.0






Sharad Sinha

How to restrict Multiselect input control values in jaspersoft :

How to restrict Multiselect input control values in Jaspersoft 

This blog will teach the reader , how to restrict multiselect input control values in jasper without hampering the performance .

DB : Postgres (foodmart)

Table : customer

Reporting tool : iReport

Server : Jasperserver 5.6

I/P Parameter : country

Requirement : Get All the informations from customer table where country name is either USA or Mexico or Canada

Condition :

  1. you can not select more than 2 value in “country” input parameter
  2. if more than 2 values are selected in “country” input parameter then the main report query should also not get executed. This will unnecessarily hamper the performance.

Solution :

  1. create multiselect input control named as “country”

select distinct country from customer

  1. create a sub report which will display all the informations from customer table on selection of “country” parameter

and give its print when expression as :

$P{country}.size() <= 2

  1. create a text box in the header , write a message init as :

“You can not select more than 2 values in country parameter”

And give its print when expression as :

$P{country}.size() > 2

  1. in the sub report , query will be :

select * from customer

where $X{IN,country,country}

limit 20

  1. publish the report on jasper server.


# 1 : when 2 values selected in country parameter

lenlt2#2 : when more than 2 values selected in country parameter



Rupam Bhardwaj

Remove Repeated Column header, Page Header, Page Footer in CSV Export (JASPER)

In CSV export, we want only column header once and data should be printed. We do not want page header, page footer and repeated columns header. So in order to achieve this do the following.

    1. Remove Page Header:
<property name="net.sf.jasperreports.export.csv.exclude.origin.band.(uniqueValue)" value="pageHeader"/>
    1. Remove Page Footer:

<property name="net.sf.jasperreports.export.csv.exclude.origin.band.(uniqueValue)" value="pageFooter"/>
    1. Remove Title Band:

<property name="net.sf.jasperreports.export.csv.exclude.origin.band.(uniqueValue)"value="title"/>
    1. Remove Repeated Column Header:

<property name="net.sf.jasperreports.export.xlsx.exclude.origin.keep.first.band.(sameValue)" value="columnHeader"/>
<property name="net.sf.jasperreports.export.xlsx.exclude.origin.keep.first.report.(sameValue)" value="*"/>

Some times we are using sub report to display page header and page footer. Do the following to remove the it in CSV Export.

    1. Remove Sub Report:

<property name="net.sf.jasperreports.export.xlsx.exclude.origin.report.(sameValue)" value="Actual Report Name not the sub report name"/>
<property name="net.sf.jasperreports.export.xlsx.exclude.origin.band.(sameValue)" value="detail"/>

This is not working for crosstab.

Thanks & Regards,
Fahad Anjum

Map Reduce In MongoDB

MongoDb Map Reduce

Map-reduce is a data processing paradigm for condensing large volumes of data into useful aggregated results.

For map-reduce operations, MongoDB provides the map Reduce database command.

The mapReduce command allows you to run map-reduce aggregation operations over a collection. The mapReduce command has the following prototype form:

               mapReduce: <collection>,
               map: <function>,
               reduce: <function>,
               finalize: <function>,
               out: <output>,
               query: <document>,
               sort: <document>,
               limit: <number>,
               scope: <document>,
               verbose: <boolean>


Pass the name of the collection to the mapReduce command (i.e. <collection>) to use as the source documents to perform the map reduce operation.

The command also accepts the following parameters:

Field Description
mapReduce The name of the collection on which you want to perform map-reduce. This collection will be filtered using query before being processed by the map function.
map A JavaScript function that associates or “maps” a value with a key and emits the key and value pair.
reduce A JavaScript function that “reduces” to a single object all the values associated with a particular key.
out Specifies where to output the result of the map-reduce operation. You can either output to a collection or return the result inline.
query Optional. Specifies the selection criteria using query operators for determining the documents input to the map function.
sort Optional. Sorts the input documents. This option is useful for optimization. For example, specify the sort key to be the same as the emit key so that there are fewer reduce operations. The sort key must be in an existing index for this collection.
limit Optional. Specifies a maximum number of documents for the input into the map function.
finalize Optional. Follows the reduce method and modifies the output.
scope Optional. Specifies global variables that are accessible in the map, reduce and finalize functions.
verbose Optional. Specifies whether to include the timing information in the result information. The verbose defaults to true to include the timing information.


The following is a prototype usage of the mapReduce command:

var mapFunction = function() { ... };
var reduceFunction = function(key, values) { ... };
      mapReduce: <input-collection>,
      map: mapFunction,
      reduce: reduceFunction,
      out: { merge: <output-collection> },
      query: <query>

Requirement for map function:
Map function is responsible for transforming each input document in to zero or more documents.It can access the variables defined in the scope parameter,and has following prototypes.


The map function has the following requirements:

  • In the map function, reference the current document as this within the function.
  • The map function should not access the database for any reason.
  • The map function should be pure, or have no impact outside of the function (i.e. side effects.)
  • A single emit can only hold half of MongoDB..
  • The map function may optionally call emit(key,value) any number of times to create an output document associating key with value.

The following map function will call emit(key,value) either 0 or 1 times depending on the value of the input document’s status field:


The following map function may call emit(key,value) multiple times depending on the number of elements in the input document’s items field:


Requirements for the Reduce Function
The reduce function has the following prototype:

         return result;

The reduce function exhibits the following behaviors:

  • The reduce function should not access the database, even to perform read operations.
  • The reduce function should not affect the outside system.
  • MongoDB will not call the reduce function for a key that has only a single value. The valuesargument is an array whose elements are the value objects that are “mapped” to the key.
  • MongoDB can invoke the reduce function more than once for the same key. In this case, the previous output from the reduce function for that key will become one of the input values to the next reduce function invocation for that key.
  • The reduce function can access the variables defined in the scope parameter.
  • The inputs to reduce must not be larger than half of MongoDB’s. This requirement may be violated when large documents are returned and then joined together in subsequent reduce steps.

Because it is possible to invoke the reduce function more than once for the same key, the following properties need to be true:

  • the type of the return object must be identical to the type of the value emitted by the mapfunction.
  • the reduce function must be associative. The following statement must be true:
    • the reduce function must be idempotent. Ensure that the following statement is true:
    • the reduce function should be commutative: that is, the order of the elements in thevaluesArray should not affect the output of the reduce function, so that the following statement is true:

Requirements for the finalize Function

The finalize function has the following prototype:

          return modifiedObject;

The finalize function receives as its arguments a key value and the reducedValue from thereduce function. Be aware that:

  • The finalize function should not access the database for any reason.
  • The finalize function should be pure, or have no impact outside of the function (i.e. side effects.)
  • The finalize function can access the variables defined in the scope parameter.

out Options

You can specify the following options for the out parameter:

Output to a Collection

This option outputs to a new collection, and is not available on secondary members of replica sets.


Map-Reduce Examples:

Consider two Collection (tables) named :

  • Employee
  • Department

Now , to create collection in mongo db , use below query


To insert data in Employee Collection :

db.Employee.insert({“name” : { “first” : “John”, “last” : “Backus” }, “city” : “Hyd”,“department” : 1})

db.Employee.insert({“name” : { “first” : “Merry”, “last” : “Desuja” }, “city” : “Pune”,“department” : 2})

To insert data in Department Collection :

db.Department.insert({“_id” : 1,   “department” : “Manager”})

db.Department.insert({“_id” : 2,   “department” : “Accountant”})

Now the requirement is to display FirstName , LastName , DepartmentName.

For this , we need to use Map Reduce :

Create two map functions for both the collections.

//map function for Employee
var mapEmployee = function () {
var output= {departmentid : this.department,firstname:this.name.first, lastname:this.name.last , department:null}
     emit(this.department, output);               

//map function for Department
var mapDepartment = function () {
var output= {departmentid : this._id,firstname:null, lastname:null , department:this.department}
     emit(this._id, output);              

Write Reduce Logic to display the required fields :

var reduceF = function(key, values) {

var outs = {firstname:null, lastname:null , department:null};

      if(outs.firstname ==null){outs.firstname = v.firstname }                   
      if(outs.lastname ==null){outs.lastname = v.lastname    }
      if(outs.department ==null){ outs.department = v.department }                         
 return outs;

Store the result into a different collection called emp_dept_test

result = db.employee_test.mapReduce(mapEmployee, reduceF, {out: {reduce: ‘emp_dept_test’}}) 
result = db.department_test.mapReduce(mapDepartment,reduceF, {out: {reduce: ‘emp_dept_test’}})

write the following command to get combined result:


Output of the query gives the combined result like

    "_id" : 1,
    "value" : {
        "firstname" : "John",
        "lastname" : "Backus",
        "department" : "Manager"

/* 1 */
    "_id" : 2,
    "value" : {
        "firstname" : "Merry",
        "lastname" : "Desuja",
        "department" : "Accountant"


Nitin Uttarwar
Helical It Solution

Welcome Page Customization For JasperSoft on the Basis of Roles

On Welcome page of Jaspersoft, Login is based on Some Roles assigned to particular user ,as per that we have an access on Jaspersoft. If anyone wants to create their own user with Roles, they simply do it by making following changes in particular files.

Let us consider that we are creating following three different Users and Roles with some http://helicaltech.com/wp-admin/post.php?post=3624&action=editrequirement:

1)Create three different Users




2)Create three different Roles




3)Assign Role for each User As

i) For Report User Assign ROLE_ REPORTS

ii) For Dashboard User Assign ROLE_ DASHBOARD

iii) For Adhoc User Assign ROLE_ ADHOC

4) In MenuBar only View button should be their which contains only Repository option and for user other than above, it will show all Menus.

5)The Home page contains only three Containers which has only viewlist button at center

that is:



iii) Ad Hoc Views

6) This three containers needs to be modified to display the text as:

i)Reports – Change the existing text to: Click on ‘View list’ to access all Reports in repository.

ii)Dashboards – Change text existing to: Click on ‘View list’ to access links to Dashboards.

iii)Ad Hoc Views – Change the existing text to: Click on ‘View list’ to access all AdHoc Views in Repository.

7) All text present in left side of Home Page will get removed.

Now we have do customization on JasperSoft to accomplish the requirement ,for that we requires to modify the following different files as below:

NOTE: After modifying the files, to see changes done on JasperSoft,it is important to firstly restart the tomcat-server, then and then only you are to able to see the changes.

1) To Grant the permissions for Users:

i)Navigate to the path : C:\Jaspersoft\jasperreports-server-5.6\apache-tomcat\webapps\jasperserver-pro\WEB-INF\jsp\modules\home

/* If this condition is true it redirects to HomePage1.js */<authz:authorize ifAnyGranted=”ROLE_REPORTS,ROLE_ DASHBOARD,ROLE_ ADHOC”><c:set var=”ModuleName” value=”home/HomePage1“/></authz:authorize> 

/* Else it redirects to HomePage.js */

<authz:authorize ifNotGranted=”ROLE_REPORTS,ROLE_DASHBOARD,ROLE_ADHOC”>

<c:set var=”ModuleName” value=”home/HomePage“/>



/*Insert this line to add variable created above*/

<t:putAttribute name=”moduleName”>${ModuleName}</t:putAttribute>


ii)In that homeForNonDemo.jsp contains code related to grant permissions for the user,so here we have to grant permissions to User Report,Dashboard,Adhoc as follows:

iii) Firstly restart the server, now you are able to logged onto server using different three  users that is Reports,dashboard,AdHoc.


2)To change the HomePage which contains HomeView:

i)After logged in with above users, it will redirects to HomePage1

ii)Goto C:\Jaspersoft\jasperreports-server-5.6\apache-tomcat\webapps\jasperserver-   pro\scripts\home

iii)In that create .js file same as HomePage.js,but make following changes in HomePage1.js, which we are already create as HomeView1.js as HomeView.js.

HomeView = require(“home/view/HomeView1“)


3)To change the HomeView which contains different views we have to change:

i)From HomePage1 it will redirects to HomeView1

ii)Navigate to path : C:\Jaspersoft\jasperreports-server-5.6\apache- tomcat\webapps\jasperserver-pro\scripts\home\view

iii)create HomeView1.js as HomeView,it is having Listview and WorkflowView,homeTemplate add the ListView1,WorkflowView1,homeTemplate1.js files created by us.

ListView = require(“home/view/ListView1“),WorkflowView = require(“home/view/WorkflowView1“),homeTemplate = require(“text!home/template/homeTemplate1.htm“),


4)To change the text which the container displays:

i)Goto C:\Jaspersoft\jasperreports-server-5.6\apache-tomcat\webapps\jasperserver-pro\scripts\home\view

ii)In that ListView1.js file we need to modify the text as:

render: function () {var nothingToDisplayElement;if (this.collection.length > 0){//cleanup only for ‘nothing’ msg, no listeners to remove herethis.$el.html(“”);


var name = model.get(‘name’);


                if (name == ‘dataSource’ || name == ‘domain’) {return;}

                if(name == ‘dashboard’) {

                model.set(‘description’,’Click on View list to access links to Dashboards in repository’);}

             if(name == ‘adhocView’) {

                model.set(‘description’,’Click on View list to access links to Ad hoc Views in repository’);}
if(name == ‘report’) {

                model.set(‘description’,’Click on View list to access links to Reports in repository’);}

var view = new this.initOptions.listElementView({ model: model });this.subviews.push(view);this.$el.append(view.render().$el);



nothingToDisplayElement = _.template(nothingToDisplayTemplate, {message: this._msgNothingToDisplay});




return this;




iv)It will change the containers display text.

5)To change the click event of the Viewlist presents on the container:

i)Navigate to C:\Jaspersoft\jasperreports-server-5.6\apache-tomcat\webapps\jasperserver-pro\scripts\home\view

ii)Goto workflowView1,change the path of template and modify click event as:

template = require(“text!home/template/workflowTemplate1.htm“),events: {     “click .button.left”: “clickOnLeftButton”,”click .button.center“: “clickOnRightButton” },

iii)Now you are able to see Viewlist at Middle.

6)To remove ViewTutorial from Containers:

i)Goto to C:\Jaspersoft\jasperreports-server-5.6\apache-tomcat\webapps\jasperserver-pro\scripts\home\Template

ii)In workflowTemplate.html comment or remove the text which shows the ViewTutorial as

<!–{{ if (tutorialControl) { }}<a href=”{{- tutorialControl.entity.url }}” target=”_blank” >{{- tutorialControl.label }}     </a>{{ } }}–>


7)To Remove Left Side text from Home Page:

i)Navigate to var C:\Jaspersoft\jasperreports-server-5.6\apache-tomcat\webapps\jasperserver-pro\scripts\home\Template

ii) Having homeTemplate1.html in that comment or remove the following text as:

<h2 class=”homeSidebar-title” >{{- welcomeMessage }}</h2>


8)To display View Menu having only Repository option:

i)Goto /var/lib/tomcat7/webapps/jasperserver-pro/WEB-INF/decorators

ii) In decorators.jsp modify as follows and add assign menu.search,menu.all to administrator

<context name=”main_view_mutton” test=”checkAuthenticationRoles” testArgs=”ROLE_SUPERUSER,ROLE_ADMINISTRATOR,ROLE_REPORTS,ROLE_DASHBOARD,ROLE_ADHOC”> <selectAction labelKey=”menu.repository”>


9)To hide Library Menu From Jaspersoft for Above Roles As:

i)Goto C:\Jaspersoft\jasperreports-server-5.6\apache-tomcat\webapps\jasperserver-pro\WEB-INF\decorators

ii) In decorator.jsp modify it as:

<js:authorize ifAllGranted=”ROLE_ADMINISTRATOR”><li id=”main_library” tabIndex=”-1″ class=”leaf”><p class=”wrap button”><span class=”icon”></span><spring:message code=”menu.library”/>




It means we are hiding the Library menu for Above Roles but it is Visible to Role Administrator.

10)To optimize your javascript code we need make change in js.config.properties file which is present at path:


But now we don’t know to create the optimized js code because of that we will keep it as false:

# Control default value of javascript optimization in runtimejavascript.optimize=false


Sayali Mahale

White Labeling  of  JasperSoft


White Labeling  of  Jaspersoft

A white-labeling is a service produced by one company for example Jaspersoft, that other companies reband to make it appear as if they had made it. Customers sometimes want to customize the look and feel of the Jasper Reports Server interface by performing customizations. As Jasper Report is open source tool we can customize it.

Jaspersoft Login Page

Such as:

  1. Branding on the  Browser tab and Title Bar
  2. Favicon
  3. Logo
  4. Welcome label
  5. Contact button
  6. About and Copyright
  7. Theme

Let us consider that we are making customization from Jaspersoft to Helical IT Solutions :

To customize Branding on the Browser tab and Title Bar

The Branding on the browser tab and title bar includes the:

  • The company name on the browser tab.
  • The company name on the title bar.

Important Note:
After making changes save the file and first of all Restart the Server then only you are able to see the changes.

To change the company name on browser tab and title Bar :
1) Open this file for editing:
2) Change the title as you want in <title> tag.

<html><head><title>Helical IT Solutions: <decorator:title /></title></head></html>

3) Log into the Server.


To change Favicon

1) Rename your icon to favicon.ico.

2)Copy the icon to this location : C:\Jaspersoft\jasperreports-server-5.6\apache-tomcat\webapps

3) Log into the Server.


To change Logo

To change the Logo on all pages including Login Page:

1)Navigate to the path:


2)Copy the logo image logo.png with dimension as 141*28 pixels and give it the same name logo.png

3)Log into the server as superuser.

4)Goto View->Repository

5)In the folder panel on left side right click on root/Themes,and select Add Folder.

6)Name the new folder customizations


7)Right-click the customizations folder, and select Add Folder,Name the new folder images

8) Add your logo to the images folder:

a. Right-click the images folder and select Add Resource > File > Image


The Upload a File From Your Local Computer page appears.
b. Browse to your logo.
c. In the Name field, enter logo.png
d. In the Resource ID field, enter logo.png


9)Click Submit .

10)The logo.png file appears in the
Themes > customizations > images folder in the repository.

Now the logo is available on server it appears in the web interface after you perform the procedure “To Add New Theme ” as mention.


To customize Welcome label

1) Navigate to the path:

C:\Jaspersoft\jasperreports-server-5.6\apache-tomcat\webapps\jasperserver-pro \WEB-INF\bundles\

2)Open this file for editing:

3) Search for a Login page in file
Change LOGIN_WELCOME_OS property to Welcome to Helical IT Solutions

#Welcome Login PageLOGIN_WELCOME_OS=Welcome to Helical  IT Solutions# the following 2 strings belong to the same sentenceLOGIN_ONLINE_DEMO_PRE=For a quick look at the functionality, check outLOGIN_ONLINE_DEMO=our online demos.


To customize the Contact JasperSoft Button URL And Label

1) Open this file for editing

C:\Jaspersoft\jasperreportsserver5.6\apachetomcat\webapps\jasperserver-pro scripts\

2) Change the URL of the CONTACT_SALES_URL in the loginBox variable definition from the jaspersoft.com address to another address, for example, http://www.helicaltech.com

var loginBox = {LOGIN_BOX_TEMPLATE_DOM_ID: “login”,.. CONTACT_SALES_URL: “http://www.helicaltech.com”,_dom: null,


3)Open the following file for editing:


4)Search for the BUTTON_CONTACT_SALES property and the definition from Contact JasperSoft to Contact Helical.

                                                                                                                                                                                                                                           To customize About and Copyright

To hide the copyright and About link on all server pages, including the Login page:

1) On the file system of the server, navigate to the \themes directory in the server installation files. By default, this directory is in the following source code location:


2) Copy overrides_custom.css to a different location on your hard drive and open it in a CSS editor.

3) Add the following line to the file:

#about, #copyright{display:none;} 

                                                                                                                                                                                                                                            To Add New Theme

To activate the customizations theme :

1) Log into the server as superuser.

2) Click View > Repository

3) In the Folders panel, right-click the customizations folder in Themes,Add themes.css file.

5)Right click the customizations folder select Set as Active Theme.

6)Logout to the server, Restart it ,to see the changes.


Thanks ,
Sayali Mahale

How to use Custom Component in Jaspersoft Studio:

How to use Custom Component in Jaspersoft Studio:

This Blog will teach you how to use Custom component in Jaspersoft studio.

A Custom component allows the BI Developer to enhance the functionality of Jasperreports engine by adding some custom visualized components.

By using Custom Component , we can able to develop anything like tables , charts , etc …

Steps to create Custom Component :

# 1.      Go to File -> New -> Others

Custom# 2 .     Select Custom Component

CustomThen Click Next.

# 3. There you will get 3 samples , you can select any one of them and give your Project Name.

Then Click on Next.

d3charts# 4. You can see in the left side , one folder is created named same as the above metioned name.

project explorer

# 5. Right click on build.js -> Buid Component

# 6.After thet In the same folder double click “d3_Circle_sample.jrxml” , Preview it

You will get the Output as :




Thanks ,

Rupam Bhardwaj


Jaspersoft Ad hoc reports: Quick performance measurement & optimization tips

Measuring Ad-hoc performance

1. Log on JasperReports server as system admin (superuser by default).

2. Navigate to Manage > Server Setting > Ad hoc cache.

The Ad Hoc Cache page appears, displaying all the datasets that are in the cache, sorted by age.


3. Ad Hoc performance can be quickly measured by checking values of Query/Fetch

  • Query (msec): Time from when query was sent to the db until the first row was received. If this is slow then we should apply proper indexes in DB.
  • Fetch (msec): Time from when first row was received until the last row was received. If this is slow there might be a network bottleneck.

Performance tuning in Ad Hoc

Setting query limit

  1. Log on JasperReports server as system admin (superuser by default).
  2. Navigate to Manage > Server settings > Ad Hoc Settings.
  3. There are two parameters there that are worth testing for possible performance gains:

a)      Ad Hoc Filter List of Values Row Limit

  • The maximum number of items that should be displayed in the Condition Editor when a user defines filters for an Ad Hoc report that is based on a Domain. If this limit is exceeded when users define filters, Jasperserver displays a message to that effect.
  • Setting this to a lower value can improve performance.

b)      Ad Hoc Dataset Row Limit

  • The maximum number of rows that an Ad Hoc report can return. JasperServer truncates the data when the limit is reached.
  • Setting this to a lower number may improve performance, but your reports may not reflect the full data set.




(Hope this blog would help you find quicker ways to resolve Ad-hoc performance related issues.)

Best Regards,





Session Management in Spring Security

Before we go to spring security session management let first understand what is session and why session is required.

Whenever we connect to any web server through URL, we use browser as client which uses a HTTP protocol for communication between browser and server. HTTP is a “stateless” protocol which means each time client receives a web page, the client opens a separate connection to web server and server automatically does not keep any record of previous client request that means for web server every request is a new request to process and they can’t identify if it’s coming from client that has been sending request previously. But sometime in web applications, we should know who client is and process the request accordingly.

Session is a conversional state between client and server and it consists of multiple request and response between client and server. Since HTTP protocol and web server both are “stateless” the only way to maintain a session is when some unique information about session like session id is passed between server and client in every request and response. In other words session is unique Id created by container to identify the user from whom the request in coming in

spring security.

Now we jump to how is session management takes place in spring security.

When is session created?
We can control exactly when our sessions get created and how spring security interact with it.
1. always – a session will always be created if one already does not exist
2. ifRequired – a session is created if required (Default).
3. never – a framework will never create a session itself. But it will use one if it already exists.
4. Stateless – no session is created or used by spring security.

<http create-session=”ifRequired”>….</http>

It is very important to understand that this configuration only controls what spring security does – not the entire application. Spring security may not create the session in we instruct it not to, but our application may!

By default spring security will create session when it needs one. This is ”ifRequired”
For a more “stateless” application, the “never” option will ensure that spring security itself will not create any session; however if application creates one, the spring security makes use of it.

Finally, the strictest session creation option – “stateless” – is guarantee that the application will not create any session at all.

Concurrent Session Control
When a user that is already authenticated tries to authenticate again, the application can deal with that event in one of a few ways. It can either invalidate the active session of the user and authenticate the user again with a new session, or allow both sessions to exist concurrently.

First step in enabling the concurrent session-control support is to add the following listener in the web.xml:







This is essential to make sure that the Spring Security session registry is notified when the session is destroyed.

To enable the scenario which allows multiple concurrent sessions for the same user the element should be used in the XML configuration:

<http …>


<concurrency-control max-sessions=”3″ />


Session Timeout

After the session has timed out, if the user sends a request with an expired session id, they will be redirected to an URL configurable via the namespace:

<concurrency-control expired-url=”/sessionExpired.html” … />


Similarly, if the user sends a request with a session id which is not expired, but entirely invalid, they will also be redirected to a configurable URL:
<session-management invalid-session-url=”/invalidSession.html”>


Sorting Data In Mysql Based On Field Value Of a column

This blog will teach you how to sort Data In Mysql Based On Field Value Of a column

We can sort data based on field value of a column by using ORDER BY FIELD () in mysql.

Database : world

Table name : country

If i will execute the below query :

“select distinct Continent from country” then i will get the output as :


Let say that we want to sort the data in a specific order by “Asia,Africa,North America,South America,Antarctica,Oceania,Europe”.

So in this case we can not perform simply order by because either by ascending or descending , we can not get our required output.

So let’s use the below query :

“select distinct Continent from country

order by field (Continent,’Asia’,


‘North America’,

‘South America’,




And we will get the output as required:



Rupam Bhardwaj