Struts2 Redirect to External URL

We want to redirect the action to another website or URL.for that syntax is used

type=”redirect” is used to redirect this action to the specified URL is a variable in the action class with getter and setter methods.We are getting the URL value from the JSP page to get the URL value in … Read more

html/jsp page response in ajax get method

We want to get an entire page as ajax response by using jquery get method. Steps: 1) First create pages(FirstJsp.jsp and SecondJsp.jsp) 2) call jquery get method to get ajax response in one page(here FirstJsp.jsp to get SecondJsp.jsp) 3)Configure struts.xml file Lets start with page creating FirstJsp.jsp




How to get client IP address in java Struts2

When users submit a form along with form data we can get the IP address of the client. Let’s see one simple program to demonstrate this request.getHeader(“X-FORWARDED-FOR”);  is used to get the address of client in java/jsp/struts and in spring.

Struts2 Json and Jquery Example

Here we will fetch a action variable’s value in jsp page using JSON and jquery Here I am using struts 2.3.4 for that we have to include struts-2-json-plugin-2.3.4.jar in class path or include it to your lib folder if you are using any IDE. Action class

In struts.xml we have to extend json-default and … Read more

Passing parameter from jsp page to struts2 action

Project Explorer Library files addstudent.jsp





Passing object from JSP page to action using model driven

Project Explorer addstudent.jsp

Enter Student Details



Student Detail


Setting page theme simple

In particular jsp page we can set that page simple by including following tags In jsp page

This will set page theme simple. It will not generate struts2 tabular format user has to create his own format while using theme simple. Example:

Flying saucer with struts2

Flying Saucer takes XML or XHTML and applies CSS 2.1-compliant stylesheets to it, in order to render to PDF (via iText), images, and on-screen using Swing or SWT. The library implements (basically) the entirety of CSS 2.1 and aims to be fully compliant with the W3C specification; it includes a small handful of CSS 3 … Read more

Excel file download in Struts2 using apache POI

Apache POI is a project by Apache Software Foundation. It provides the Java API for Microsoft Documents. You can find out more about Apache POI. You can also download apache POI from here. how to save xls file in java struts2 Here we are explaining how to export data from struts2 action to an XML … Read more

Showing JQuery Arraylist values using Struts2 and JSON

I am having comment class, I want to show its property values to jsp page using json

ListJson assigning values for Here we fetch value of commentList and totalcomments value in our jsp page.


In Jsp page