RE: method to get new Id to next action when old Id is in request?

2003-08-09 Thread ansuman_behera
what if there is a restriction that the developers should not be using hidden 
variables? what do you do in this case?

-Original Message-
From: Rohit Aeron [mailto:[EMAIL PROTECTED]
Sent: Friday, August 08, 2003 11:54 AM
To: Struts Users Mailing List
Subject: RE: method to get new Id to next action when old Id is in
request?


Try putting up id as a hidden variable...

Eg:




it would work 

regards
Rohit

-Original Message-
From: Adam Hardy [mailto:[EMAIL PROTECTED] 
Sent: Friday, August 08, 2003 2:56 AM
To: Struts Users Mailing List
Subject: method to get new Id to next action when old Id is in request?

I have two actions chained together. They both take the same formbean. 
The first is sectionInsert.do and the second, which sectionInsert 
forwards to on success, is sectionEdit.do

sectionInsert.do receives the properties of a Section in the request 
parameters, including id=0 where it is 0 because it does not exist in 
the DB yet. So it inserts the new Section into the DB and returns the 
new id, which is needed by sectionEdit to put into the html for the edit 
page.

I originally thought I could save the new id to the formbean and this 
would get passed on, but sectionEdit instantiates its own formbean and 
fills it with the request parameters - include id=0.

Is there an intuitive way of passing on the new id?

I already use sectionEdit.do as a first action by calling it with an id 
on a querystring, where the formbean picks it up. I would like to use a 
method that is easy for both these situations.

I'd appreciate any inspiration.
Adam


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



*--
This message and any attachment(s) is intended only for the use of the addressee(s) 
and may contain information that is PRIVILEGED and CONFIDENTIAL. If you are not the 
intended addressee(s), you are hereby notified that any use, distribution, disclosure 
or copying of this communication is strictly prohibited. If you have received this 
communication in error, please erase all copies of the message and its attachment(s) 
and notify the sender or Kanbay postmaster immediately.

Any views expressed in this message are those of the individual sender and not of 
Kanbay.

Although we have taken steps to ensure that this e-mail and any attachment(s) are free 
from any virus, we advise that in keeping with good computing practice the recipient 
should ensure they are actually virus free.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: method to get new Id to next action when old Id is in request?

2003-08-09 Thread Bailey, Shane C.


I guess you could do this:

sectionInsert_execute()
{
insert into DB
int id = someHowGetTheNewId();

request.setAttribute("my.NewId", new Integer(id));
return mapping.findForward("success");
}


sectionEdit_execute()
{
int newId = 0;
try{
newId =
((Integer)request.getAttribute("my.NewId")).intValue();
}catch(Exception e){
//do whatEver
}

return mapping.findForward("displayEdit");
}


-Original Message-
From: Adam Hardy [mailto:[EMAIL PROTECTED] 
Sent: Thursday, August 07, 2003 5:26 PM
To: Struts Users Mailing List
Subject: method to get new Id to next action when old Id is in request?

I have two actions chained together. They both take the same formbean. 
The first is sectionInsert.do and the second, which sectionInsert 
forwards to on success, is sectionEdit.do

sectionInsert.do receives the properties of a Section in the request 
parameters, including id=0 where it is 0 because it does not exist in 
the DB yet. So it inserts the new Section into the DB and returns the 
new id, which is needed by sectionEdit to put into the html for the edit 
page.

I originally thought I could save the new id to the formbean and this 
would get passed on, but sectionEdit instantiates its own formbean and 
fills it with the request parameters - include id=0.

Is there an intuitive way of passing on the new id?

I already use sectionEdit.do as a first action by calling it with an id 
on a querystring, where the formbean picks it up. I would like to use a 
method that is easy for both these situations.

I'd appreciate any inspiration.
Adam


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: method to get new Id to next action when old Id is in request?

2003-08-10 Thread Andrew Hill
hah. Thats nothing!
Wait till you try coding it without hidden variables AND standing upside
down in a hammock while playing bagpipes at the same time.
Using .net
On a 486
with no monitor

...ah Friday is that BEER I can smell?

hmmm I know
how about tacking it on as a query parameter to the forms action url...?

-Original Message-
From: James Mitchell [mailto:[EMAIL PROTECTED]
Sent: Friday, 8 August 2003 19:13
To: Struts Users Mailing List
Subject: RE: method to get new Id to next action when old Id is in
request?


That's ridiculous.  If that were true, then just give up and go home.


--
James Mitchell
Software Engineer / Struts Evangelist
http://www.struts-atlanta.org
770-822-3359
AIM:jmitchtx




> -Original Message-
> From: ansuman_behera [mailto:[EMAIL PROTECTED]
> Sent: Friday, August 08, 2003 2:51 AM
> To: Struts Users Mailing List
> Subject: RE: method to get new Id to next action when old Id is in
> request?
>
>
> what if there is a restriction that the developers should not be
> using hidden variables? what do you do in this case?
>
> -Original Message-
> From: Rohit Aeron [mailto:[EMAIL PROTECTED]
> Sent: Friday, August 08, 2003 11:54 AM
> To: Struts Users Mailing List
> Subject: RE: method to get new Id to next action when old Id is in
> request?
>
>
> Try putting up id as a hidden variable...
>
> Eg:
>
> 
>
>
> it would work
>
> regards
> Rohit
>
> -Original Message-
> From: Adam Hardy [mailto:[EMAIL PROTECTED]
> Sent: Friday, August 08, 2003 2:56 AM
> To: Struts Users Mailing List
> Subject: method to get new Id to next action when old Id is in request?
>
> I have two actions chained together. They both take the same formbean.
> The first is sectionInsert.do and the second, which sectionInsert
> forwards to on success, is sectionEdit.do
>
> sectionInsert.do receives the properties of a Section in the request
> parameters, including id=0 where it is 0 because it does not exist in
> the DB yet. So it inserts the new Section into the DB and returns the
> new id, which is needed by sectionEdit to put into the html for the edit
> page.
>
> I originally thought I could save the new id to the formbean and this
> would get passed on, but sectionEdit instantiates its own formbean and
> fills it with the request parameters - include id=0.
>
> Is there an intuitive way of passing on the new id?
>
> I already use sectionEdit.do as a first action by calling it with an id
> on a querystring, where the formbean picks it up. I would like to use a
> method that is easy for both these situations.
>
> I'd appreciate any inspiration.
> Adam
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
> *--
> This message and any attachment(s) is intended only for the use
> of the addressee(s) and may contain information that is
> PRIVILEGED and CONFIDENTIAL. If you are not the intended
> addressee(s), you are hereby notified that any use, distribution,
> disclosure or copying of this communication is strictly
> prohibited. If you have received this communication in error,
> please erase all copies of the message and its attachment(s) and
> notify the sender or Kanbay postmaster immediately.
>
> Any views expressed in this message are those of the individual
> sender and not of Kanbay.
>
> Although we have taken steps to ensure that this e-mail and any
> attachment(s) are free from any virus, we advise that in keeping
> with good computing practice the recipient should ensure they are
> actually virus free.
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: method to get new Id to next action when old Id is in request?

2003-08-10 Thread Bailey, Shane C.

I forgot to add the line of code in the edit method that inserts into form
bean.

Also, I should have assumed that you are going to re-use the sectionEdit...

sectionEdit_execute()
{
int id = form.getId();

if(id==0)
{
try{
Integer idInt =
(Integer)request.getAttribute("my.NewId");
id =idInt.intValue();
}catch(Exception e){
//do whatEver
}
}

if(id==0){ return mapping.findForward("cantEditBadId"); }

form.setId(id);

return mapping.findForward("displayEdit");
}







-Original Message-
From: Bailey, Shane C. [mailto:[EMAIL PROTECTED] 
Sent: Thursday, August 07, 2003 5:30 PM
To: 'Struts Users Mailing List'
Subject: RE: method to get new Id to next action when old Id is in request?



I guess you could do this:

sectionInsert_execute()
{
insert into DB
int id = someHowGetTheNewId();

request.setAttribute("my.NewId", new Integer(id));
return mapping.findForward("success");
}


sectionEdit_execute()
{
int newId = 0;
try{
newId =
((Integer)request.getAttribute("my.NewId")).intValue();
}catch(Exception e){
//do whatEver
}

return mapping.findForward("displayEdit");
}


-Original Message-
From: Adam Hardy [mailto:[EMAIL PROTECTED] 
Sent: Thursday, August 07, 2003 5:26 PM
To: Struts Users Mailing List
Subject: method to get new Id to next action when old Id is in request?

I have two actions chained together. They both take the same formbean. 
The first is sectionInsert.do and the second, which sectionInsert 
forwards to on success, is sectionEdit.do

sectionInsert.do receives the properties of a Section in the request 
parameters, including id=0 where it is 0 because it does not exist in 
the DB yet. So it inserts the new Section into the DB and returns the 
new id, which is needed by sectionEdit to put into the html for the edit 
page.

I originally thought I could save the new id to the formbean and this 
would get passed on, but sectionEdit instantiates its own formbean and 
fills it with the request parameters - include id=0.

Is there an intuitive way of passing on the new id?

I already use sectionEdit.do as a first action by calling it with an id 
on a querystring, where the formbean picks it up. I would like to use a 
method that is easy for both these situations.

I'd appreciate any inspiration.
Adam


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: method to get new Id to next action when old Id is in request?

2003-08-10 Thread Ted Husted
When you forward from one action to another, Struts treats it just like 
a new request from the client. If a parameter was used to populate an 
ActionForm from one action, that same parameter will be used to populate 
every other action in the chain that uses the same ActionForm in the 
same scope.

Chaining actions together is generally frowned upon. The primary reason 
is that it indicates that the actions are becoming an API unto 
themselves. This is often a bad idea since the intelligence you are 
putting into these various action is trapped within Struts and the web 
layer and cannot be reused.

The recommended approach is to look at the underlying operations these 
actions are performing, and refactor those operations into a facade or 
set of business objects that all the actions can share. Then, instead of 
chaining actions, have a single action call whatever methods it needs on 
the facade, or instantiate and execute whatever business objects are 
needed. That way you can do whatever you need to do from any action.

The underlying idea is that each Struts action should represent a single 
use case scenario. The scenario requires certain input (the ActionForm) 
and results in certain output (the ActionForward). Interally, the Action 
class should focus on selecting the appropriate business classes, 
handing these external classes whatever input they need, and deciding 
what to next.

Chaining an action often indicates that a business operation is embedded 
in an action. Business operations should be refactored out of the 
presentation tier, and into a business layer that you can control 
without the help of the HTTP protocol.

Of course, your mileage may vary. If you must chain actions (), 
a simple solution is to add a "read-only" switch to the properties you 
want to set and share between actions. Then have the setter check the 
readonly property before changing the value.

if !(readonly) this.value = value;

Of course, this doesn't work with DynaActionForms. The next best thing 
is to add a helper bean to the context and have your actions prefer that 
to the ActionForm property. Something like

String id = fetchHelperId(request);
if (null==id) {
id = myForm.getId();
putHelperId(request,id);
}
(which could be reduced to processHelperId(request,form)).

Incidentally, the reason you have to create a new ActionForward is that 
these are shared by all the clients and all the requests. If you change 
the ActionForward instance returned by findForward, you are changing it 
for the rest of the application as well. (Hence, the freezing.)

So, if you must add parameters to an ActionForward (), a new 
instance must be created and returned by the Actions. (Which is why we 
return the ActionForward and not just the ActionForward name.)

-Ted.

Adam Hardy wrote:
I have two actions chained together. They both take the same formbean. 
The first is sectionInsert.do and the second, which sectionInsert 
forwards to on success, is sectionEdit.do

sectionInsert.do receives the properties of a Section in the request 
parameters, including id=0 where it is 0 because it does not exist in 
the DB yet. So it inserts the new Section into the DB and returns the 
new id, which is needed by sectionEdit to put into the html for the edit 
page.

I originally thought I could save the new id to the formbean and this 
would get passed on, but sectionEdit instantiates its own formbean and 
fills it with the request parameters - include id=0.

Is there an intuitive way of passing on the new id?

I already use sectionEdit.do as a first action by calling it with an id 
on a querystring, where the formbean picks it up. I would like to use a 
method that is easy for both these situations.

I'd appreciate any inspiration.
Adam
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

--
Ted Husted,
  Junit in Action  - ,
  Struts in Action - ,
  JSP Site Design  - .


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: method to get new Id to next action when old Id is in request?

2003-08-14 Thread Adam Hardy
Bah! My requirements state the app must run on an electric toaster 
without using cookies, or marmite scooby snacks.

I wired up the test environment to work with a speech screen scraper, 
and I found that I'm getting this exception:

SEVERE 2003-08-08 10:59:01 org.blacksail.BaseAction.execute(): 
java.lang.IllegalStateException: Cookies have no choc chips



Andrew Hill wrote:
hah. Thats nothing!
Wait till you try coding it without hidden variables AND standing upside
down in a hammock while playing bagpipes at the same time.
Using .net
On a 486
with no monitor
...ah Friday is that BEER I can smell?

hmmm I know
how about tacking it on as a query parameter to the forms action url...?
-Original Message-
From: James Mitchell [mailto:[EMAIL PROTECTED]
Sent: Friday, 8 August 2003 19:13
To: Struts Users Mailing List
Subject: RE: method to get new Id to next action when old Id is in
request?
That's ridiculous.  If that were true, then just give up and go home.

--
James Mitchell
Software Engineer / Struts Evangelist
http://www.struts-atlanta.org
770-822-3359
AIM:jmitchtx




-Original Message-
From: ansuman_behera [mailto:[EMAIL PROTECTED]
Sent: Friday, August 08, 2003 2:51 AM
To: Struts Users Mailing List
Subject: RE: method to get new Id to next action when old Id is in
request?
what if there is a restriction that the developers should not be
using hidden variables? what do you do in this case?
-Original Message-
From: Rohit Aeron [mailto:[EMAIL PROTECTED]
Sent: Friday, August 08, 2003 11:54 AM
To: Struts Users Mailing List
Subject: RE: method to get new Id to next action when old Id is in
request?
Try putting up id as a hidden variable...

Eg:



it would work

regards
Rohit
-Original Message-
From: Adam Hardy [mailto:[EMAIL PROTECTED]
Sent: Friday, August 08, 2003 2:56 AM
To: Struts Users Mailing List
Subject: method to get new Id to next action when old Id is in request?
I have two actions chained together. They both take the same formbean.
The first is sectionInsert.do and the second, which sectionInsert
forwards to on success, is sectionEdit.do
sectionInsert.do receives the properties of a Section in the request
parameters, including id=0 where it is 0 because it does not exist in
the DB yet. So it inserts the new Section into the DB and returns the
new id, which is needed by sectionEdit to put into the html for the edit
page.
I originally thought I could save the new id to the formbean and this
would get passed on, but sectionEdit instantiates its own formbean and
fills it with the request parameters - include id=0.
Is there an intuitive way of passing on the new id?

I already use sectionEdit.do as a first action by calling it with an id
on a querystring, where the formbean picks it up. I would like to use a
method that is easy for both these situations.
I'd appreciate any inspiration.
Adam
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


*--
This message and any attachment(s) is intended only for the use
of the addressee(s) and may contain information that is
PRIVILEGED and CONFIDENTIAL. If you are not the intended
addressee(s), you are hereby notified that any use, distribution,
disclosure or copying of this communication is strictly
prohibited. If you have received this communication in error,
please erase all copies of the message and its attachment(s) and
notify the sender or Kanbay postmaster immediately.
Any views expressed in this message are those of the individual
sender and not of Kanbay.
Although we have taken steps to ensure that this e-mail and any
attachment(s) are free from any virus, we advise that in keeping
with good computing practice the recipient should ensure they are
actually virus free.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: method to get new Id to next action when old Id is in request?

2003-08-14 Thread Adam Hardy
Thanks for the lucid explanation and sorry for making you frown :)

I had never made the connection between a use case and an action before, 
but I can see why it makes sense.

One of the reasons why I started off down that route was so that I could 
use redirects in the forwards and thus make the URL that the user sees 
reflect what they are doing.

In my example of sectionInsert.do ---> sectionEdit.do if I didn't do a 
redirect, the user would see an edit page with "sectionInsert.do" in the 
browser URL bar. In which case s/he would frown ;)

Perhaps I'm just naming my actions badly. sectionSave.do is probably a 
better name than sectionInsert.do

regards
Adam
Ted Husted wrote:
When you forward from one action to another, Struts treats it just like 
a new request from the client. If a parameter was used to populate an 
ActionForm from one action, that same parameter will be used to populate 
every other action in the chain that uses the same ActionForm in the 
same scope.

Chaining actions together is generally frowned upon. The primary reason 
is that it indicates that the actions are becoming an API unto 
themselves. This is often a bad idea since the intelligence you are 
putting into these various action is trapped within Struts and the web 
layer and cannot be reused.

The recommended approach is to look at the underlying operations these 
actions are performing, and refactor those operations into a facade or 
set of business objects that all the actions can share. Then, instead of 
chaining actions, have a single action call whatever methods it needs on 
the facade, or instantiate and execute whatever business objects are 
needed. That way you can do whatever you need to do from any action.

The underlying idea is that each Struts action should represent a single 
use case scenario. The scenario requires certain input (the ActionForm) 
and results in certain output (the ActionForward). Interally, the Action 
class should focus on selecting the appropriate business classes, 
handing these external classes whatever input they need, and deciding 
what to next.

Chaining an action often indicates that a business operation is embedded 
in an action. Business operations should be refactored out of the 
presentation tier, and into a business layer that you can control 
without the help of the HTTP protocol.

Of course, your mileage may vary. If you must chain actions (), 
a simple solution is to add a "read-only" switch to the properties you 
want to set and share between actions. Then have the setter check the 
readonly property before changing the value.

if !(readonly) this.value = value;

Of course, this doesn't work with DynaActionForms. The next best thing 
is to add a helper bean to the context and have your actions prefer that 
to the ActionForm property. Something like

String id = fetchHelperId(request);
if (null==id) {
id = myForm.getId();
putHelperId(request,id);
}
(which could be reduced to processHelperId(request,form)).

Incidentally, the reason you have to create a new ActionForward is that 
these are shared by all the clients and all the requests. If you change 
the ActionForward instance returned by findForward, you are changing it 
for the rest of the application as well. (Hence, the freezing.)

So, if you must add parameters to an ActionForward (), a new 
instance must be created and returned by the Actions. (Which is why we 
return the ActionForward and not just the ActionForward name.)

-Ted.

Adam Hardy wrote:

I have two actions chained together. They both take the same formbean. 
The first is sectionInsert.do and the second, which sectionInsert 
forwards to on success, is sectionEdit.do

sectionInsert.do receives the properties of a Section in the request 
parameters, including id=0 where it is 0 because it does not exist in 
the DB yet. So it inserts the new Section into the DB and returns the 
new id, which is needed by sectionEdit to put into the html for the 
edit page.

I originally thought I could save the new id to the formbean and this 
would get passed on, but sectionEdit instantiates its own formbean and 
fills it with the request parameters - include id=0.

Is there an intuitive way of passing on the new id?

I already use sectionEdit.do as a first action by calling it with an 
id on a querystring, where the formbean picks it up. I would like to 
use a method that is easy for both these situations.

I'd appreciate any inspiration.
Adam
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE: method to get new Id to next action when old Id is in request?

2003-08-14 Thread James Mitchell
That's ridiculous.  If that were true, then just give up and go home.


--
James Mitchell
Software Engineer / Struts Evangelist
http://www.struts-atlanta.org
770-822-3359
AIM:jmitchtx




> -Original Message-
> From: ansuman_behera [mailto:[EMAIL PROTECTED]
> Sent: Friday, August 08, 2003 2:51 AM
> To: Struts Users Mailing List
> Subject: RE: method to get new Id to next action when old Id is in
> request?
> 
> 
> what if there is a restriction that the developers should not be 
> using hidden variables? what do you do in this case?
> 
> -Original Message-
> From: Rohit Aeron [mailto:[EMAIL PROTECTED]
> Sent: Friday, August 08, 2003 11:54 AM
> To: Struts Users Mailing List
> Subject: RE: method to get new Id to next action when old Id is in
> request?
> 
> 
> Try putting up id as a hidden variable...
> 
> Eg:
> 
> 
> 
> 
> it would work 
> 
> regards
> Rohit
> 
> -Original Message-
> From: Adam Hardy [mailto:[EMAIL PROTECTED] 
> Sent: Friday, August 08, 2003 2:56 AM
> To: Struts Users Mailing List
> Subject: method to get new Id to next action when old Id is in request?
> 
> I have two actions chained together. They both take the same formbean. 
> The first is sectionInsert.do and the second, which sectionInsert 
> forwards to on success, is sectionEdit.do
> 
> sectionInsert.do receives the properties of a Section in the request 
> parameters, including id=0 where it is 0 because it does not exist in 
> the DB yet. So it inserts the new Section into the DB and returns the 
> new id, which is needed by sectionEdit to put into the html for the edit 
> page.
> 
> I originally thought I could save the new id to the formbean and this 
> would get passed on, but sectionEdit instantiates its own formbean and 
> fills it with the request parameters - include id=0.
> 
> Is there an intuitive way of passing on the new id?
> 
> I already use sectionEdit.do as a first action by calling it with an id 
> on a querystring, where the formbean picks it up. I would like to use a 
> method that is easy for both these situations.
> 
> I'd appreciate any inspiration.
> Adam
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 
> *--
> This message and any attachment(s) is intended only for the use 
> of the addressee(s) and may contain information that is 
> PRIVILEGED and CONFIDENTIAL. If you are not the intended 
> addressee(s), you are hereby notified that any use, distribution, 
> disclosure or copying of this communication is strictly 
> prohibited. If you have received this communication in error, 
> please erase all copies of the message and its attachment(s) and 
> notify the sender or Kanbay postmaster immediately.
> 
> Any views expressed in this message are those of the individual 
> sender and not of Kanbay.
> 
> Although we have taken steps to ensure that this e-mail and any 
> attachment(s) are free from any virus, we advise that in keeping 
> with good computing practice the recipient should ensure they are 
> actually virus free.
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: method to get new Id to next action when old Id is in request?

2003-08-14 Thread Rohit Aeron
Try putting up id as a hidden variable...

Eg:




it would work 

regards
Rohit

-Original Message-
From: Adam Hardy [mailto:[EMAIL PROTECTED] 
Sent: Friday, August 08, 2003 2:56 AM
To: Struts Users Mailing List
Subject: method to get new Id to next action when old Id is in request?

I have two actions chained together. They both take the same formbean. 
The first is sectionInsert.do and the second, which sectionInsert 
forwards to on success, is sectionEdit.do

sectionInsert.do receives the properties of a Section in the request 
parameters, including id=0 where it is 0 because it does not exist in 
the DB yet. So it inserts the new Section into the DB and returns the 
new id, which is needed by sectionEdit to put into the html for the edit 
page.

I originally thought I could save the new id to the formbean and this 
would get passed on, but sectionEdit instantiates its own formbean and 
fills it with the request parameters - include id=0.

Is there an intuitive way of passing on the new id?

I already use sectionEdit.do as a first action by calling it with an id 
on a querystring, where the formbean picks it up. I would like to use a 
method that is easy for both these situations.

I'd appreciate any inspiration.
Adam


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



*--
This message and any attachment(s) is intended only for the use of the addressee(s) 
and may contain information that is PRIVILEGED and CONFIDENTIAL. If you are not the 
intended addressee(s), you are hereby notified that any use, distribution, disclosure 
or copying of this communication is strictly prohibited. If you have received this 
communication in error, please erase all copies of the message and its attachment(s) 
and notify the sender or Kanbay postmaster immediately.

Any views expressed in this message are those of the individual sender and not of 
Kanbay.

Although we have taken steps to ensure that this e-mail and any attachment(s) are free 
from any virus, we advise that in keeping with good computing practice the recipient 
should ensure they are actually virus free.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: method to get new Id to next action when old Id is in request?

2003-08-14 Thread Michael Ruppin

--- Adam Hardy <[EMAIL PROTECTED]>
wrote:
> I have two actions chained together. They both take
> the same formbean. 
> The first is sectionInsert.do and the second, which
> sectionInsert 
> forwards to on success, is sectionEdit.do
> 
> sectionInsert.do receives the properties of a
> Section in the request 
> parameters, including id=0 where it is 0 because it
> does not exist in 
> the DB yet. So it inserts the new Section into the
> DB and returns the 
> new id, which is needed by sectionEdit to put into
> the html for the edit 
> page.
> 
> I originally thought I could save the new id to the
> formbean and this 
> would get passed on, but sectionEdit instantiates
> its own formbean and 
> fills it with the request parameters - include id=0.

Out of curiosity, is it really making a new one, or
just putting the request data in to the existing Form,
again?

> Is there an intuitive way of passing on the new id?
> 
> I already use sectionEdit.do as a first action by
> calling it with an id 
> on a querystring, where the formbean picks it up. I
> would like to use a 
> method that is easy for both these situations.
> 
> I'd appreciate any inspiration.

How about putting in another Form property which will
never be populated from a request?  If this property
is populated, ignore the property Struts populated
from the request.  I guess this depends on my
assumption above, but if Struts really is making a new
Form, you could still put this new property in the
request, and make sure it happens only in the Action
you chain from, and never from the HTML you render.

> Adam
> 
> 
>
-
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 


__
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]