Rick Reumann <[EMAIL PROTECTED]> wrote:
> Mike Kienenberger wrote the following on 9/17/2004 2:17 PM:
>
> > Not relevent to my situation. We require a WebObjects-like page state
cache
> > to handle backtracking issues. Thus our URLs end up looking like
> > http://xxxx.com:7777/ebpp/duSRSod7x598ZkHOQ16p1spKaMzS3yj1Dj_1.1.psc and
> > contain no user-meaningful information.
>
> Wow I'd like to see how you implemented that some day. Sounds pretty
> cool.
Yeah, I'm hoping to get permission to open source it when my current project
using it goes production and the smoke clears (which is next week). I find
it hard to believe much work can get done without something like this. I'm
hoping something like this can be added to the next "revolution" of struts.
> So I take it your Struts JSP Form would look like...
> <html:form action="${updateSecure}">
>
> Where you'd pass to the page this encoded String for the action name
Actually, I use Velocity rather than JSP, but almost the right idea. I let
the <html:form> (actually StrutsLinkTool) do the encoding. I just
subclassed StrutsLinkTool to enhance toString() to generate the encoded URL.
It's almost a one-liner except for a bit of a hack necessary to add in #
anchor support. I'd imagine the taglib version would just subclass the
appropriate html:form code to do the same thing.
By doing it this way, there's no difference between the html template that
uses such a cache and one that doesn't. This is helpful since some pages
are "normal" struts pages (external) and some are "cached" (internal) pages.
I can change between the two types in code just by changing the page state
manager setting for the session. Obviously, this only works for pages that
have no expected page state since those page state attributes won't be there
for normal struts. I suppose it could be handled by automatically passing
them through as parameters, but I've never had the need to regress to that.
> and then it gets translated somewhere in the RequestProcessor to equate
to
> an actual mapping in the struts-config?
Nope, took advantage of the servlet architecture and just created a servlet
that decodes "psc" requests into struts "do" requests via the
RequestDispatcher.forward method.
<!-- page state decoder servlet -->
<servlet>
<servlet-name>pageState</servlet-name>
<servlet-class>
com.gvea.servlet.pageStateCache.PageStateCacheServlet</servlet-class>
<load-on-startup>5</load-on-startup>
</servlet>
The only "hooks" into struts are the modification of the <html:form>, and,
for my own needs, a hook into RequestProcessor so that on a validation
failure, the previous pagestate attributes get copied into the current page
state. Otherwise, I was losing all of my state when the Validator found an
error. You also need a pagestate attribute accessor (a PageState tool in
velocity -- not sure how it's done in JSP), but that's not really a
modification of struts.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]