Have you tried doing this with devMode turned on? <struts> <constant name="struts.devMode" value="true" />
For example, if I add to the form on MailReader Login.jsp <s:textfield name="doesntexist" /> and submit the form with devmode=true, the following is logged Sep 6, 2007 11:14:52 AM com.opensymphony.xwork2.validator.ActionValidatorManagerFactory <clinit> INFO: Detected AnnotationActionValidatorManager, initializing it... Sep 6, 2007 11:15:01 AM com.opensymphony.xwork2.interceptor.ParametersInterceptor setParameters SEVERE: ParametersInterceptor - [setParameters]: Unexpected Exception caught setting 'button.save' on 'class mailreader2.Login: Error setting expression 'button.save' with value '[Ljava.lang.String;@e33e18' Sep 6, 2007 11:15:01 AM com.opensymphony.xwork2.interceptor.ParametersInterceptor setParameters SEVERE: ParametersInterceptor - [setParameters]: Unexpected Exception caught setting 'doesntexist' on 'class mailreader2.Login: Error setting expression 'doesntexist' with value '[Ljava.lang.String;@15f1f9c' HTH, Ted. http://husted.com/ted/blog/ On 8/28/07, mraible <[EMAIL PROTECTED]> wrote: > > I'm now digging into XWork to see if I can add this functionality. I have the > following in a JSP and I'd like to receive an error from it: > > <s:property value="methodDoesntExist('foo')"/> > > OgnlValueStack lines 260-265: > > Object value = OgnlUtil.getValue(expr, context, root, asType); > if (value != null) { > return value; > } else { > return findInContext(expr); > } > > In this example, the following method is called with > "methodDoesntExist('foo')"" as the value for name: > > private Object findInContext(String name) { > return getContext().get(name); > } > > So if nothing is found in the map, null is returned (I'm assuming). It seems > like the if/else statement might be better with the following: > > Object value = OgnlUtil.getValue(expr, context, root, asType); > if (value != null) { > return value; > } else { > value = findInContext(expr); > if (value == null) { > logLookupFailure(expr, ??); > } > } > > However, I don't know what to put in the ?? location. Thoughts on this? > > Thanks, > > Matt > > mraible wrote: > > > > Is it possible to use altSyntax to solve this problem? In other words, > > require %{} around all expressions? Looking through the docs, it doesn't > > seem like altSyntax is supported in Struts 2. > > > > https://issues.apache.org/struts/browse/WW-1819 > > > > Thanks, > > > > Matt > > > > > > mraible wrote: > >> > >> > >> mraible wrote: > >>> > >>> I have the following class: > >>> > >>> public class TestAction { > >>> > >>> public static String concat(String str1, String str2) { > >>> return str1 + " and " + str2; > >>> } > >>> } > >>> > >>> In a JSP, I can write the following and it works fine: > >>> > >>> <s:property value="@[EMAIL PROTECTED]('1', '2')"/> > >>> > >>> However, if I change it to an invalid class name, it fails silently: > >>> > >>> <s:property value="@[EMAIL PROTECTED]('1', '2')"/> > >>> > >>> I've tried turning up the logging for org.apache.struts2, > >>> com.opensymphony.xwork2 and ognl - but it still fails silently. Any > >>> ideas how to get better error messages about invalid OGNL expressions? > >>> > >> > >> I'll take that as a "no", it is not possible to get better error > >> messages. That's too bad since it seems I get better type-safety and > >> errors from scriptlets instead of OGNL. > >> > >> <%@ page > >> import="org.foo.bar.baz.SettingsServlet,org.foo.bar.baz.enums.EnumCodec" > >> %> > >> > >> <c:set > >> var="q"><%=EnumCodec.URL.encode(SettingsServlet.ACTIONS.networkUpdates)%></c:set> > >> > >> <s:property value="url(@[EMAIL PROTECTED]).q('${q}')"/> > >> > >> VS: > >> > >> <s:property > >> value="url(@[EMAIL PROTECTED]).q(@[EMAIL PROTECTED](@[EMAIL PROTECTED]))"/> > >> > >> The framework I'm looking to migrate to Struts 2 has the ability for it's > >> EL to read from imported Statics - a pretty cool feature IMO. > >> > >> ${url(pageBean.MAPPING.SETTINGS_SERVLET).q(EnumCodec.URL.encode(SettingsServlet.ACTIONS.networkUpdates))} > >> > >> Matt > >> > >> > > > > > > -- > View this message in context: > http://www.nabble.com/How-can-I-tell-Struts-2-to-throw-log-exceptions-for-invalid-OGNL-Expressions-tf4100102.html#a12373437 > Sent from the Struts - User mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- HTH, Ted <http://www.husted.com/ted/blog/> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]