Action declaration question (Webwork/Hibernate)
SchottenHammel <[email protected]> Fri, 15 Dec 2006 10:11:28 CST
| Newsgroups | gmane.comp.java.open-symphony.webwork |
|---|---|
| Message-ID | <33478523.1166199118524.JavaMail.os-j2ee@opensymphony01.managed.contegix.com> |
Hi guys,
I have a more or less general question about how you declare your actions in the xwork/struts.xml, especially in combination with Hibernate.
I really like the approach of having a BaseAction, that is responsible for all page views in general. Here an example.
<action name="page" class="test.BaseAction">
<result name="success" type="freemarker">/WEB-INF/views/${view}.ftl</result>
</action>
${view} should always be passed to BaseAction as a http parameter and so the person who creates static(!) ftls/jsps etc. just links to the new pages via (for example) .../page.action?view="filmIndex".
The tricky part is dynamic content. Say I have a FilmDatabaseApplication and want to display the 10 latest movies, or the best 10 horror movies. I don't really see "why" I would need an extra action for that, I could still use my BaseAction class.
The only difference is, that in my .ftl I need to declare , e.g., a list variable like that:
<#assign list = ...filmDAO.get10LatestFlicks()> and now I can display the movie list in my ftl.
Now the real problem is where to apply the transaction demarcation code, i.e theOpenSessionInView interceptor, because I don't want sessions/transactions to be opened every time (static) pages are opened up, only for the ones that read data from the database and display it.
So how do you guys go about building your webapps? Creating an action for every page, also read only pages?
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.opensymphony.com/thread.jspa?threadID=53761&messageID=107951#107951
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]