Changing Request Parameters

2002-02-22 Thread Phase Communcations

I am forwarding from one Action to Another. I need to tweak the request
parameters. Is there a way to do this?

I tried to set the reqest value by calling the FormBean and set it from the
action. But, it doesn't carry over to the next Action. I can't find a way to
change the request parameters. Please help.

I saw some discussion on the archive. But, is pretty aimless and not very
clear.

I am running Servlet 2.2 so don't tell me about getParameterMap().

Brandon Goodin
Phase Web and Multimedia
P (406) 862-2245
F (406) 862-0354
[EMAIL PROTECTED]
http://www.phase.ws



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




NEVERMIND: Changing Request Parameters

2002-02-22 Thread Phase Communcations

A little more research and I find that it is not possible and that I need to
rebuild the and redirect. Cheezy.

-Original Message-
From: Phase Communcations [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 22, 2002 5:08 AM
To: Struts Users Mailing List
Subject: Changing Request Parameters


I am forwarding from one Action to Another. I need to tweak the request
parameters. Is there a way to do this?

I tried to set the reqest value by calling the FormBean and set it from the
action. But, it doesn't carry over to the next Action. I can't find a way to
change the request parameters. Please help.

I saw some discussion on the archive. But, is pretty aimless and not very
clear.

I am running Servlet 2.2 so don't tell me about getParameterMap().

Brandon Goodin
Phase Web and Multimedia
P (406) 862-2245
F (406) 862-0354
[EMAIL PROTECTED]
http://www.phase.ws



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



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




Re: NEVERMIND: Changing Request Parameters

2002-02-22 Thread Jin Bal

Equally cheesy would be  to set request attributes and get the receiving
action to check the attributes before checking the req params.  It's dirty I
know, but it may be slightly preferable to constructing query strings on the
server and creating a new request...

Just a thought.

HTH
Jin
- Original Message -
From: Phase Communcations [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Friday, February 22, 2002 12:16 PM
Subject: NEVERMIND: Changing Request Parameters


 A little more research and I find that it is not possible and that I need
to
 rebuild the and redirect. Cheezy.

 -Original Message-
 From: Phase Communcations [mailto:[EMAIL PROTECTED]]
 Sent: Friday, February 22, 2002 5:08 AM
 To: Struts Users Mailing List
 Subject: Changing Request Parameters


 I am forwarding from one Action to Another. I need to tweak the request
 parameters. Is there a way to do this?

 I tried to set the reqest value by calling the FormBean and set it from
the
 action. But, it doesn't carry over to the next Action. I can't find a way
to
 change the request parameters. Please help.

 I saw some discussion on the archive. But, is pretty aimless and not very
 clear.

 I am running Servlet 2.2 so don't tell me about getParameterMap().

 Brandon Goodin
 Phase Web and Multimedia
 P (406) 862-2245
 F (406) 862-0354
 [EMAIL PROTECTED]
 http://www.phase.ws



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



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



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




Re: NEVERMIND: Changing Request Parameters

2002-02-22 Thread Ted Husted

Phase Communcations wrote:
 I tried to set the reqest value by calling the FormBean and set it from the
 action. But, it doesn't carry over to the next Action. I can't find a way to
 change the request parameters. Please help.

The trick is to put a switch on your form bean to make it immutable.
This way the controller can't mess with it between actions. 


private boolean mutable = true;
public void setMutable(boolean mutable) {
this.mutable = mutable;
}
public boolean isMutable() {
return this.mutable;
}

public String whatever = null;
public void setWhatever(String whatever) {
if (isMutable()) this.whatever = whatever;
}
public String getWhatever() {
return this.whatever;
}

Then be sure that reset uses the setters (and doesn't clear mutable).


-- Ted Husted, Husted dot Com, Fairport NY US
-- Developing Java Web Applications with Struts
-- Tel: +1 585 737-3463
-- Web: http://husted.com/about/services

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




Re: Changing Request Parameters

2002-02-22 Thread Michael Baldwin

Since you're forwarding from Action to Action, you do have a minor issue.  Things
you set in the request will be reset after the forward.

Solution 1: add what you need to the session.
Solution 2: extend ActionForward with a subclass that takes a map of name value
pairs to stick in the request.  Override the getPath() method to return the path
for the forward, plus the query string to follow it.  (e.g. String getPath() {
returns something like /myAction.do?mapParam1=val1mapParam2=val2 )

You'll probably want to create this ActionForward yourself (MyActionForward f =
new MyActionForward(path, paramMap) );  You just need to be careful that the
ActionForward doesn't get reused (for obvious reasons).  I believe that the
ActionForwards in struts are static so if you use mapping.findForward(foo), and
then add params to that, I think other actions might see them.  I'm not sure.

You could probably write your action forward to take an action forward in its
constructor such that you can reuse the static one in your dynamic one (if it is
static indeed).  i.e., MyActionForward f = new MyActionForward
(mapping.findForward(foo), Map paramMap)


cheers,
--Michael


Phase Communcations wrote:

 I am forwarding from one Action to Another. I need to tweak the request
 parameters. Is there a way to do this?

 I tried to set the reqest value by calling the FormBean and set it from the
 action. But, it doesn't carry over to the next Action. I can't find a way to
 change the request parameters. Please help.

 I saw some discussion on the archive. But, is pretty aimless and not very
 clear.

 I am running Servlet 2.2 so don't tell me about getParameterMap().

 Brandon Goodin
 Phase Web and Multimedia
 P (406) 862-2245
 F (406) 862-0354
 [EMAIL PROTECTED]
 http://www.phase.ws

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


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