englishteeth.co.uk

… the weblog of Ian “English Teeth” Robinson
  • rss
  • Home

Scoped Model Driven Interceptor

Ian | July 4, 2008

In my struts 2 project, I have an action that implements the ScopedModelDriven interface.

I have configuration that references the ScopedModelDrivenInterceptor with a session scope…

	<interceptor name="scoped-model-driven" class="com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor">
	     <param name="scope">session</param>
	</interceptor>

My action references this interceptor and specifies the key used when the object was previously put in the session.

	<interceptor-ref name="scoped-model-driven">
		<param name="name">session-key</param>
	</interceptor-ref>

This all works fine, except in my freemarker templates I now need to reference model.myproperty, rather than just property.

I could live with that, but unfortunately

	<#if myproperty?has_content>
		...

no longer returns any results and worse

	<#if model.myproperty?has_content>
		...

blows up completely!

javax.servlet.ServletException: ?size is unsupported for: freemarker.ext.beans.SimpleMethodModel
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:515)
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:419)
com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:119)
com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:55)
org.apache.struts2.dispatcher.ActionContextCleanUp.doFilter(ActionContextCleanUp.java:99)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)

I’ve tried a few variations of reference to no avail.

Very disappointing.
The reason I’m writing this up is that the scoped model driven thing looked almost exactly how I wanted to go with these actions, so I want to remember where I got to, but getting it working is more important.

Back to ModelDriven, SessionAware and Preparable…

Comments
2 Comments »
Categories
development
Tags
freemarker, java, struts2
Comments rss Comments rss
Trackback Trackback

This week I have mostly been reading…

Ian | May 25, 2008

My week started with a look at an evaluation of Spring MVC or JSF+?.

But it wasn’t long before I was consumed by OSGi to the extent that’s I’ve hardly looked at anything else. I intend to post some sort of summary for myself at some point, once my brain has stopped bubbling.

I did find a reasonably interesting/useful page on the Struts 2 plugin architecture.

Comments
No Comments »
Categories
development
Tags
links, mvc, osgi, spring, struts2
Comments rss Comments rss
Trackback Trackback

Author

Ian Robinson is a relatively agile software engineer interested in things both sides of the object relational divide and beyond.

Categories

  • development (37)
  • miscellaneous (28)
  • music (7)
  • software (19)

What I'm Doing...

  • @noelfielding11 why are you in watching telly!? in reply to noelfielding11 2010-04-16
  • What was so good about Nick Drake? These "artists" are covering, music is spot on but no effect at all. Totally lacking the goose pimples. 2010-04-16
  • Some Ginger bloke's on telly covering Nick Drake in a mediocre style. 2010-04-16
  • More updates...

Posting tweet...

Powered by Twitter Tools.

Blogroll

  • Dan North
  • Dave Astels
  • Dave Wood
  • eirikso.com
  • Matt Raible
  • Object Mentor Blog
  • The Ancient Art of Programming
  • The Wisdom of Ganesh

Tags

active-mq architecture bauhaus css db eclipse esb festivals freesat gorm grails groovy hd hibernate htpc java jboss jms junit links mce media center mini music oracle osgi patterns pirsig plugins satellite soa software spring sql struts2 testing themes tools tv vmc web wordpress xml xpath xslt
rss Comments rss valid xhtml 1.1 design by jide powered by Wordpress get firefox