Help coderanch get a
new server
by contributing to the fundraiser

sathya rajavel

+ Follow
since May 30, 2011
Merit badge: grant badges
For More
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by sathya rajavel


I have to create dynamic menu in struts2.and the menus wants to come from database using json....
11 years ago
I have a requirement where in I have to implement a technique to validate the user before he starts accessing the application. Also, I need to check if a valid user has logged in whenever he accesses any page in the application. If the user has not logged in, then I should redirect the user to the login screen.

So I am using a Login Authentication filter to do this. I have placed the login related xhtml files in a folder /login/. Once the user is authenticated, then he is directed to application pages which are placed under /pages/... folder.

My filter mapping is given below:


Scenario 1:
When the user access the login page directly from the browser, the login.xhtml page loads correctly. On click of login button in login.xhtml, the user is authenticated and transfered to application specific pages under /pages/welcomeuser.xhmtl. The filter is not invoked on click of login button in login.xhtml at this point in time, because the mapped url for filter is faces/pages/*. This scenario works fine.

Scenario 2:
Let's assume the user directly types the URL http://localhost:8020/pages/welcomeuser.xhtml. the expected behaviour should that the user should redirected to /login.login.xhtml page as the user is not validated yet.

In this case, the doFilter () method in LoginFilter is invoked. Inside this method, I am checking if the user object exists or not. If not exists, then I am redirecting the user to /login/login.xhtml. What happens now is, since I am doing a redirect to a page whose URL pattern matches with URL pattern of filter, it calls the doFilter() again and again and this goes into a indefinite loop.

Please let me know how to overcome this.

The do filter method is given below:

public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
try {"doFilter ");
HttpServletRequest request = (HttpServletRequest) servletRequest;
CfsaosDTO cfsaosDTO = (CfsaosDTO) request.getSession().getAttribute("loggedInUser1");"doFilter1 " + cfsaosDTO);

filterChain.doFilter(servletRequest, servletResponse);

// if(cfsaosDTO.equals(null))
// request.setAttribute("errorMsg", "Login Required");
// request.getRequestDispatcher(errorURL).forward(request, servletResponse);
// request.getRequestDispatcher("/index.jsp").forward(request, servletResponse);

} finally{

// UserUtil.removeUserId();

11 years ago
Here Arraylist contains value but the datasource returns null.please please help me

Hi I have created the report design where the both rows and columns grow dynamically .So in columns i pass the parameters and for rows to grow dynamically i have given the firld names both the params and fields i have given with the extension from DTO.
Now in action class.The fields which are to be displayed i have stored in a list and in struts.xml file for the datasource i have given this list name.Nowthye list contains value.but in pdf its showing null.

Jrxml file


I have created a file upload and i make the uploaded file to save in folder.

Now once it get uploaded i created a hyperlink by clicking on the link it should get download please send me the full code for download


12 years ago

how to download a file which is uploaded using struts 2

12 years ago

i want to create system tray
while clicking the system tray it should open a frame for login

13 years ago