Hi there,
I have small problem with adding some objects to the request. I need to
store quite huge object into request variable
MyObject o = new MyObject();
o.setObjectName(name);
request.setAttribute(myObejct, o);
These are correct steps how to make it, aren't they? But the object MyObject
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
]
Subject: request.setAttribute
Hi there,
I have small problem with adding some objects to the request.
I need to
store quite huge object into request variable
MyObject o = new MyObject();
o.setObjectName(name);
request.setAttribute(myObejct, o);
These are correct steps how to make
[EMAIL PROTECTED]
To
[EMAIL PROTECTED]
cc
Subject
request.setAttribute
Hi there,
I have small problem with adding some objects to the request. I need
to store quite huge object into request variable
MyObject o = new MyObject();
o.setObjectName(name);
request.setAttribute(myObejct, o
100 Ext. 4325
[EMAIL PROTECTED]
-Mensaje original-
De: Honza Spurný [mailto:[EMAIL PROTECTED]
Enviado el: viernes, 28 de noviembre de 2003 12:40
Para: [EMAIL PROTECTED]
Asunto: request.setAttribute
Hi there,
I have small problem with adding some objects to the request. I need to
store
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
PROTECTED]
Sent: 28 November 2003 11:40
To: [EMAIL PROTECTED]
Subject: request.setAttribute
Hi there,
I have small problem with adding some objects to the request. I need to
store quite huge object into request variable
MyObject o = new MyObject();
o.setObjectName(name);
request.setAttribute
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
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
MyObject();
o.setObjectName(name);
request.setAttribute(myObject, o);
MyObject o2 = (MyObject)request.getAttribute(myObject);
if (o2 == null) System.out.println(NULL);
else System.out.println(o.getObjectName());
Paul
-Original Message-
From: Honza Spurn [mailto:[EMAIL PROTECTED
]
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
,
HttpServletRequest request, HttpServletResponse response)
{
request.setAttribute(serverBean, new Server());
return(mapping.findForward(success));
}
}
in apropriate jsp page is used:
jsp:useBean id=serverBean class=cz.master.is.tech.server.Server
scope=request /
but by my opinion the problem
-
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
/editServer.jsp /
/action
the CreateServerAction i've attached last message.
the editServer.jsp uses:
jsp:useBean id=serverBean class=cz.master.is.tech.server.Server
scope=request /
Very strange is, that when I try to do in the Action-class this:
request.setAttribute(serverBean, new Server
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);
If this returns null then nothing else
, 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/
If I have this code, which appears to be good practice, in the beginning
of my pre-action's execute() method:
if (form == null) {
form = new SomeForm();
if (request.equals(mapping.getScope())) {
request.setAttribute(mapping.getAttribute(), form);
}
else
of my pre-action's execute() method:
if (form == null) {
form = new SomeForm();
if (request.equals(mapping.getScope())) {
request.setAttribute(mapping.getAttribute(), form);
}
else {
request.getSession().setAttribute(mapping.getAttribute(), form);
}
}
SomeForm myForm = (SomeForm)form
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
())) {
request.setAttribute(mapping.getAttribute(), form);
}
else {
request.getSession().setAttribute(mapping.getAttribute(), form);
}
}
SomeForm myForm = (SomeForm)form;
/* populate form values ... */
Do I also need to use the following line at the end
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
Bradeen [EMAIL PROTECTED]:
If I have this code, which appears to be good practice, in the
beginning
of my pre-action's execute() method:
if (form == null) {
form = new SomeForm();
if (request.equals(mapping.getScope())) {
request.setAttribute(mapping.getAttribute
-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
));
request.setAttribute(projects, proj);
return (mapping.findForward(success));
---
In my JSP if I try this :
%@ page language=java %
%@ taglib uri=/WEB-INF/tld/app.tld prefix=app %
%@ taglib uri=/WEB-INF/tld/struts
to put a ArrayList from my Action in the request.
---
By doing for example in my Action Class :
ArrayList proj = new ArrayList();
proj.add(new LabelValueBean(name, id));
request.setAttribute(projects, proj
: Friday, May 24, 2002 6:34 PM
Subject: RE: Pb : request.SetAttribute() from Action
First, don't type proj as an ArrayList; it should be a List.
Second, if what is happening is as you say, proj == null. Check what you
are putting into it.
Mark
-Original Message-
From: Damien VIEL
Subject: RE: Pb : request.SetAttribute() from Action
First, don't type proj as an ArrayList; it should be a List.
Second, if what is happening is as you say, proj == null. Check what you
are putting into it.
Mark
-Original Message-
From: Damien VIEL [mailto:[EMAIL PROTECTED]]
Sent
To: Struts Users Mailing List
Subject: Re: Pb : request.SetAttribute() from Action
Hi,
With the List I have the following error:
java.lang.NullPointerException at action.MyAction.perform(MyAction.java:50)
Thanks
Dams
- Original Message -
From: Galbreath, Mark [EMAIL PROTECTED]
To: 'Struts
of situations.
Steve
From: Damien VIEL [EMAIL PROTECTED]
Reply-To: Struts Users Mailing List [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Subject: Pb : request.SetAttribute() from Action
Date: Fri, 24 May 2002 18:24:33 +0200
Hi,
I've many problem to put a ArrayList from my Action
: Rajesh Kalluri [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Friday, May 24, 2002 7:17 PM
Subject: RE: Pb : request.SetAttribute() from Action
Damien,
Did you import the struts tags, if not the tags cannot be interpreted and
you will have the message from Error from
Hi,
I really think that my pb comes from the fact that
i'm doing request.setAttribute(myarray, arraylist) in the Action class.
In the JSP, I still have the notPresent body message from the Logic TagLib.
I've no idea where is the mistake
Thanks
Dams
- Original Message -
From
=java.util.ArrayList
bean:write name=proj property=label/
br
/logic:iterate
Raj
-Original Message-
From: Damien VIEL [mailto:[EMAIL PROTECTED]]
Sent: Friday, May 24, 2002 3:58 PM
To: Struts Users Mailing List
Subject: Re: Pb : request.SetAttribute() from Action
Yes I did,
following my JSP
);
request.setAttribute(source ,sourcebean);
And in my jsp file try to get a refererence
% SourceBean sourcebean = (SourceBean)request.getAttribute(source);
if(sourcebean = = null)System.out.println( the source bean object is
null);
else(
System.out.println( sourcebean.getSource
Hello,
in my action class I am setting in my request an object as follow:
SourceBean sourcebean= new SourceBean();
sourcebean.setSource( Longon);
request.setAttribute(source ,sourcebean);
And in my jsp file try to get a refererence
% SourceBean sourcebean = (SourceBean)request.getAttribute
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
I have an action class BeforeSelectQuestionAction.java where I get all questions
from the database and put them to the request with request.setAttribute(questions,
questions).
When i surf to BeforeSelectQuestion.do there is no problem and in the jsp page that
follows I see all questions
To: struts-user
Subject: request.setAttribute(variable, value) bug
I have an action class BeforeSelectQuestionAction.java where I get all
questions from the database and put them to the request with
request.setAttribute(questions, questions).
When i surf to BeforeSelectQuestion.do there is no problem
Should I be able to retrieve a string that has been set by
request.setAttribute from within a bean:message/?
For example, in an Action I have:
request.setAttribute(registeredemail,email);
return mapping.findForward(waitforconfirm);
in the jsp that the waitforconfirm points to, this works
71 matches
Mail list logo