Question

I load the city and state from my database. I used the below code in JSP:

<s:action executeResult="true" name="LoadCities"> </s:action>

It works fine during the initial page loading, but gives me issue when I update the cities in my database. After the the update is successful I redirect this the same page.

But this time I am getting the following exception:

The server side component of the HTTP Monitor has detected a 
java.lang.StackOverflowError. This happens when there is an infinite loop in 
the web module. Correct the cause of the infinite loop before running 
the web module again.

2014-03-18 15:51:02,965 WARN  org.apache.struts2.components.Include.warn:49 -
Exception thrown during include of header.jsp javax.servlet.ServletException: 

The server side component of the HTTP Monitor has detected a 
java.lang.StackOverflowError. This happens when there is an infinite loop in 
the web module. Correct the cause of the infinite loop before running 
the web module again.

How could I fix this problem?

Was it helpful?

Solution

This happens because you are executing a result that maps to the same JSP used with s:action tag. You should be careful in mapping JSPs when using the s:action tag.

Actually you should reconsider the design your JSPs because this tag is rarely used and a few cases might apply to it. You can prepare the JSP on the server side using the only one action (also it could be chained but is not recommended here), but you can prepare many fragments or tiles in it.

So, you either don't use the s:action tag, or use it with executeResult="false", or choose one of the approaches above to split the design of the JSP pages.

Nowadays Ajax is very popular that can solve many problems with loading data on the client side and updating the content. So you have many possibilities to do that.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top