Wishing for JSP filters
January 26th, 2004 by HenAnnoyed that I can’t set filters up easily for a JSP page, in JSP.
Instead I have to implement the Filter interface in a class [well I could implement in the JSP, but that seems fugly even to a JSP fan like me].
Effectively I have a generic ‘_save.jsp’ which handles the saving to the persistence layer. I want to be able to wrap this with pre-persist and post-persist fragments, so I’m looking at a form like:
<persist:form type=”com.example.Bean” prepersist=”Bean.pre” postpersist=”Bean.post”>
…
</persist:form>
which translates to a <form> and various hidden tags. The action would point to “_create.jsp”, though it’s tempting to move it to a taglib as it’s easier to install this across projects. I guess <pre> and <post> can be blocks in the <form>.
[_save.jsp by the way is for a persist:form which has an id= and id_name= set.]
Obviously I’m just rambling here. A way to plug pre and post hacks into a generic ‘method’, at the JSP level.
The taglib approach seems workable. Hmm. Talking to the blog appears to be just as good as talking out loud [annoys wife] or to a colleague.
