You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Philip Wachtel <su...@wachtel.us> on 2003/08/26 18:26:44 UTC
get calling page dynamically
Hi there,
I'm trying to dynamically find the calling page name from within an action class. data.getScreenTemplate() returns the html form's action attribute, but not the actual name of the .vm file that had the form on it.
File name security,AddUser.vm
Action specified for form in above file is security,UserAdmin.vm
I'm doing this so that the confirmation page is different that the form page.
getScreenTemplate() returns http:...../security,UserAdmin.vm
What I need is something that will dynamically find security,AddUser.vm so that I can do a setTemplate() in the action if the form fields don't validate. This way I can also re-populate the form with the user's previously inputted fields and display a nice message asking them to correct their error. If the form fields validate, it should forward the user back to the main user admin screen with a message that says "user added" or something.
What would be the proper way to do this?
Thanks!
Regards,
Philip
Re: get calling page dynamically
Posted by "Henning P. Schmiedehausen" <hp...@intermeta.de>.
"Philip Wachtel" <su...@wachtel.us> writes:
>Hi there,
>I'm trying to dynamically find the calling page name from within an =
>action class. data.getScreenTemplate() returns the html form's action =
>attribute, but not the actual name of the .vm file that had the form on =
>it.
Pretty simple. You can't. If you want to know which page the form was on,
you must pass this name in a (hidden) parameter.
An action is called after a request arrives at the servlet and before
the _next_ page is rended. get/setScreenTemplate, get/setScreen and
all this stuff is only for the _next_ screen which is rendered after
the action is run.
A basic explanation of the request -> action -> page -> response cycle
is on http://jakarta.apache.org/turbine/fsd.html under "Action".
Regards
Henning
--
Dipl.-Inf. (Univ.) Henning P. Schmiedehausen INTERMETA GmbH
hps@intermeta.de +49 9131 50 654 0 http://www.intermeta.de/
Java, perl, Solaris, Linux, xSP Consulting, Web Services
freelance consultant -- Jakarta Turbine Development -- hero for hire
"Dominate!! Dominate!! Eat your young and aggregate! I have grotty silicon!"
-- AOL CD when played backwards (User Friendly - 200-10-15)