You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ajay Patil <ap...@vertex.co.in> on 2003/07/09 06:14:21 UTC
Design question: Confirm action after validation ?
Hello,
In my Struts application, the validation is done on server-side
for every page. If the validation is successful, the user would
like to see a page to confirm his action. The Confirm page should
also have a Cancel button allowing him to go back to the previous
page showing the data entered so far.
This functionality is needed for every action.
I am thinking if there is a generic way by which I can achieve this
functionality.
I also realize that I might end up making scope=session for
every form, in trying to implement this requirement. (and I am
worried about this too).
Any ideas, pointers and/or thoughts will be very useful.
Ajay
----------------------------------------------------
Ajay Patil
Vertex Software Pvt. Ltd.
apatil@vertex.co.in
http://www.vertex.co.in
----------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Re: Design question: Confirm action after validation ?
Posted by Adam Hardy <ah...@cyberspaceroad.com>.
I plan on using EJB but haven't got that far yet. At the moment I am
using a bunch of 'factory' classes as my model, and would like to
isolate this layer from the request, response objects etc in the actions.
So the fact that I get the connection in the base action is a legacy
thing - I thought about changing it and probably will soon, to a
strategy where the actions don't see the connection. I changed the
database configuration so that the pool is a JNDI resource, but I
haven't got around to this second bit yet because the interface between
the actions and the factories requires more thought as to how I marshall
the data across.
Adam
Shashank Dixit wrote:
> Hi again
>
> Are you using EJBs??
> If you are using EJB, where is the connection pool?
> At webserver side or app server side.
> Or where datasource is defined. at web server or app server?
> How you are taking data(Value Objects) from webserver to appserver
>
> Shashank
>
> ----- Original Message -----
> From: "Adam Hardy" <ah...@cyberspaceroad.com>
> To: "Struts Users Mailing List" <st...@jakarta.apache.org>
> Sent: Wednesday, July 09, 2003 3:26 PM
> Subject: Re: Design question: Confirm action after validation ?
>
>
>
>>my base action class sorts out all the general objects and variables
>>that the child actions need - this is the child action's execute()
>>signature:
>>
>>public String executeList(ActionMapping mapping,
>> ActionForm form,
>> HttpServletRequest request,
>> HttpServletResponse response,
>> BlackSailUser user,
>> Locale locale,
>> MessageResources messages,
>> ActionErrors errors,
>> Connection conn)
>> throws Exception
>>
>>I guess the list of responsibilites for the base action superclass is:
>>
>>(1) establish the action to carry out (your GO, ADD, SAVE etc) which is
>>a token that is set by any of a request parameter, request attribute,
>>action mapping parameter, or cancel button.
>>(2) get a jdbc connection object from pool
>>(3) get message resources from request
>>(4) get locale from request
>>(5) get user object from session
>>(6) get errors from request
>>(7) error handling (I don't have any in my subclasses)
>>(8) get any lists for drop-down boxes (a seperate call to subclass)
>>
>>Had to check that out by looking at the code. It served me fine since my
>>first struts app.
>>
>>Shashank Dixit wrote:
>>
>>>Hello Adam
>>>
>>>I have one doubt.
>>>
>>>You have base action class for all your subaction classes.
>>>What is the responsibility of this base action class.
>>>Do your base action class checks which button is clicked?
>>>If there are say 10 buttons in one form (say, GO, ADD, SAVE, NEXT, etc)
>>>are there 10 if statements in your class. Or it
>>>is sub action class resposibility to check this.? are there 10 or (any
>
> no)
>
>>>of if statements in subaction classes.?
>>>How to eliminate those if statements? any idea?
>>>
>>>Pls reply
>>>Shashank
>>>
>>>
>>>----- Original Message -----
>>>From: "Adam Hardy" <ah...@cyberspaceroad.com>
>>>To: "Struts Users Mailing List" <st...@jakarta.apache.org>
>>>Sent: Wednesday, July 09, 2003 2:52 PM
>>>Subject: Re: Design question: Confirm action after validation ?
>>>
>>>
>>>
>>>
>>>>I have an Action base class which all my other Action classes inherit.
>>>>In the execute() of this base class I check whether the user clicked
>>>>cancel, before I call the child class execute().
>>>>
>>>>I presume it would be easy enough to store the originating URL in the
>>>>session, and if cancel is clicked, roll your own Action Forward back to
>>>>this URL.
>>>>
>>>>Since it is all in the base class, it could work for every action as
>>>>long as you are careful to watch the parameters or ids.
>>>>
>>>>Ajay Patil wrote:
>>>>
>>>>
>>>>>Hello,
>>>>>
>>>>>In my Struts application, the validation is done on server-side
>>>>>for every page. If the validation is successful, the user would
>>>>>like to see a page to confirm his action. The Confirm page should
>>>>>also have a Cancel button allowing him to go back to the previous
>>>>>page showing the data entered so far.
>>>>>
>>>>>This functionality is needed for every action.
>>>>>
>>>>>I am thinking if there is a generic way by which I can achieve this
>>>>>functionality.
>>>>>
>>>>>I also realize that I might end up making scope=session for
>>>>>every form, in trying to implement this requirement. (and I am
>>>>>worried about this too).
>>>>>
>>>>>Any ideas, pointers and/or thoughts will be very useful.
>>>>>
>>>>>Ajay
>>>>>
>>>>>----------------------------------------------------
>>>>>Ajay Patil
>>>>>Vertex Software Pvt. Ltd.
>>>>>apatil@vertex.co.in
>>>>>http://www.vertex.co.in
>>>>>----------------------------------------------------
>>>>>
>>>>>
>>>>>---------------------------------------------------------------------
>>>>>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>>>>>For additional commands, e-mail: struts-user-help@jakarta.apache.org
>>>>>
>>>>>
>>>>
>>>>
>>>>---------------------------------------------------------------------
>>>>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>>>>For additional commands, e-mail: struts-user-help@jakarta.apache.org
>>>
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>>>For additional commands, e-mail: struts-user-help@jakarta.apache.org
>>>
>>>
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Re: Design question: Confirm action after validation ?
Posted by Shashank Dixit <Sh...@datamatics.com>.
Hi again
Are you using EJBs??
If you are using EJB, where is the connection pool?
At webserver side or app server side.
Or where datasource is defined. at web server or app server?
How you are taking data(Value Objects) from webserver to appserver
Shashank
----- Original Message -----
From: "Adam Hardy" <ah...@cyberspaceroad.com>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Wednesday, July 09, 2003 3:26 PM
Subject: Re: Design question: Confirm action after validation ?
> my base action class sorts out all the general objects and variables
> that the child actions need - this is the child action's execute()
> signature:
>
> public String executeList(ActionMapping mapping,
> ActionForm form,
> HttpServletRequest request,
> HttpServletResponse response,
> BlackSailUser user,
> Locale locale,
> MessageResources messages,
> ActionErrors errors,
> Connection conn)
> throws Exception
>
> I guess the list of responsibilites for the base action superclass is:
>
> (1) establish the action to carry out (your GO, ADD, SAVE etc) which is
> a token that is set by any of a request parameter, request attribute,
> action mapping parameter, or cancel button.
> (2) get a jdbc connection object from pool
> (3) get message resources from request
> (4) get locale from request
> (5) get user object from session
> (6) get errors from request
> (7) error handling (I don't have any in my subclasses)
> (8) get any lists for drop-down boxes (a seperate call to subclass)
>
> Had to check that out by looking at the code. It served me fine since my
> first struts app.
>
> Shashank Dixit wrote:
> > Hello Adam
> >
> > I have one doubt.
> >
> > You have base action class for all your subaction classes.
> > What is the responsibility of this base action class.
> > Do your base action class checks which button is clicked?
> > If there are say 10 buttons in one form (say, GO, ADD, SAVE, NEXT, etc)
> > are there 10 if statements in your class. Or it
> > is sub action class resposibility to check this.? are there 10 or (any
no)
> > of if statements in subaction classes.?
> > How to eliminate those if statements? any idea?
> >
> > Pls reply
> > Shashank
> >
> >
> > ----- Original Message -----
> > From: "Adam Hardy" <ah...@cyberspaceroad.com>
> > To: "Struts Users Mailing List" <st...@jakarta.apache.org>
> > Sent: Wednesday, July 09, 2003 2:52 PM
> > Subject: Re: Design question: Confirm action after validation ?
> >
> >
> >
> >>I have an Action base class which all my other Action classes inherit.
> >>In the execute() of this base class I check whether the user clicked
> >>cancel, before I call the child class execute().
> >>
> >>I presume it would be easy enough to store the originating URL in the
> >>session, and if cancel is clicked, roll your own Action Forward back to
> >>this URL.
> >>
> >>Since it is all in the base class, it could work for every action as
> >>long as you are careful to watch the parameters or ids.
> >>
> >>Ajay Patil wrote:
> >>
> >>>Hello,
> >>>
> >>>In my Struts application, the validation is done on server-side
> >>>for every page. If the validation is successful, the user would
> >>>like to see a page to confirm his action. The Confirm page should
> >>>also have a Cancel button allowing him to go back to the previous
> >>>page showing the data entered so far.
> >>>
> >>>This functionality is needed for every action.
> >>>
> >>>I am thinking if there is a generic way by which I can achieve this
> >>>functionality.
> >>>
> >>>I also realize that I might end up making scope=session for
> >>>every form, in trying to implement this requirement. (and I am
> >>>worried about this too).
> >>>
> >>>Any ideas, pointers and/or thoughts will be very useful.
> >>>
> >>>Ajay
> >>>
> >>>----------------------------------------------------
> >>>Ajay Patil
> >>>Vertex Software Pvt. Ltd.
> >>>apatil@vertex.co.in
> >>>http://www.vertex.co.in
> >>>----------------------------------------------------
> >>>
> >>>
> >>>---------------------------------------------------------------------
> >>>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> >>>For additional commands, e-mail: struts-user-help@jakarta.apache.org
> >>>
> >>>
> >>
> >>
> >>---------------------------------------------------------------------
> >>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> >>For additional commands, e-mail: struts-user-help@jakarta.apache.org
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: struts-user-help@jakarta.apache.org
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Re: Design question: Confirm action after validation ?
Posted by Adam Hardy <ah...@cyberspaceroad.com>.
my base action class sorts out all the general objects and variables
that the child actions need - this is the child action's execute()
signature:
public String executeList(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response,
BlackSailUser user,
Locale locale,
MessageResources messages,
ActionErrors errors,
Connection conn)
throws Exception
I guess the list of responsibilites for the base action superclass is:
(1) establish the action to carry out (your GO, ADD, SAVE etc) which is
a token that is set by any of a request parameter, request attribute,
action mapping parameter, or cancel button.
(2) get a jdbc connection object from pool
(3) get message resources from request
(4) get locale from request
(5) get user object from session
(6) get errors from request
(7) error handling (I don't have any in my subclasses)
(8) get any lists for drop-down boxes (a seperate call to subclass)
Had to check that out by looking at the code. It served me fine since my
first struts app.
Shashank Dixit wrote:
> Hello Adam
>
> I have one doubt.
>
> You have base action class for all your subaction classes.
> What is the responsibility of this base action class.
> Do your base action class checks which button is clicked?
> If there are say 10 buttons in one form (say, GO, ADD, SAVE, NEXT, etc)
> are there 10 if statements in your class. Or it
> is sub action class resposibility to check this.? are there 10 or (any no)
> of if statements in subaction classes.?
> How to eliminate those if statements? any idea?
>
> Pls reply
> Shashank
>
>
> ----- Original Message -----
> From: "Adam Hardy" <ah...@cyberspaceroad.com>
> To: "Struts Users Mailing List" <st...@jakarta.apache.org>
> Sent: Wednesday, July 09, 2003 2:52 PM
> Subject: Re: Design question: Confirm action after validation ?
>
>
>
>>I have an Action base class which all my other Action classes inherit.
>>In the execute() of this base class I check whether the user clicked
>>cancel, before I call the child class execute().
>>
>>I presume it would be easy enough to store the originating URL in the
>>session, and if cancel is clicked, roll your own Action Forward back to
>>this URL.
>>
>>Since it is all in the base class, it could work for every action as
>>long as you are careful to watch the parameters or ids.
>>
>>Ajay Patil wrote:
>>
>>>Hello,
>>>
>>>In my Struts application, the validation is done on server-side
>>>for every page. If the validation is successful, the user would
>>>like to see a page to confirm his action. The Confirm page should
>>>also have a Cancel button allowing him to go back to the previous
>>>page showing the data entered so far.
>>>
>>>This functionality is needed for every action.
>>>
>>>I am thinking if there is a generic way by which I can achieve this
>>>functionality.
>>>
>>>I also realize that I might end up making scope=session for
>>>every form, in trying to implement this requirement. (and I am
>>>worried about this too).
>>>
>>>Any ideas, pointers and/or thoughts will be very useful.
>>>
>>>Ajay
>>>
>>>----------------------------------------------------
>>>Ajay Patil
>>>Vertex Software Pvt. Ltd.
>>>apatil@vertex.co.in
>>>http://www.vertex.co.in
>>>----------------------------------------------------
>>>
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>>>For additional commands, e-mail: struts-user-help@jakarta.apache.org
>>>
>>>
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Re: Design question: Confirm action after validation ?
Posted by Shashank Dixit <Sh...@datamatics.com>.
Hello Adam
I have one doubt.
You have base action class for all your subaction classes.
What is the responsibility of this base action class.
Do your base action class checks which button is clicked?
If there are say 10 buttons in one form (say, GO, ADD, SAVE, NEXT, etc)
are there 10 if statements in your class. Or it
is sub action class resposibility to check this.? are there 10 or (any no)
of if statements in subaction classes.?
How to eliminate those if statements? any idea?
Pls reply
Shashank
----- Original Message -----
From: "Adam Hardy" <ah...@cyberspaceroad.com>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Wednesday, July 09, 2003 2:52 PM
Subject: Re: Design question: Confirm action after validation ?
> I have an Action base class which all my other Action classes inherit.
> In the execute() of this base class I check whether the user clicked
> cancel, before I call the child class execute().
>
> I presume it would be easy enough to store the originating URL in the
> session, and if cancel is clicked, roll your own Action Forward back to
> this URL.
>
> Since it is all in the base class, it could work for every action as
> long as you are careful to watch the parameters or ids.
>
> Ajay Patil wrote:
> > Hello,
> >
> > In my Struts application, the validation is done on server-side
> > for every page. If the validation is successful, the user would
> > like to see a page to confirm his action. The Confirm page should
> > also have a Cancel button allowing him to go back to the previous
> > page showing the data entered so far.
> >
> > This functionality is needed for every action.
> >
> > I am thinking if there is a generic way by which I can achieve this
> > functionality.
> >
> > I also realize that I might end up making scope=session for
> > every form, in trying to implement this requirement. (and I am
> > worried about this too).
> >
> > Any ideas, pointers and/or thoughts will be very useful.
> >
> > Ajay
> >
> > ----------------------------------------------------
> > Ajay Patil
> > Vertex Software Pvt. Ltd.
> > apatil@vertex.co.in
> > http://www.vertex.co.in
> > ----------------------------------------------------
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: struts-user-help@jakarta.apache.org
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Re: Design question: Confirm action after validation ?
Posted by Adam Hardy <ah...@cyberspaceroad.com>.
I have an Action base class which all my other Action classes inherit.
In the execute() of this base class I check whether the user clicked
cancel, before I call the child class execute().
I presume it would be easy enough to store the originating URL in the
session, and if cancel is clicked, roll your own Action Forward back to
this URL.
Since it is all in the base class, it could work for every action as
long as you are careful to watch the parameters or ids.
Ajay Patil wrote:
> Hello,
>
> In my Struts application, the validation is done on server-side
> for every page. If the validation is successful, the user would
> like to see a page to confirm his action. The Confirm page should
> also have a Cancel button allowing him to go back to the previous
> page showing the data entered so far.
>
> This functionality is needed for every action.
>
> I am thinking if there is a generic way by which I can achieve this
> functionality.
>
> I also realize that I might end up making scope=session for
> every form, in trying to implement this requirement. (and I am
> worried about this too).
>
> Any ideas, pointers and/or thoughts will be very useful.
>
> Ajay
>
> ----------------------------------------------------
> Ajay Patil
> Vertex Software Pvt. Ltd.
> apatil@vertex.co.in
> http://www.vertex.co.in
> ----------------------------------------------------
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org