RE: scope question

2004-03-17 Thread Shahak.Nagiel
bean:write name=foo property=bar scope=application/

Application scope, aka global, aka servlet context

-Original Message-
From: Rajat Pandit [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 17, 2004 5:14 AM
To: Struts Users Mailing List
Subject: scope question


Hello,
I know this could be a dumb question, but how do access the objects
stored in the ServletContext object using bean:write
a quick answer would help!!


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



RE: Scope Issues Between Struts Tags and JSTL

2003-07-18 Thread Chen, Gin
Remember that JSTL and struts are not the same.
Therefore, JSTL tags cant auto pick up the current element that a Struts tag
is looking at.
You should have: 

nested:iterate id=foo property=lineItems
!--
FS: c:out value=${foo.fulfillmentStatus}/
SO: c:out value=${foo.sampleOrigin}/
--
c:if test=${foo.fulfillmentStatus == 'In Process'  foo.sampleOrigin ==
'special_order'}
... THIS IS NEVER DISPLAYED SINCE JSTL TAGS CAN'T FIND VARS ...
/c:if
/nested:iterate   

PS: (Not sure how you even get it to show up without the id attribute?)

-Tim

-Original Message-
From: Hunter Hillegas [mailto:[EMAIL PROTECTED]
Sent: Friday, July 18, 2003 1:20 PM
To: Struts List
Subject: Scope Issues Between Struts Tags and JSTL


I am trying to use both Struts tags and JSTL in a page.

I have the following:



Now, my JSTL tags can't find these variables in any scope. How should I
properly address the data?

Thanks,
Hunter


-
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: Scope Issues Between Struts Tags and JSTL

2003-07-18 Thread Hunter Hillegas
Thanks. This did the trick. Just didn't see this documented anywhere.

 From: Chen, Gin [EMAIL PROTECTED]
 Reply-To: Struts Users Mailing List [EMAIL PROTECTED]
 Date: Fri, 18 Jul 2003 13:41:26 -0400
 To: 'Struts Users Mailing List' [EMAIL PROTECTED]
 Subject: RE: Scope Issues Between Struts Tags and JSTL
 
 Remember that JSTL and struts are not the same.
 Therefore, JSTL tags cant auto pick up the current element that a Struts tag
 is looking at.
 You should have: 
 
 nested:iterate id=foo property=lineItems
 !--
 FS: c:out value=${foo.fulfillmentStatus}/
 SO: c:out value=${foo.sampleOrigin}/
 --
 c:if test=${foo.fulfillmentStatus == 'In Process'  foo.sampleOrigin ==
 'special_order'}
 ... THIS IS NEVER DISPLAYED SINCE JSTL TAGS CAN'T FIND VARS ...
 /c:if
 /nested:iterate
 
 PS: (Not sure how you even get it to show up without the id attribute?)
 
 -Tim
 
 -Original Message-
 From: Hunter Hillegas [mailto:[EMAIL PROTECTED]
 Sent: Friday, July 18, 2003 1:20 PM
 To: Struts List
 Subject: Scope Issues Between Struts Tags and JSTL
 
 
 I am trying to use both Struts tags and JSTL in a page.
 
 I have the following:
 
 
 
 Now, my JSTL tags can't find these variables in any scope. How should I
 properly address the data?
 
 Thanks,
 Hunter
 
 
 -
 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: Scope related Vector iteration problem

2003-06-11 Thread Gemes Tibor
James Watkins rta:

My problem comes when I try to submit the form.  I get the following
exception when the bean gets populated:
java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 4
at java.util.Vector.get(Vector.java:699)
The index is that of the first project with a checked box.  I don't get this
problem if I put the bean in session scope, but I'd rather not do that if I
can avoid it.
 

The struts framework only calls the setters, but the setters requires 
the object to be present on which they are called.
If the subbeans arent created at construction time, they will be null, 
so NPE is thrown runtime.

You have 2 alternatives: store in session or construct all subbeans with 
the form.

Hth,

Tib



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


RE: Scope related Vector iteration problem

2003-06-11 Thread James Watkins
OK, that makes sense.  I suppose that since the form has no way of knowing
what the contents of the Vector should be, I'll have to use session scope.
If the list becomes quite large, would it be wise to remove the list from
the session at the earliest opportunity to free up memory?

 -Original Message-
 From: Gemes Tibor [mailto:[EMAIL PROTECTED]
 Sent: 11 June 2003 13:31
 To: Struts Users Mailing List
 Subject: Re: Scope related Vector iteration problem
 
 
 James Watkins rta:
 
 My problem comes when I try to submit the form.  I get the following
 exception when the bean gets populated:
 
 java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 4
  at java.util.Vector.get(Vector.java:699)
 
 The index is that of the first project with a checked box.  
 I don't get this
 problem if I put the bean in session scope, but I'd rather 
 not do that if I
 can avoid it.
   
 
 The struts framework only calls the setters, but the setters requires 
 the object to be present on which they are called.
 If the subbeans arent created at construction time, they will 
 be null, 
 so NPE is thrown runtime.
 
 You have 2 alternatives: store in session or construct all 
 subbeans with 
 the form.
 
 Hth,
 
 Tib
 
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 

DISCLAIMER: This message contains confidential information and is intended
for To: and Cc: (name). If you are not the intended recipient you are
notified that disclosing, copying, distributing or taking any action in
reliance on the contents of this information is strictly prohibited. E-mail
transmission cannot be guaranteed to be secure or error-free as information
could be intercepted, corrupted, lost, destroyed, arrive late or incomplete,
or contain viruses. The sender therefore does not accept liability for any
errors or omissions in the contents of this message, which arise as a result
of e-mail transmission. The content of this e-mail does not necessarily
represent the company, its policies, or views, or those of its subsidiaries.
If verification is required please request a hard-copy version.
Please note that M2 Limited monitors incoming and outgoing mail for
compliance with its email policy. This includes scanning incoming emails to
detect Viruses. 



Re: Scope related Vector iteration problem

2003-06-11 Thread Gemes Tibor
James Watkins rta:

OK, that makes sense.  I suppose that since the form has no way of knowing
what the contents of the Vector should be, I'll have to use session scope.
If the list becomes quite large, would it be wise to remove the list from
the session at the earliest opportunity to free up memory?
 

That's the way I'm usually following

Tib



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


RE: Scope related Vector iteration problem

2003-06-11 Thread James Watkins
Thanks Tib, you've been very helpful (and quick too!).

Cheers,
James.

 -Original Message-
 From: Gemes Tibor [mailto:[EMAIL PROTECTED]
 Sent: 11 June 2003 14:53
 To: Struts Users Mailing List
 Subject: Re: Scope related Vector iteration problem
 
 
 James Watkins rta:
 
 OK, that makes sense.  I suppose that since the form has no 
 way of knowing
 what the contents of the Vector should be, I'll have to use 
 session scope.
 If the list becomes quite large, would it be wise to remove 
 the list from
 the session at the earliest opportunity to free up memory?
   
 
 That's the way I'm usually following
 
 Tib
 
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 

DISCLAIMER: This message contains confidential information and is intended
for To: and Cc: (name). If you are not the intended recipient you are
notified that disclosing, copying, distributing or taking any action in
reliance on the contents of this information is strictly prohibited. E-mail
transmission cannot be guaranteed to be secure or error-free as information
could be intercepted, corrupted, lost, destroyed, arrive late or incomplete,
or contain viruses. The sender therefore does not accept liability for any
errors or omissions in the contents of this message, which arise as a result
of e-mail transmission. The content of this e-mail does not necessarily
represent the company, its policies, or views, or those of its subsidiaries.
If verification is required please request a hard-copy version.
Please note that M2 Limited monitors incoming and outgoing mail for
compliance with its email policy. This includes scanning incoming emails to
detect Viruses. 



RE: Scope related Vector iteration problem

2003-06-11 Thread Sashi Ravipati
I have a similar problem, Is the form bean session scope u r talking abt
or something else. I tried to set the scope=session in
Struts-config.xml, it that right (Please bear with me as I am newbie)

thanks

 [EMAIL PROTECTED] 06/11/03 10:00AM 
Thanks Tib, you've been very helpful (and quick too!).

Cheers,
James.

 -Original Message-
 From: Gemes Tibor [mailto:[EMAIL PROTECTED]
 Sent: 11 June 2003 14:53
 To: Struts Users Mailing List
 Subject: Re: Scope related Vector iteration problem
 
 
 James Watkins írta:
 
 OK, that makes sense.  I suppose that since the form has no 
 way of knowing
 what the contents of the Vector should be, I'll have to use 
 session scope.
 If the list becomes quite large, would it be wise to remove 
 the list from
 the session at the earliest opportunity to free up memory?
   
 
 That's the way I'm usually following
 
 Tib
 
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 

DISCLAIMER: This message contains confidential information and is
intended
for To: and Cc: (name). If you are not the intended recipient you are
notified that disclosing, copying, distributing or taking any action in
reliance on the contents of this information is strictly prohibited.
E-mail
transmission cannot be guaranteed to be secure or error-free as
information
could be intercepted, corrupted, lost, destroyed, arrive late or
incomplete,
or contain viruses. The sender therefore does not accept liability for
any
errors or omissions in the contents of this message, which arise as a
result
of e-mail transmission. The content of this e-mail does not necessarily
represent the company, its policies, or views, or those of its
subsidiaries.
If verification is required please request a hard-copy version.
Please note that M2 Limited monitors incoming and outgoing mail for
compliance with its email policy. This includes scanning incoming emails
to
detect Viruses. 


RE: Scope related Vector iteration problem

2003-06-11 Thread James Watkins

 I have a similar problem, Is the form bean session scope u r 
 talking abt
 or something else. I tried to set the scope=session in
 Struts-config.xml, it that right (Please bear with me as I am newbie)

Don't worry, so am I.
Yes, it sounds like you're doing the right thing.
What happens/doesn't happen?

DISCLAIMER: This message contains confidential information and is intended
for To: and Cc: (name). If you are not the intended recipient you are
notified that disclosing, copying, distributing or taking any action in
reliance on the contents of this information is strictly prohibited. E-mail
transmission cannot be guaranteed to be secure or error-free as information
could be intercepted, corrupted, lost, destroyed, arrive late or incomplete,
or contain viruses. The sender therefore does not accept liability for any
errors or omissions in the contents of this message, which arise as a result
of e-mail transmission. The content of this e-mail does not necessarily
represent the company, its policies, or views, or those of its subsidiaries.
If verification is required please request a hard-copy version.
Please note that M2 Limited monitors incoming and outgoing mail for
compliance with its email policy. This includes scanning incoming emails to
detect Viruses. 



Re: Scope related Vector iteration problem

2003-06-11 Thread Sandeep Takhar
It calls the getters too...

one.two.three

on submit will call
getOne().getTwo().setThree()

sandeep
--- Gemes Tibor [EMAIL PROTECTED] wrote:
 James Watkins írta:
 
 My problem comes when I try to submit the form.  I
 get the following
 exception when the bean gets populated:
 
 java.lang.ArrayIndexOutOfBoundsException: Array
 index out of range: 4
  at java.util.Vector.get(Vector.java:699)
 
 The index is that of the first project with a
 checked box.  I don't get this
 problem if I put the bean in session scope, but I'd
 rather not do that if I
 can avoid it.
   
 
 The struts framework only calls the setters, but the
 setters requires 
 the object to be present on which they are called.
 If the subbeans arent created at construction time,
 they will be null, 
 so NPE is thrown runtime.
 
 You have 2 alternatives: store in session or
 construct all subbeans with 
 the form.
 
 Hth,
 
 Tib
 
 
 
 

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


__
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com

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



Re: Scope and Action objects (struts 1.1)

2003-03-26 Thread David Graham
scope refers to the scope of the form bean not the action.  Actions are 
Singletons and live as long as your app is running.

David



From: Chai Ang [EMAIL PROTECTED]
Reply-To: Struts Users Mailing List [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: Scope and Action objects (struts 1.1)
Date: Thu, 27 Mar 2003 14:40:45 +1100
Hi there all,
I looked through the numerous queries in the archives
but couldnt find anything that answered my question.
If I have an action class, with a class member count
eg
public class QueryAction extends Action {
private int count = 0;
etc...
}
and in the execute() function I increment count by 1;

in my struts-config.xml

action  path=/query
 parameter=/WEB-INF/jsp/myform.jsp
 type=web.QueryAction
 scope=request
 validate=false
 name=queryForm
   forward name=success path=/WEB-INF/jsp/myform.jsp/
   forward name=failure path=/WEB-INF/jsp/myform.jsp/
/action
On requests to http://localhost:8080/query, on printing
out count in the execute() function in the Action,
I get the value 0 and 1, 2, 3 etc.. on subsequent request.
I thought by having scope=request the value of
count would be 0?
Is this right?
Would there be some other source code location where one
needs specify the scope?
My jsp form header looks like this
html:form action=query
etc..
/html:form
I noticed the scope attribute had been deprecated in the API.

Thanks in advance,
Chai
##
Attention:
The information in this electronic mail is privileged and
confidential, intended only for use of the individual or entity named.
If you are not the intended recipient, any dissemination, copying or
use of the information is strictly prohibited.  If you have received
this transmission in error, please delete it immediately from your
system and inform us via mailto [EMAIL PROTECTED]
This e-mail has been scanned and cleared by MailMarshal
##
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


_
The new MSN 8: advanced junk mail protection and 2 months FREE*  
http://join.msn.com/?page=features/junkmail

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


Re: Scope and Action objects (struts 1.1)

2003-03-26 Thread Dan Tran
You need to put the count var in your actionForm, and increment it in your
action class. But if you put the actionform in request, the increment has no
effect.

The action instance itself  is cached by struts.

-D
- Original Message -
From: Chai Ang [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, March 26, 2003 7:40 PM
Subject: Scope and Action objects (struts 1.1)


Hi there all,
I looked through the numerous queries in the archives
but couldnt find anything that answered my question.

If I have an action class, with a class member count
eg
public class QueryAction extends Action {
private int count = 0;
etc...
}

and in the execute() function I increment count by 1;

in my struts-config.xml

action  path=/query
 parameter=/WEB-INF/jsp/myform.jsp
 type=web.QueryAction
 scope=request
 validate=false
 name=queryForm
   forward name=success path=/WEB-INF/jsp/myform.jsp/
   forward name=failure path=/WEB-INF/jsp/myform.jsp/
/action

On requests to http://localhost:8080/query, on printing
out count in the execute() function in the Action,
I get the value 0 and 1, 2, 3 etc.. on subsequent request.

I thought by having scope=request the value of
count would be 0?
Is this right?

Would there be some other source code location where one
needs specify the scope?

My jsp form header looks like this
html:form action=query
etc..
/html:form

I noticed the scope attribute had been deprecated in the API.

Thanks in advance,
Chai
##
Attention:

The information in this electronic mail is privileged and
confidential, intended only for use of the individual or entity named.
If you are not the intended recipient, any dissemination, copying or
use of the information is strictly prohibited.  If you have received
this transmission in error, please delete it immediately from your
system and inform us via mailto [EMAIL PROTECTED]

This e-mail has been scanned and cleared by MailMarshal
##

-
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: scope of a tool

2003-02-02 Thread James Mitchell
Are you talking about Velosurf?


--
James Mitchell





- Original Message -
From: Aislan Fernandes [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Saturday, February 01, 2003 7:22 AM
Subject: scope of a tool


 hi again,

 Before i have said about scope of a tool and seem that nobody undestood me
 (my question), but now i have a text about this:

 the scope of the tool (as specified in your toolbox.xml) determines when
 your tool is created and what data is passed to the init() method (if an
 instance of ViewTool).

 a.  if the scope is request, then a new instance of the tool is
 created for each request (and lives only that long).  it will be
 instantiated with the current ViewContext (which is a ChainedContext when
 using the provided servlets).
 b. if the scope is session, then the tool is created and initialized
 only once for session.  if a ViewTool, then init() will be passed the
 ViewContext that is current for the request on which the session tools are
 first made.  you should also note that since session tools are kept in a
 HashMap within the session object, it is recommended (but not necessary)
 that they be serializable.
 c. application scoped tools are instantiated when the toolbox
manager
 is first loaded (at servlet init time).  if these implement the ViewTool
 interface, then the init() method will be passed the ServletContext to
give
 access to application resources.

 so, the my question is: is right the code below?

 toolbox
   tool
  keyrequer/key
  classRequerTool/class
   /tool
   tool scope=session
  keyuser/key
  classUserTool/class
   /tool
   tool scope=application
  keyapp/key
  classAplicationTool/class
   /tool
 /toolbox

 _
 Voce quer um iGMail protegido contra vírus e spams?
 Clique aqui: http://www.igmailseguro.ig.com.br


 -
 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: scope

2003-01-07 Thread Rick Reumann
On Mon, 6 Jan 2003 17:01:48 -0800 
LUCERO,DENNIS (HP-Boise,ex1) [EMAIL PROTECTED] wrote:

 
 
 -Original Message-
 From: Joe Barefoot [mailto:[EMAIL PROTECTED]] 
 Sent: Monday, January 06, 2003 5:18 PM
 To: Struts Users Mailing List
 Subject: RE: scope
 
  
  LDHBe The jsp containing the html:option tag is the last 
  thing the request is
  LDHBe forwarded to
  
  The forwarded page does not have access to the request any longer.
 
 I think you mean on a redirect.  

Actually sorry for my confusion. I think I worded what I wanted to say
wrong. What I thought might be happening was Dennis was setting up some
options in a List and putting them into the request then forwarding to
the page. All good and well, the jsp of course has access to the list.
Then I thought he was saying he submits his form (to an action) and then
forwards on to another page. Correct me if I'm wrong, but this last page
will not have access to the original information put in the request
back in the first action and displayed on the first page.   

I thought possibly you were talking about your List that makes up your
html:options not being there in the results page and figured it might
have been that they were not being reset into scope in the later action
(I like to recreate them in reset method). 

Maybe I just confused you more Dennis sorry:) Feel free to send the code
if you want if it's still not working.

-- 
Rick

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




Re: scope

2003-01-06 Thread Rick Reumann


On Monday, January 6, 2003, 6:57:15 PM, ex1) wrote:

LDHBe The jsp containing the html:option tag is the last thing the request is
LDHBe forwarded to

The forwarded page does not have access to the request any longer.

If you want to have access to what was selected on the form page and
then display it on another page. Set up a form bean to go with the jsp
and configure it in your action mapping in your config file than when
submitted to your action, you could pass this form bean on to another
page ( request.setAttribute(mapping.getAttribute(), form )



-- 

Rick
mailto:[EMAIL PROTECTED]


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




RE: scope

2003-01-06 Thread Joe Barefoot
 
 LDHBe The jsp containing the html:option tag is the last 
 thing the request is
 LDHBe forwarded to
 
 The forwarded page does not have access to the request any longer.

I think you mean on a redirect.  JSPs that are forwarded to definitely have access to 
the HttpServletRequest object; that's how references to request-scope form beans are 
obtained in the first place.

Dennis, have you tried putting debugging statements in the JSP using a scriplet?  Just 
grab the ActionForm in question from the request, cast it to the right type, and print 
out the values in question.  That should narrow it down a bit.

If no joy, post us some more info. with some snippets from your form(s) and JSP.


 
 If you want to have access to what was selected on the form page and
 then display it on another page. Set up a form bean to go with the jsp
 and configure it in your action mapping in your config file than when
 submitted to your action, you could pass this form bean on to another
 page ( request.setAttribute(mapping.getAttribute(), form )
 
 
 
 -- 
 
 Rick
 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: scope

2003-01-06 Thread LUCERO,DENNIS (HP-Boise,ex1)


-Original Message-
From: Joe Barefoot [mailto:[EMAIL PROTECTED]] 
Sent: Monday, January 06, 2003 5:18 PM
To: Struts Users Mailing List
Subject: RE: scope

 
 LDHBe The jsp containing the html:option tag is the last 
 thing the request is
 LDHBe forwarded to
 
 The forwarded page does not have access to the request any longer.

I think you mean on a redirect.  JSPs that are forwarded to definitely have
access to the HttpServletRequest object; that's how references to
request-scope form beans are obtained in the first place.

Dennis, have you tried putting debugging statements in the JSP using a
scriplet?  Just grab the ActionForm in question from the request, cast it to
the right type, and print out the values in question.  That should narrow it
down a bit.

I did just that. Wrote a scriplet that gets the bean out of the request (it
was there) and guess what ?? the bean has the correct values. Hm??

I am thinking the html:option tag does not check the request object for it
and goes straight to session, but this is without diving into the tag lib
code.



If no joy, post us some more info. with some snippets from your form(s) and
JSP.


 
 If you want to have access to what was selected on the form page and
 then display it on another page. Set up a form bean to go with the jsp
 and configure it in your action mapping in your config file than when
 submitted to your action, you could pass this form bean on to another
 page ( request.setAttribute(mapping.getAttribute(), form )
 
 
 
 -- 
 
 Rick
 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]

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




RE: scope

2003-01-06 Thread LUCERO,DENNIS (HP-Boise,ex1)


Here is another post with my message at the top.


I did just that. Wrote a scriplet that gets the bean out of the request (it
was there) and guess what ?? the bean has the correct values. Hm??

I am thinking the html:option tag does not check the request object for it
and goes straight to session, but this is without diving into the tag lib
code.


-Original Message-
From: LUCERO,DENNIS (HP-Boise,ex1) [mailto:[EMAIL PROTECTED]] 
Sent: Monday, January 06, 2003 6:02 PM
To: 'Struts Users Mailing List'
Subject: RE: scope



-Original Message-
From: Joe Barefoot [mailto:[EMAIL PROTECTED]] 
Sent: Monday, January 06, 2003 5:18 PM
To: Struts Users Mailing List
Subject: RE: scope

 
 LDHBe The jsp containing the html:option tag is the last 
 thing the request is
 LDHBe forwarded to
 
 The forwarded page does not have access to the request any longer.

I think you mean on a redirect.  JSPs that are forwarded to definitely have
access to the HttpServletRequest object; that's how references to
request-scope form beans are obtained in the first place.

Dennis, have you tried putting debugging statements in the JSP using a
scriplet?  Just grab the ActionForm in question from the request, cast it to
the right type, and print out the values in question.  That should narrow it
down a bit.



If no joy, post us some more info. with some snippets from your form(s) and
JSP.


 
 If you want to have access to what was selected on the form page and
 then display it on another page. Set up a form bean to go with the jsp
 and configure it in your action mapping in your config file than when
 submitted to your action, you could pass this form bean on to another
 page ( request.setAttribute(mapping.getAttribute(), form )
 
 
 
 -- 
 
 Rick
 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]

--
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: scope

2002-10-30 Thread Jeff_Mychasiw
Here is what we had to do.   I would love opinions to know if I am on the
right track.

In our BaseAction we have a helper method that looks for ActionErrors in
request scope (with the Struts Key):

protected boolean isValErrorsPresent(HttpServletRequest request){
ActionErrors errors = (ActionErrors)request.getAttribute(Action.ERROR_KEY);
return (errors == null)? false:true;
}

Then in the load action for the page we decide if we populate the form bean from the  
back end or leave the form bean as it is:

 in LoadAction:

if(! isValErrorsPresent){
...Get form bean and populate with data from the back end...

}else{

.. Do nothing because form is already populated with bad data and the form will re 
display the origianl data but with validation method.
}

my 2 cents..






Knoernschild, Kirk W [EMAIL PROTECTED] on 10/30/2002 08:27:21 AM

Please respond to Struts Users Mailing List
   [EMAIL PROTECTED]

To:[EMAIL PROTECTED]
cc:

Subject:scope


I'm using a databean to populate my JSP page. I put the bean on the
request. The page populates fine. When submitting however, Struts builds my
formbean and calls the validate method. If the validate method fails, I try
to return to the submitting page. However, that page uses the databean,
which is no longer in scope, and I error out. Others must have this same
challenge. What have y'all done to accommodate this? thanx.

--kirk

--
To unsubscribe, e-mail:   
mailto:struts-user-unsubscribe;jakarta.apache.org
For additional commands, e-mail: 
mailto:struts-user-help;jakarta.apache.org











--
To unsubscribe, e-mail:   mailto:struts-user-unsubscribe;jakarta.apache.org
For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org




Re: [scope]

2002-10-30 Thread Josh Berry
Response below...

Knoernschild, Kirk W [EMAIL PROTECTED] wrote:
  I'm using a databean to populate my JSP page. I put the bean on
 the request. The page populates fine. When submitting however,
 Struts builds my formbean and calls the validate method. If the
 validate method fails, I try to return to the submitting page.
 However, that page uses the databean, which is no longer in
 scope, and I error out. Others must have this same challenge.
 What have y'all done to accommodate this? thanx.

I actually ran into a similar problem for some dropdown lists.  It turns out
that for my application, the information needed in the drop down list could be
safely (and probably appropriately) moved into the application scope.  So, you
could consider simply moving the information into a longer persistance scope
(such as session).

However, I would question what you are using the databean for.  The vast
majority of the data needed in a form page should come straight off of the
formBean.  Struts handles the preservation of those for you.  What other sort
of information are you hoping to preserve?  Is it specific to this incarnation
of this page, or would every page that looks like this use it?  (In my case,
that was the answer.  This information was used by every page that had this
input field, so I decided to put it in application scope to save trips to the
database as well as keep me from having to jump hoops.)

-josh


--
To unsubscribe, e-mail:   mailto:struts-user-unsubscribe;jakarta.apache.org
For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org




RE: scope

2002-10-30 Thread Xavier Combelle
I think you could solve this problem by specifying
in the input attribute af your action the action which populate
the JSP page instead of the JSP page itself
or by putting the first time the bean in session scope

Xavier


 
 Knoernschild, Kirk W [EMAIL PROTECTED] on 10/30/2002 08:27:21 AM
 
 Please respond to Struts Users Mailing List
[EMAIL PROTECTED]
 
 To:[EMAIL PROTECTED]
 cc:
 
 Subject:scope
 
 
 I'm using a databean to populate my JSP page. I put the bean on the
 request. The page populates fine. When submitting however, Struts 
 builds my
 formbean and calls the validate method. If the validate method 
 fails, I try
 to return to the submitting page. However, that page uses the databean,
 which is no longer in scope, and I error out. Others must have this same
 challenge. What have y'all done to accommodate this? thanx.
 
 --kirk


--
To unsubscribe, e-mail:   mailto:struts-user-unsubscribe;jakarta.apache.org
For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org




RE: scope = session or request

2002-10-25 Thread Divakar Satyanarayan
Get the information at following link..

http://jakarta.apache.org/struts/doc-1.0.2/userGuide/building_model.html#jav
abeans

Regards,
Divakar



 -Original Message-
 From: Marc AMIR-TAHMASSEB [SMTP:[EMAIL PROTECTED]]
 Sent: Friday, October 25, 2002 8:15 PM
 To:   [EMAIL PROTECTED]
 Subject:  scope = session or request
 
 Hi everybody
 
 what is the difference between scope=request and scope=session ?
 
 thank's 
 
 Marc
 
 
 
 --
 To unsubscribe, e-mail:
 mailto:struts-user-unsubscribe;jakarta.apache.org
 For additional commands, e-mail:
 mailto:struts-user-help;jakarta.apache.org
 
 
DISCLAIMER: Information contained and transmitted by this E-MAIL is
proprietary to Mascot Systems Limited and is intended for use only by the
individual or entity to which it is addressed, and may contain information
that is privileged, confidential or exempt from disclosure under applicable
law. If this is a forwarded message, the content of this E-MAIL may not have
been sent with the authority of the Company. If you are not the intended
recipient, an agent of the intended recipient or a person responsible for
delivering the information to the named recipient, you are notified that any
use, distribution, transmission, printing, copying or dissemination of this
information in any way or in any manner is strictly prohibited. If you have
received this communication in error, please delete this mail  notify us
immediately at [EMAIL PROTECTED] Before opening attachments,
please scan for viruses. 



--
To unsubscribe, e-mail:   mailto:struts-user-unsubscribe;jakarta.apache.org
For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org




Re: Scope for action in struts-config?

2002-10-14 Thread David Graham

It sounds like you should try session scope in this case.  If you don't care 
about the form object being created on each request and want to save session 
memory then use request scope.  If you don't care about how much memory 
you're using and want less object creation/destruction then choose session 
scope.  If you use session then be sure to implement the reset method 
properly (this method doesn't seem to matter for request scope).

I've been using request for all my forms because I don't expect a huge 
amount of traffic to my app.  I would probably choose session for a high 
volume site though.

Dave


From: Wendy Smoak [EMAIL PROTECTED]
Reply-To: Struts Users Mailing List [EMAIL PROTECTED]
To: 'Struts Users Mailing List' [EMAIL PROTECTED]
Subject: Scope for action in struts-config?
Date: Mon, 14 Oct 2002 16:29:39 -0700


I have an application that needs to go back and forth between the main
form and a resolution form so people can choose people to add to the main
form.  It also does round trips back to the main form if they choose to
remove one of the existing people on the form.

I seem to be having trouble hanging onto the ActionForm instance, as the
form keeps going blank at different points in the user interaction.  I'm
still trying to trace the code to find out what's wrong.

I note that the struts-config I copied from the example has scope=request
and I wonder if scope=session might be more appropriate.

When do you choose session scope for your actions?

Thank you,

--
Wendy Smoak
http://sourceforge.net/projects/unidbtags




_
MSN Photos is the easiest way to share and print your photos: 
http://photos.msn.com/support/worldwide.aspx


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




RE: Scope of form beans

2002-09-22 Thread Robert Taylor

Howard, there are a couple different ways to achieve the results you desire.
I'll explain one that is the path of least resistance.

Screen 1: Displaying the list

You already say you have a bean in session scope which contains your list.
So, to display the list all you should really have to do is either forward
(via an action ) to the .jsp page that displays your list or call the .jsp
directly. On the page that displays your list, you can use the logic:iterate
tag to render your list to the screen. (I'm assuming you've already
successfully rendered the bean, if not let me know).
You say that each item has an edit button next to it. For now, I'll assume
that this edit button is
a hyperlinked image button that when clicked will send a request to a
showEditItemAction with some information in the query string which
uniquely identifies the item which you wish to edit.


Screen 2: Displaying the item to be edited

As mentioned above the user has selected an item from the list by clicking
the appropriate edit button. The button is a hyperlinked button which sends
a request to an action that will prepare the edit page for display; let's
call the action showEditItemAction. ShowEditItemAction  retrieves the
query string parameter which uniquely identifies the item in the bean.
ShowEditItemAction gets the identified item from the bean and populates the
ActionForm and then forwards to screen 2 which will render the contents of
the form.


Now, the best way to do this is subjective and relative to your requirements
and existing architecture.
This sounds like a classic master-detail problem in which you display a
master list of items to select from and when the user selects an item, it's
details are displayed on another screen (either for edit or display). You
can search the archives for master-detail and probably find a lot of
solutions that are similar.

Eddie has already alluded to a popular approach where you have an action
which prepares the master list screen for display; an action which prepares
the detail screen for display; and finally an action which saves any changes
and forwards back to the list.


Let me know if you need more clarification.

robert


 -Original Message-
 From: Howard Miller [mailto:[EMAIL PROTECTED]]
 Sent: Saturday, September 21, 2002 2:27 PM
 To: Struts Users Mailing List
 Subject: Re: Scope of form beans


 Errr..

 may I take a step back, and explain what I want to do, rather that
 how I'm doing it wrong!

 - I have a bean in the session scope (working fine).
 - This session bean has an ArrayList 'pointing to' a number of other
 beans.
 - Screen 1: The array list is displayed for the user, with an edit button
 next to each item. (ie, list of items, and the user can edit the content
 of each one).
 - Screen 2: The user has selected one of the ArrayList items and can
 now edit the contents.
 - After editing we go back to screen 1, to pick another if need be.

 What's the best way to do this, basically? Its kind of like a shopping
 cart scenario (it isn't - but just to get over the idea), so it
 should be a
 common situation

 Cheers Howard

 On 21 Sep 2002 at 10:32, Eddie Bush wrote:

  So you're trying to pre-populate a form?  ... which you're just
 about to
  show a user?
 
  link - action f- JSP  (f- == forward)
 
  - link points to action
  - action populates form
  - action forwards control to JSP
 
  Is this your scenario?
 
  You need to:
  - build a form-bean (by extending ActionForm) or use a
  DynaActionForm (or similar)
  - associate the form-bean with the action (so Struts will create it)
  - extend Action (or one of it's descendants) and code the execute
  method so that it pre-populates your bean and then forwards to
 the JSP page.
 
  Once you have done this, your action is passed an instance of the
  form-bean which should be available to the JSP page.  You just populate
  it and forward control.  Be aware though :-) that if you  then send the
  user to a view page (to show what their edits were, perhaps), you'll
  have to be looking in the same scope for the form-bean, or you're not
  gonna find it ;-)
 
  Ex:
 
  action path=/editUser ... scope=request ... /
  action path=/viewUser ... scope=request ... /
 
  The default scope is session.  If that's where you want the form kept
  you don't have to specify it.
 
  Howard Miller wrote:
 
  Hi,
  
  I'm a bit confused... so I hope this makes some sense.
  
  I wish to display a form for the user to edit. BUT the form
 isn't empty
  it needs to come from a bean that is sitting in an ArrayList. Is there
  some way to do this directly?
  
  My answer (that doesn't work) is to create a standalone bean (of
  the same type) in the action form that forwards to the page.
 I've tried
  this a number of different ways but my form does not see the bean
  bean not found etc. I am creating the bean in request scope - is
  this correct?
  
  Without ranting on any more, what are the rules for doing

Re: Scope of form beans

2002-09-21 Thread kiuma

1) save the array list in the http session.
2) don't call jsp, but call the action related to it.
3) Pick your data from ArrayList
4) Cast the variable form in execute method ( or equvalent ) to the 
related form
5) Fill that form with the data jet picked.

You'll display the data.




Howard Miller wrote:

Hi,

I'm a bit confused... so I hope this makes some sense.

I wish to display a form for the user to edit. BUT the form isn't empty 
it needs to come from a bean that is sitting in an ArrayList. Is there 
some way to do this directly?

My answer (that doesn't work) is to create a standalone bean (of 
the same type) in the action form that forwards to the page. I've tried 
this a number of different ways but my form does not see the bean 
bean not found etc. I am creating the bean in request scope - is 
this correct?

Without ranting on any more, what are the rules for doing this, 
assuming its a good idea at all.

Howard

--
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: Scope of form beans

2002-09-21 Thread Eddie Bush

So you're trying to pre-populate a form?  ... which you're just about to 
show a user?

link - action f- JSP  (f- == forward)

- link points to action
- action populates form
- action forwards control to JSP

Is this your scenario?

You need to:
- build a form-bean (by extending ActionForm) or use a 
DynaActionForm (or similar)
- associate the form-bean with the action (so Struts will create it)
- extend Action (or one of it's descendants) and code the execute 
method so that it pre-populates your bean and then forwards to the JSP page.

Once you have done this, your action is passed an instance of the 
form-bean which should be available to the JSP page.  You just populate 
it and forward control.  Be aware though :-) that if you  then send the 
user to a view page (to show what their edits were, perhaps), you'll 
have to be looking in the same scope for the form-bean, or you're not 
gonna find it ;-)

Ex:

action path=/editUser ... scope=request ... /
action path=/viewUser ... scope=request ... /

The default scope is session.  If that's where you want the form kept 
you don't have to specify it.

Howard Miller wrote:

Hi,

I'm a bit confused... so I hope this makes some sense.

I wish to display a form for the user to edit. BUT the form isn't empty 
it needs to come from a bean that is sitting in an ArrayList. Is there 
some way to do this directly?

My answer (that doesn't work) is to create a standalone bean (of 
the same type) in the action form that forwards to the page. I've tried 
this a number of different ways but my form does not see the bean 
bean not found etc. I am creating the bean in request scope - is 
this correct?

Without ranting on any more, what are the rules for doing this, 
assuming its a good idea at all.

Howard

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


-- 
Eddie Bush




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




Re: Scope of form beans

2002-09-21 Thread Howard Miller

Errr..

may I take a step back, and explain what I want to do, rather that 
how I'm doing it wrong!

- I have a bean in the session scope (working fine).
- This session bean has an ArrayList 'pointing to' a number of other 
beans.
- Screen 1: The array list is displayed for the user, with an edit button 
next to each item. (ie, list of items, and the user can edit the content 
of each one).
- Screen 2: The user has selected one of the ArrayList items and can 
now edit the contents.
- After editing we go back to screen 1, to pick another if need be.

What's the best way to do this, basically? Its kind of like a shopping 
cart scenario (it isn't - but just to get over the idea), so it should be a 
common situation

Cheers Howard

On 21 Sep 2002 at 10:32, Eddie Bush wrote:

 So you're trying to pre-populate a form?  ... which you're just about to 
 show a user?
 
 link - action f- JSP  (f- == forward)
 
 - link points to action
 - action populates form
 - action forwards control to JSP
 
 Is this your scenario?
 
 You need to:
 - build a form-bean (by extending ActionForm) or use a 
 DynaActionForm (or similar)
 - associate the form-bean with the action (so Struts will create it)
 - extend Action (or one of it's descendants) and code the execute 
 method so that it pre-populates your bean and then forwards to the JSP page.
 
 Once you have done this, your action is passed an instance of the 
 form-bean which should be available to the JSP page.  You just populate 
 it and forward control.  Be aware though :-) that if you  then send the 
 user to a view page (to show what their edits were, perhaps), you'll 
 have to be looking in the same scope for the form-bean, or you're not 
 gonna find it ;-)
 
 Ex:
 
 action path=/editUser ... scope=request ... /
 action path=/viewUser ... scope=request ... /
 
 The default scope is session.  If that's where you want the form kept 
 you don't have to specify it.
 
 Howard Miller wrote:
 
 Hi,
 
 I'm a bit confused... so I hope this makes some sense.
 
 I wish to display a form for the user to edit. BUT the form isn't empty 
 it needs to come from a bean that is sitting in an ArrayList. Is there 
 some way to do this directly?
 
 My answer (that doesn't work) is to create a standalone bean (of 
 the same type) in the action form that forwards to the page. I've tried 
 this a number of different ways but my form does not see the bean 
 bean not found etc. I am creating the bean in request scope - is 
 this correct?
 
 Without ranting on any more, what are the rules for doing this, 
 assuming its a good idea at all.
 
 Howard
 
 --
 To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
 For additional commands, e-mail: mailto:[EMAIL PROTECTED]
 
 
 -- 
 Eddie Bush
 
 
 
 
 --
 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: scope for form beans

2002-01-09 Thread Shengmeng Liu

Hi,
Essentially, the form bean is the model for the web tier.
It's state can be associated with a certain request, in this case,
it will be stored as a request-scope attribute. If it's state is 
associated with a certain user/session, then it will be stored as
a session-scope attribute.
Categorizing state into different scopes, namely request, session and
context will best reflect its nature and allow the servlet container to
manage(instantiate/use/destroy) accordingly. Form bean is just one of
this kind of state.

Hope this helps,
Shengmeng Liu

- Original Message - 
From: Chen, Yong [EMAIL PROTECTED]
To: 'Struts Users Mailing List' [EMAIL PROTECTED]
Sent: Tuesday, January 08, 2002 11:43 PM
Subject: RE: scope for form beans


 what if one of your forms is never used in a session?
 and with session level bean, how would you know the form bean doesn't
 contain old data? form is request based not session based. you can certainly
 store some info. from the form in the session.
 
 yc
 
 
 -Original Message-
 From: Kuntz Peter, NY [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, January 08, 2002 7:29 AM
 To: [EMAIL PROTECTED]
 Subject: scope for form beans
 
 
 Hi,
 
 what are the motivations for having a request or session scoped form bean.
 As far as I could see in the struts source code a request scoped form bean
 is instantiated newly for every request. What are the reasons for that. Why
 shouldn't a form bean always exist during the time the session exists?
 
 peter
 DISCLAIMER: The information in this message is confidential and may be
 legally privileged. It is intended solely for the addressee.  Access to this
 message by anyone else is unauthorised.  If you are not the intended
 recipient, any disclosure, copying, or distribution of the message, or any
 action or omission taken by you in reliance on it, is prohibited and may be
 unlawful.  Please immediately contact the sender if you have received this
 message in error. Thank you
 
 --
 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: scope for form beans

2002-01-08 Thread Chen, Yong

what if one of your forms is never used in a session?
and with session level bean, how would you know the form bean doesn't
contain old data? form is request based not session based. you can certainly
store some info. from the form in the session.

yc


-Original Message-
From: Kuntz Peter, NY [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 08, 2002 7:29 AM
To: [EMAIL PROTECTED]
Subject: scope for form beans


Hi,

what are the motivations for having a request or session scoped form bean.
As far as I could see in the struts source code a request scoped form bean
is instantiated newly for every request. What are the reasons for that. Why
shouldn't a form bean always exist during the time the session exists?

peter
DISCLAIMER: The information in this message is confidential and may be
legally privileged. It is intended solely for the addressee.  Access to this
message by anyone else is unauthorised.  If you are not the intended
recipient, any disclosure, copying, or distribution of the message, or any
action or omission taken by you in reliance on it, is prohibited and may be
unlawful.  Please immediately contact the sender if you have received this
message in error. Thank you

--
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: scope for form beans

2002-01-08 Thread Freek Segers

Hi,

I'm using a session scope Form bean in a wizard like interface. Because the
Form has session scope the user can go back to any step in the wizard and
find his previously filled in values.

Greetings,

Freek Segers

on 08-01-2002 14:28 you wrote:

 Hi,
 
 what are the motivations for having a request or session scoped form bean.
 As far as I could see in the struts source code a request scoped form bean
 is instantiated newly for every request. What are the reasons for that. Why
 shouldn't a form bean always exist during the time the session exists?
 


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




Re: scope for form beans

2002-01-08 Thread Muralidhar_BR



Hi
does this also mean the form bean goes null when the session gets timedout?
Regards,
Murali




**
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.Kindlesystems.com
**

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




RE: Scope of the form

2001-06-10 Thread Joyce Tang
Title: RE: Scope of the form






Roland,


Thank you for the answer.


In the forsard.setRedirect(true), can I also forward the content of the request?


When I was talking about the erroe, I was actually refering to the validation error in the form. In that the case the ActionController will forward to the input of the action class, with request or without?

According to Roland, the 
-Original Message-
From: Roland Huss [mailto:[EMAIL PROTECTED]]
Sent: Thursday, June 07, 2001 10:24 AM
To: [EMAIL PROTECTED]
Subject: Re: Scope of the form




 1. Whenever the Action do a forward, the request is being forwarded.


It depends, whether you do an redirect (forward.setRedirect(true)) or
a true forward, which simply includes another resources in the
response. In the former case, the redirected resources receives a new
Request since this is essentially initiated from the client. In the
later case, you are right, the response is forwarded to resource to be
included (which is the normal case with Struts forwards). 


 2. When the error happens, the request is forwarded back to the same JSP


What kind of error do you mean ? If an exception is thrown in your
Action it is passed up to the Servlet-Container, which creates an
appropriate response for the client (configurable in web.xml). If an
exception occurs in the JSP-page, the error-page defined in your
JSP-Page is called (with the very same request).


 3. If I define the scope of the form related to the Action class as
 request, then before the JSP page is rendered, the form is still in the
 request, but after the JSP page is rendered,the form is taken out from the
 request?


That's true, since after the JSP has been rendered the Response is
sent back to the client and the lifecycle of the request has
finished. 


cu
-- 
   ...roland huss
   consol.de





RE: Scope and re-display with errors problem...

2001-03-14 Thread Abraham Kang

Firmin,

   Due to the inherient problems with frames here is a solution for your
case.

   Abstract out the logic to generate the list of items in a different
Action object.

   When you are outputting the the FRAME HTML tag,
   map that to the action object that will generate the list items.

   Ex:

FRAME
src="buildMenu.do?paramThatYouNeedToBuildList=valueOtherParam=2"

   If you are submitting your form from a frame and not building a FRAMESET

   try this:
  I am guessing that you have to sibling frames and the frame with the
list items is called "menuFrame".

  Body onLoad="callAFunctionToReloadMenuFrame()"

  this function would reload the menuFrame with the URL above:

 buildMenu.do?paramThatYouNeedToBuildList=valueOtherParam=2

Hope This Helps,
Abraham


 -Original Message-
 From: Firmin David [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, March 14, 2001 3:13 AM
 To: '[EMAIL PROTECTED]'
 Subject: Scope and re-display with errors problem...


 Hi all,
 I make a request from a menu frame for a list of items, and they are then
 displayed in the adjacent main frame. Before the page is displayed, the
 "list" object is put in *request* scope in the code. If the user enters
 invalid data and submits the form (of which the list is a part), the page
 cannot be redisplayed with the associated errors as the "list"
 object is no
 longer visible to it. I have no wish (for a multitude of reasons)
 to put the
 "list" object in the session even though it would solve the problem.
 Is there another way around this? I have tried bean:define with
 toScope="request" in the original page but clearly cannot call the new
 variable the same thing, meaning that all my references to the bean within
 the page become invalid. (I am unsure whether or not this would've worked
 anyway)

 Any help in finding a way of doing this without using session
 scope would be
 very gratefully received!

 Thanks in advance

 Rgds
 David

 
 The information in this email is confidential and is intended solely
 for the addressee(s).
 Access to this email by anyone else is unauthorised. If you are not
 an intended recipient, you must not read, use or disseminate the
 information contained in the email.
 Any views expressed in this message are those of the individual sender,
 except where the sender specifically states them to be the views of
 The Capital Markets Company.

http://www.capco.com
***