Hiya, First of all, thanks to those who responded on my last silly question. Yet another newbie probably really easy question. Sorry. This may be a fraction off-topic as it's not strictly a maverick question per se, but any answers could help others in the same boat.
I have a page with a structure like this:
Wrapper start
Prologue
Form
Submit
Epilogue
Wrapper End
The wrapper 'wraps' the central prologue-epilogue which is simply a jsp
view. The user fills in the form and submits. The page is then recalled, but
during the wrapper start, a configurable piece of javascript (via <c:set/>
in the prologue) is used to start a new window (via window.open()) to create
a new page that would also get the model and proceed to use Lowagies pdf
library to create a pdf based on the same model that is used in the page.
Thus the page above is simply a 'controller' to allow the user to choose
options which the model then uses to calculate resultant values which are
exposing in a pdf output file in a seperate window. The window.open() uses
'http.../pdf.m' as it's url, so a <command/> is called which uses the same
controller class as the page above. The /pdf is a servlet rather than a jsp
btw. The whole thing is sort of like a fork-and-exec process.
The pdf servlet can access the model and maverick context via the
request.getAttribute() methods. But the model is (not surprisingly) empty.
The wrapper code in the 'view' page *could* push the incoming model into a
session variable I suppose, and the servlet retrieve it, stuff it into the
request, then call the context go(), then the models perform() method, but
the choice of stuffing things into the session feels a tad clunky and makes
it 100% dependent on a session. I could also have the wrapper-start
javascript code have a querystring pasted on which has all the models
name-values and do the same go() - perform() process, but that also seems
clunky especially since this is a financial application and the model has a
lot of 'bits' to it which would be a tad ugly in a querystring.
I have to point out that the issue is cloning a model and getting that model
into a new request, not the processing of it via go() and perform() within
the servlet.
So my question is: can anybody think of an elegant way to pass a
model-as-controller to a new window with cloned values? Or even a more
elegant way to perform the whole process?
Ta muchly
Kimbo
Ms Kimberley Scott
Senior Software Engineer
DCG Media Ltd
<<attachment: winmail.dat>>
