Why you are putting it into the request yaar??
U can put it into the session..
Regards,
Shyam
Honza Spurný [EMAIL PROTECTED]
11/28/03 05:10 PM
Please respond to
Struts Users Mailing List [EMAIL PROTECTED]
To
[EMAIL PROTECTED]
cc
Subject
request.setAttribute
Hi there,
I have small
snip
request.setAttribute(myObejct, o);
...
MyObject o2 = (MyObject)request.getAttribute(o);
/snip
You arent looking up the same attribute that you stored it under. Thats why
you get null!
Try:
MyObject o2 = (MyObject)request.getAttribute(myObejct);
(btw: object is spelt object not obejct)
You are storing it in the request with the name myObejct but trying to
retrieve it with the name o. Use:
MyObject o2 = (MyObject)request.getAttribute(myObejct);
Paul
-Original Message-
From: Honza Spurn [mailto:[EMAIL PROTECTED]
Sent: 28 November 2003 11:40
To: [EMAIL PROTECTED]
Shyam Krishnan wrote:
Why you are putting it into the request yaar??
U can put it into the session..
I don't want it in session, I need this object just for a request...
Regards,
Shyam
Honza Spurný [EMAIL PROTECTED]
11/28/03 05:10 PM
Please respond to
Struts Users Mailing List
The correct sentence for that is:
MyObject o2 = (MyObject)request.getAttribute(myObejct);
Not MyObject o2 = (MyObject)request.getAttribute(o);
You must get the name of the Attribute and the method returns the instance
T-Systems ITC Services España, S.A.
Félix López
Depto. Sanidad
Telf. 932 535
Andrew Hill wrote:
snip
request.setAttribute(myObejct, o);
...
MyObject o2 = (MyObject)request.getAttribute(o);
/snip
You arent looking up the same attribute that you stored it under.
Thats why you get null!
Try:
MyObject o2 = (MyObject)request.getAttribute(myObejct);
(btw: object is
Hi Sporak,
The name which you have given your object is myObejct so when you try to retrieve
this object off of the request, you need to do:
MyObject o2 = (MyObject)request.getAttribute(myObejct);
and not:
MyObject o2 = (MyObject)request.getAttribute(o);
Doing it this way (the way you have
Corrected version:
MyObject o = new MyObject();
o.setObjectName(name);
request.setAttribute(myObejct, o);
MyObject o2 = (MyObject)request.getAttribute(myObject);
if (o2 == null) System.out.println(NULL);
else System.out.println(o.getObjectName());
The problem still occures. I'm not able to
It still isn't correct. You staore it as myObejct and try and retrieve it
as myObject
Paul
-Original Message-
From: Honza Spurn [mailto:[EMAIL PROTECTED]
Sent: 28 November 2003 11:51
To: Struts Users Mailing List; Honza Spurn
Subject: Re: request.setAttribute
Corrected version
]
Sent: 28 November 2003 11:51
To: Struts Users Mailing List; Honza Spurn
Subject: Re: request.setAttribute
Corrected version:
MyObject o = new MyObject();
o.setObjectName(name);
request.setAttribute(myObejct, o);
MyObject o2 = (MyObject)request.getAttribute(myObject);
if (o2 == null
]
Sent: 28 November 2003 11:59
To: Struts Users Mailing List
Subject: Re: request.setAttribute
Paul McCulloch wrote:
It still isn't correct. You staore it as myObejct and try and
retrieve it
as myObject
OK OK, that is only overwrite, sorry... but this is not
copied from code
To: Struts Users Mailing List
Subject: Re: request.setAttribute
Paul McCulloch wrote:
It still isn't correct. You staore it as myObejct and try and
retrieve it
as myObject
OK OK, that is only overwrite, sorry... but this is not
copied from code,
this is written to make easy view
Please send some real code. I think you may have over simplfified what you
are showing us.
Paul
-Original Message-
From: Honza Spurn [mailto:[EMAIL PROTECTED]
Sent: 28 November 2003 12:09
To: Struts Users Mailing List
Subject: Re: request.setAttribute
Paul McCulloch wrote
is in the Server class, since it has about 125
attributes (each attribute has setter and getter method), so this object is
realy huge...
-Original Message-
From: Honza Spurn [mailto:[EMAIL PROTECTED]
Sent: 28 November 2003 12:09
To: Struts Users Mailing List
Subject: Re: request.setAttribute
-
From: Honza Spurn [mailto:[EMAIL PROTECTED]
Sent: 28 November 2003 12:22
To: Struts Users Mailing List
Subject: Re: request.setAttribute
Paul McCulloch wrote:
Please send some real code. I think you may have over simplfified
what you are showing us.
Paul
No no, this is realy all
Mailing List
Subject: Re: request.setAttribute
Paul McCulloch wrote:
Please send some real code. I think you may have over simplfified
what you are showing us.
Paul
No no, this is realy all :)
look:
public final class CreateServerAction extends Action
{
public ActionForward execute
is going to work. Try using different
classes instead of Server - I'd start with String.
Paul
-Original Message-
From: Honza Spurn [mailto:[EMAIL PROTECTED]
Sent: 28 November 2003 12:33
To: Struts Users Mailing List
Subject: Re: request.setAttribute
Paul McCulloch wrote:
The request
, 2003 10:38 AM
Subject: RE: request.setAttribute
I'd concentrate on the bit of code in your action:
request.setAttribute(serverBean, new Server());
Server s = (Server)request.getAttribute(serverBean);
if (s == null) System.out.println(s.getWmId());
else System.out.println
AM
Subject: RE: request.setAttribute
I'd concentrate on the bit of code in your action:
request.setAttribute(serverBean, new Server());
Server s = (Server)request.getAttribute(serverBean);
if (s == null) System.out.println(s.getWmId());
else System.out.println(null
Have you read other posts
You are storing and retrieving by different names.
/Ashwani
-Original Message-
From: Honza Spurný [mailto:[EMAIL PROTECTED]
Sent: Friday, November 28, 2003 5:15 PM
To: Struts Users Mailing List
Subject: Re: request.setAttribute
Shyam Krishnan wrote:
Why you
Martin Cooper wrote:
-Original Message-
From: Eddie Bush [mailto:ekbush;swbell.net]
Sent: Monday, November 11, 2002 2:46 PM
To: Struts Users Mailing List
Subject: Re: [SIDEBAR] Form population (Was RE: request.setAttribute()
form confusion)
Sri, pardon me, but I don't see how what
[mailto:martin.cooper;tumbleweed.com]
Sent: Monday, November 11, 2002 9:40 PM
To: 'Struts Users Mailing List'
Subject: RE: [SIDEBAR] Form population (Was RE: request.setAttribute() for m confusion)
I think you missed the point here, Eddie (or perhaps I missed that you didn't miss the point
??
Are you telling me that I missed something fundamental to Struts?...'tis quite likely.
Sri
-Original Message-
From: Eddie Bush [mailto:ekbush;swbell.net]
Sent: Tuesday, November 12, 2002 11:34 AM
To: Struts Users Mailing List
Subject: Re: [SIDEBAR] Form population (Was RE: request.setAttribute
-Original Message-
From: Sri Sankaran [mailto:Sri.Sankaran;sas.com]
Sent: Tuesday, November 12, 2002 7:56 AM
To: Struts Users Mailing List
Subject: RE: [SIDEBAR] Form population (Was RE: request.setAttribute()
for m confusion)
No sweat.
The reason this discussion got so
]
Sent: Tuesday, November 12, 2002 10:56 AM
To: 'Struts Users Mailing List'
Subject: RE: [SIDEBAR] Form population (Was RE: request.setAttribute()
for m confusion)
No sweat.
The reason this discussion got so off whack was because I tried to slam
a square peg in a round hole by continuing
Martin Cooper wrote:
Huh? What's not terribly important? If I don't have the form bean (which
Struts has not yet created for me), how am I going to populate it with the
values I want displayed in the form?
It's irrelevant whether or not the form is created if you haven't drawn
the association
Sri Sankaran wrote:
No sweat.
The reason this discussion got so off whack was because I tried to slam a square peg in a round hole by continuing with Kris' example (Edit Save actions) to make my point -- bad idea.
So what *is* my scenario?
Consider for example, a master-detail pair of
: request.setAttribute()
for m confusion)
-Original Message-
From: Sri Sankaran [mailto:Sri.Sankaran;sas.com]
Sent: Tuesday, November 12, 2002 7:56 AM
To: Struts Users Mailing List
Subject: RE: [SIDEBAR] Form population (Was RE: request.setAttribute()
for m confusion
Intermixed response...
-Original Message-
From: Eddie Bush [mailto:ekbush;swbell.net]
Sent: Tuesday, November 12, 2002 2:34 PM
To: Struts Users Mailing List
Subject: Re: [SIDEBAR] Form population (Was RE:
request.setAttribute() for m confusion)
Sri Sankaran wrote:
No sweat
Intermixed response...
-Original Message-
From: Craig R. McClanahan [mailto:craigmcc;apache.org]
Sent: Tuesday, November 12, 2002 1:54 PM
To: Struts Users Mailing List
Subject: RE: [SIDEBAR] Form population (Was RE:
request.setAttribute() for m confusion)
See intermixed
(waaay down there ...)
Sri Sankaran wrote:
Intermixed response...
-Original Message-
From: Eddie Bush [mailto:ekbush;swbell.net]
Subject: Re: [SIDEBAR] Form population (Was RE:
request.setAttribute() for m confusion)
Sri Sankaran wrote:
No sweat.
The reason
Comments in here somewhere...
-Original Message-
From: Eddie Bush [mailto:ekbush;swbell.net]
Sent: Tuesday, November 12, 2002 12:22 PM
To: Struts Users Mailing List
Subject: Re: [SIDEBAR] Form population (Was RE: request.setAttribute()
for m confusion)
(waaay down
Martin Cooper wrote:
Ahhh! The murky waters finally clear, and I understand where all the
confusion is coming from. Sri and I are talking about one Action handling
the request.
Yes - but I've said before that if you had multiple forms involved you
would have to make yourself responsible
mega-snip/
... you've got two of these back-to-back:
MstrLdActn - MstrJsp - MstrSbmtActn - - DtlLdActn - DtlJsp -
DtlSbmtActn
a redirect passing mastid=54 ^
Ah! Action chaining -- I realize that is an option.
Just don't let Craig see you doing this... ;)
snip/
Nevermind, answering my own question ...
actions in the Struts examples don't use the second line of code, so the
answer is no, you don't need the two together.
Susan
On 11/11/2002 01:34:16 PM Susan Bradeen wrote:
If I have this code, which appears to be good practice, in the beginning
of
You shouldn't ever have to create the form yourself if you:
- declare the form-bean in your config file
- use the name of the form you declared in the action mapping's name
attribute
form-bean name=myForm ... /
...
action path=/somePath name=myForm ... /
That should suffice. What you should
Susan,
Here's a response to a different thread with the same type of code block:
http://marc.theaimsgroup.com/?l=struts-userm=103669042429912w=2
I understand this type of approach is used in the example app, but I'd say it's
anything but good practice. In general, if you have an action that's
corresponding to page-2 and save the form-bean under
this name in the appropriate scope.
Is there a way around this issue?
Sri
-Original Message-
From: Eddie Bush [mailto:ekbush;swbell.net]
Sent: Monday, November 11, 2002 3:00 PM
To: Struts Users Mailing List
Subject: Re: request.setAttribute
population (Was RE: request.setAttribute() form
confusion)
While that is true, other than in the case of blank forms, isn't it true
that one rarely depends on Struts to auto-generate the form bean? If
you are presenting data, the form is pre-populated with such data. This
data is typically
Thank you for the help Eddie and Kris. I've already got my action mapping
set up just as you say to have them, so I'll go back to trusting Struts
with the form creation.
Susan
On 11/11/2002 02:00:55 PM Kris Schneider wrote:
Susan,
Here's a response to a different thread with the same type
-Original Message-
From: edgar [mailto:edgar;blue-moose.net]
Sent: Monday, November 11, 2002 3:04 PM
To: 'Struts Users Mailing List'
Subject: RE: [SIDEBAR] Form population (Was RE: request.setAttribute() form confusion)
Doesn't doing things the way you are suggesting spread the business logic
] Form population (Was RE: request.setAttribute() form
confusion)
While that is true, other than in the case of blank forms, isn't it true
that one rarely depends on Struts to auto-generate the form bean? If
you are presenting data, the form is pre-populated with such data. This
data
, 2002 4:17 PM
To: Struts Users Mailing List; [EMAIL PROTECTED]
Subject: RE: [SIDEBAR] Form population (Was RE: request.setAttribute() form confusion)
...one rarely depends on Struts to auto-generate the form bean? If you
changed rarely to almost always, I'd tend to agree with you ;-). I make
the form-bean under this name in the appropriate scope.
Is there a way around this issue?
Sri
-Original Message-
From: Eddie Bush [mailto:ekbush;swbell.net]
Sent: Monday, November 11, 2002 3:00 PM
To: Struts Users Mailing List
Subject: Re: request.setAttribute() form confusion
You shouldn't
, November 11, 2002 3:12 PM
To: 'Struts Users Mailing List'; Edgar Dollin
Subject: RE: [SIDEBAR] Form population (Was RE: request.setAttribute()
form confusion)
Actually, the way I have tried to describe keeps business logic
*entirely* out of the form-beans and uses them only as the medium of
transporting
... why are you changing forms? Do you forward to the JSP or redirect?
Unless you do something special in EditAction the form you are dealing
with in JSP is form-A --- not form-B. That is irrelevant though - as
the user will submit form-A and form-B will be created (if needed -
assuming
My apologies - you were going after edgar - and rightfully so :-)
edgar: Listen to Sri the wise ;-)
Eddie Bush wrote:
Sri, pardon me, but I don't see how what you've said has anything to
do with the point I was making. My sole point is that the actual
creation (instantiation) of the form
OK Eddie, what do you use to model the business logic?
-Original Message-
From: Eddie Bush [mailto:ekbush;swbell.net]
Sent: Monday, November 11, 2002 6:16 PM
To: 'Struts Users Mailing List'
Subject: Re: [SIDEBAR] Form population (Was RE: request.setAttribute()
form confusion)
My
...
-Original Message-
From: Eddie Bush [mailto:ekbush;swbell.net]
Sent: Monday, November 11, 2002 6:16 PM
To: 'Struts Users Mailing List'
Subject: Re: [SIDEBAR] Form population (Was RE: request.setAttribute()
form confusion)
My apologies - you were going after edgar - and rightfully so
population (Was RE: request.setAttribute()
formconfusion)
edgar wrote:
OK Eddie, what do you use to model the business logic?
Classes which aren't dependant on Struts ;-)
Seriously. Most everyone is going to tell you to build things in layers
- aiming for low cohesion between them. Data
do appreciate your comments.
Thanks
-Original Message-
From: Eddie Bush [mailto:ekbush;swbell.net]
Sent: Monday, November 11, 2002 7:01 PM
To: 'Struts Users Mailing List'
Subject: Re: [SIDEBAR] Form population (Was RE: request.setAttribute()
form confusion)
edgar wrote:
OK Eddie, what
-Original Message-
From: Eddie Bush [mailto:ekbush;swbell.net]
Sent: Monday, November 11, 2002 2:46 PM
To: Struts Users Mailing List
Subject: Re: [SIDEBAR] Form population (Was RE: request.setAttribute()
form confusion)
Sri, pardon me, but I don't see how what you've said has
: Martin Cooper [mailto:martin.cooper;tumbleweed.com]
Sent: Monday, November 11, 2002 9:40 PM
To: 'Struts Users Mailing List'
Subject: RE: [SIDEBAR] Form population (Was RE: request.setAttribute() for m confusion)
-Original Message-
From: Eddie Bush [mailto:ekbush;swbell.net]
Sent: Monday
Check if in the forwards of your action you do not write a thing like this
forward path=*** redirect=true/
Mohammed [EMAIL PROTECTED] wrote:
Hello,
in my action class I am setting in my request an object as follow:
SourceBean sourcebean= new SourceBean();
sourcebean.setSource(
23, 2001 3:24 PM
Subject: Re: Request.setAttribute() and jsp
Check if in the forwards of your action you do not write a thing like this
forward path=*** redirect=true/
Mohammed [EMAIL PROTECTED] wrote:
Hello,
in my action class I am setting in my request an object as follow
Thanks kevin . now it is working
Mohammed
- Original Message -
From: Viet Kevin [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Friday, November 23, 2001 3:24 PM
Subject: Re: Request.setAttribute() and jsp
Check if in the forwards of your action you do
Sounds like a logic problem, are you sure that the logic in the action class
isn't branching around the part where it adds the questions? Maybe if you
send your code...
-Original Message-
From: Christophe Rikelynck [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, September 25, 2001 6:19 AM
To:
57 matches
Mail list logo