Note that there are some explanatory texts on larger screens.

plurals
  1. POStruts2 i18NInterceptor no longer working with ExecuteAndWaitInterceptor
    text
    copied!<p>I'm using the struts2 tiles plugin (v2.2.3) and I'm having a problem using the I18nInterceptor with the ExecuteAndWaitInterceptor. Essentially when I add the execAndWait interceptor (see xml below) for some reason the localization no longer works and when I try to get localized text (e.g. TextProviderSupport.hasKey) I get a NullPointerException (see error) that I narrowed down to this code in LocalizedTextUtil...</p> <pre><code>public static String findText(Class aClass, String aTextName, Locale locale, String defaultMessage, Object[] args) { ValueStack valueStack = ActionContext.getContext().getValueStack(); return findText(aClass, aTextName, locale, defaultMessage, args, valueStack); } </code></pre> <p>... I'm assuming the getValueStack() is null for some reason, but I cannot figure out why. Any ideas?</p> <p>Thanks, Ryan</p> <pre><code>&lt;pre&gt;&lt;code&gt; java.lang.NullPointerException at com.opensymphony.xwork2.util.LocalizedTextUtil.findText(LocalizedTextUtil.java:359) at com.opensymphony.xwork2.TextProviderSupport.hasKey(TextProviderSupport.java:98) at com.opensymphony.xwork2.ActionSupport.hasKey(ActionSupport.java:96) at com.test.plus.PlusSupport.getCurrentLocale(PlusSupport.java:213) at com.test.plus.import.Test.action.TestAction.testMethod(TestAction.java:801) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:452) at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:291) at org.apache.struts2.interceptor.BackgroundProcess$1.run(BackgroundProcess.java:57) at java.lang.Thread.run(Unknown Source) &lt;/code&gt;&lt;/pre&gt; </code></pre> <p><strong>Struts.xml</strong> </p> <pre><code>&lt;action name="Test/m/testMethod" method="testMethod" class="com.test.plus.import.Test.action.TestAction"&gt; &lt;result type="tiles"&gt;/WEB-INF/jsp/import/Test/testMethod.jsp&lt;/result&gt; &lt;result name="success" type="tiles"&gt;/WEB-INF/jsp/import/Test/testMethod.jsp&lt;/result&gt; &lt;result name="input" type="tiles"&gt;/WEB-INF/jsp/import/Test/testMethod.jsp&lt;/result&gt; &lt;result name="error" type="tiles"&gt;/WEB-INF/jsp/import/Test/testMethod.jsp&lt;/result&gt; &lt;result name="wait" type="tiles"&gt;/WEB-INF/jsp/import/execAndWait.jsp&lt;/result&gt; &lt;interceptor-ref name="plusStack"/&gt; &lt;interceptor-ref name="defaultStack"/&gt; &lt;interceptor-ref name="execAndWait"&gt; &lt;param name="excludeMethods"&gt;input,back,cancel&lt;/param&gt; &lt;/interceptor-ref&gt; &lt;/action&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload