[
http://www.stripesframework.org/jira/browse/STS-730?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12610#comment-12610
]
Peter Štibraný commented on STS-730:
------------------------------------
Example JSP code: <stripes:options-map map="${actionBean.availableOptions}"/>
Where
{noformat}
Map<Integer, String> ActionBean.getAvailableOptions() {
return ImmutableMap.of(
1, "Option 1",
2, "Option 2");
}
{noformat}
> Support google collections ImmutableMaps with stripes:options-map
> -----------------------------------------------------------------
>
> Key: STS-730
> URL: http://www.stripesframework.org/jira/browse/STS-730
> Project: Stripes
> Issue Type: Improvement
> Components: Tag Library
> Affects Versions: Release 1.5.1, Release 1.5.2
> Environment: any
> Reporter: Nathan Feger
>
> google's collections API makes for a very novel way to make immutable maps:
> http://code.google.com/p/google-collections/
> http://google-collections.googlecode.com/svn/trunk/javadoc/com/google/common/collect/ImmutableMap.html
> Map:
> public static final Map<String, String> MAP = new
> ImmutableMap.Builder<String, String>()
> .put("abc", "xyz")
> .put("key2", "value2")
> .build()
> However, when the tag attempts to read the key and value out of the
> ImmutableEntry class (that extends Map.Entry) it throws an exception:
> 2009-12-08 11:00:46,817 ERROR [http-8080-Processor25]
> core.ApplicationDispatcher (ApplicationDispatcher.java:711) -
> Servlet.service() for servlet jsp threw exception
> java.lang.IllegalAccessException: Class
> net.sourceforge.stripes.util.bean.JavaBeanPropertyAccessor can not access a
> member of class com.google.common.collect.ImmutableEntry with modifiers
> "public"
> at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:65)
> at java.lang.reflect.Method.invoke(Method.java:588)
> at
> net.sourceforge.stripes.util.bean.JavaBeanPropertyAccessor.getValue(JavaBeanPropertyAccessor.java:51)
> at
> net.sourceforge.stripes.util.bean.PropertyExpressionEvaluation.getValue(PropertyExpressionEvaluation.java:588)
> at
> net.sourceforge.stripes.util.bean.BeanUtil.getPropertyValue(BeanUtil.java:62)
> at
> net.sourceforge.stripes.tag.InputOptionsCollectionTag.doStartTag(InputOptionsCollectionTag.java:242)
> at
> org.apache.jsp.WEB_002dINF.jsp.account.find_jsp._jspx_meth_s_005foptions_002dcollection_005f0(find_jsp.java:859)
> at
> org.apache.jsp.WEB_002dINF.jsp.account.find_jsp._jspx_meth_s_005fselect_005f0(find_jsp.java:777)
> at
> org.apache.jsp.WEB_002dINF.jsp.account.find_jsp._jspService(find_jsp.java:235)
> at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> at
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
> at
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
> at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
> at
> net.sourceforge.stripes.controller.DynamicMappingFilter.doFilter(DynamicMappingFilter.java:346)
> at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
> Not supporting the google collections probably won't end the world, but they
> are surprisingly nice to work with.
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development