struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mraible <m...@raibledesigns.com>
Subject Re: How can I tell Struts 2 to throw/log exceptions for invalid OGNL Expressions
Date Mon, 27 Aug 2007 15:46:59 GMT

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="@org.appfuse.web.TestAction@concat('1', '2')"/>
>> 
>> However, if I change it to an invalid class name, it fails silently:
>> 
>> <s:property value="@org.appfuse.web.InvalidClass@concat('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(@vs@SETTINGS_SERVLET).q('${q}')"/>
> 
> VS:
> 
> <s:property
> value="url(@vs@SETTINGS_SERVLET).q(@org.foo.bar.baz.enums.EnumCodec@URL.encode(@org.foo.bar.baz.SettingsServlet$ACTIONS@networkUpdates))"/>
> 
> 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#a12351943
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message