RE: Pass parameters between Action classes

2002-03-25 Thread Enrique Rodriguez

Hi Jim,
Thank you very much, you are completely true. The example now works

I was thinking that getParameter and getAttribute was the same.

I thought the diference between theirs was that getParameter get a String
and getAttribute an Object. ;-)

I hope this could help another newbies like me.

Regards, Enrique.

_
Enrique Rodriguez Lasterra




> De: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]En nombre de Jim
> Crossley

>
>
> Hi Enrigue.
>
> "Enrique Rodriguez" <[EMAIL PROTECTED]> writes:
>
> > When can i get the paremeters from it??? Only When I'm in a JSP?
> >
> > I Attach my example. Please take a look.
>
> You seem to be confusing "attributes" with "parameters".  They're not
> the same thing.  You're calling setAttribute in Action1 but then in
> Action2 you're trying to retrieve the attribute using getParameter.
> You must use getAttribute instead.
>
> All of the scope objects (page, application, session, request) provide
> an interface to allow you to get and set attributes.  Only the request
> object has parameters in addition to attributes.  These parameters are
> the ones submitted by the client's browser.  Parameters are immutable
> -- you can get them but you can't set them -- so that you can always
> tell exactly what was posted from the client.
>
> Make sense?
>
> --
> To unsubscribe, e-mail:
> 
> For additional commands, e-mail:
> 
>


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: Pass parameters between Action classes

2002-03-25 Thread Jim Crossley

Hi Enrigue.

"Enrique Rodriguez" <[EMAIL PROTECTED]> writes:

> When can i get the paremeters from it??? Only When I'm in a JSP?
> 
> I Attach my example. Please take a look.

You seem to be confusing "attributes" with "parameters".  They're not
the same thing.  You're calling setAttribute in Action1 but then in
Action2 you're trying to retrieve the attribute using getParameter.
You must use getAttribute instead.

All of the scope objects (page, application, session, request) provide
an interface to allow you to get and set attributes.  Only the request
object has parameters in addition to attributes.  These parameters are
the ones submitted by the client's browser.  Parameters are immutable
-- you can get them but you can't set them -- so that you can always
tell exactly what was posted from the client.

Make sense?

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




RE: Pass parameters between Action classes

2002-03-25 Thread jmcabello

Hi Enrique:

We´re trying to something like you and we´re using sessions.

What are whe doing?:

1.- From one jsp (jspOne), submit for "aid" to find a custoner. You need the
customer Id, but you only know about the name of your customer. This is very
usually in ERP systems: "the finders".

2.- The actionOne store then actionFormOne object in a session and forward
jspTwho ("the finder").

3.- "the finder" has the responsability for: input parameters about
customers and "lookup" the customer based on the parameters.

4.- "the finder" is implemented using jspTwo (for input parameters). When
the user input the paremeters, submit actionTwo, who gets a reference from
session about the actionFormOne, becouse actionTwo looks for "who call me?:
actionOne".

5.- When actionTwo finish it work it put's the "id" selected in the
actionFormOne referenced by the session, and do a forward to jspOne.

6.- Finaly, the JSP one, "get" the "id" suplied by the ActionFormOne.

We are researching in this area trying to implement
"go-sub-returning-a-value" with struts. This is very common pattern for us.



-Mensaje original-
De: Enrique Rodriguez [mailto:[EMAIL PROTECTED]]
Enviado el: domingo, 24 de marzo de 2002 20:16
Para: Struts Users Mailing List
Asunto: RE: Pass parameters between Action classes



Thanks Tim,
I know it, but i think that my example should work.

Why don't go??? I asked for it ;-)

_
Enrique Rodriguez Lasterra

> Tim Sawyer [mailto:[EMAIL PROTECTED]]
>
>
>
> You could always use the session instead of the request, and if you're
> bothered about using up session memory, remove the stuff from the session
> when you've read it back.
>
> So, same code as you have, but call session.setAttribute("param", param)
>
> Tim.
>
> -Original Message-
> From: Enrique Rodriguez [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, March 24, 2002 2:28 AM
> To: [EMAIL PROTECTED]
> Subject: Pass parameters between Action classes
>
>
> I'm very newbie with struts and i have one question:
>
> Is possible pass paramter throwugh action classes???
>
> I explain it better??
>
> Action 1:
> String param = "param";
> request.setAttribute("param", param);
> return (mapping.findForward ("Action2"));
>
> Action 2:
> String param = (String)request.getAttribute("param");
>
>
> I'm trying to do it but its imposible. The only way to pass parameters is
> with a Form class.
>
> What am I doing wrong???
>
> Thanks in advance and pardon for my english, Enrique.
>
> _
> Enrique Rodriguez Lasterra
>
>
> --
> 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: Pass parameters between Action classes

2002-03-24 Thread Enrique Rodriguez


Thanks Tim,
I know it, but i think that my example should work.

Why don't go??? I asked for it ;-)

_
Enrique Rodriguez Lasterra

> Tim Sawyer [mailto:[EMAIL PROTECTED]]
>
>
>
> You could always use the session instead of the request, and if you're
> bothered about using up session memory, remove the stuff from the session
> when you've read it back.
>
> So, same code as you have, but call session.setAttribute("param", param)
>
> Tim.
>
> -Original Message-
> From: Enrique Rodriguez [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, March 24, 2002 2:28 AM
> To: [EMAIL PROTECTED]
> Subject: Pass parameters between Action classes
>
>
> I'm very newbie with struts and i have one question:
>
> Is possible pass paramter throwugh action classes???
>
> I explain it better??
>
> Action 1:
> String param = "param";
> request.setAttribute("param", param);
> return (mapping.findForward ("Action2"));
>
> Action 2:
> String param = (String)request.getAttribute("param");
>
>
> I'm trying to do it but its imposible. The only way to pass parameters is
> with a Form class.
>
> What am I doing wrong???
>
> Thanks in advance and pardon for my english, Enrique.
>
> _
> Enrique Rodriguez Lasterra
>
>
> --
> To unsubscribe, e-mail:
> 
> For additional commands, e-mail:
> 
>
>
>
>
> --
> To unsubscribe, e-mail:

For additional commands, e-mail:



--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




RE: Pass parameters between Action classes

2002-03-24 Thread Tim Sawyer

You could always use the session instead of the request, and if you're
bothered about using up session memory, remove the stuff from the session
when you've read it back.

So, same code as you have, but call session.setAttribute("param", param)

Tim.

-Original Message-
From: Enrique Rodriguez [mailto:[EMAIL PROTECTED]]
Sent: Sunday, March 24, 2002 2:28 AM
To: [EMAIL PROTECTED]
Subject: Pass parameters between Action classes


I'm very newbie with struts and i have one question:

Is possible pass paramter throwugh action classes???

I explain it better??

Action 1:
String param = "param";
request.setAttribute("param", param);
return (mapping.findForward ("Action2"));

Action 2:
String param = (String)request.getAttribute("param");


I'm trying to do it but its imposible. The only way to pass parameters is
with a Form class.

What am I doing wrong???

Thanks in advance and pardon for my english, Enrique.

_
Enrique Rodriguez Lasterra


--
To unsubscribe, e-mail:

For additional commands, e-mail:





--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




RE: Pass parameters between Action classes

2002-03-24 Thread Enrique Rodriguez

Redirect to true I never use this option.

One thing that could be important is that in the browser location bar always
appear Action1.do.

Is this an expected behaviour???

Regards, Enrique.
_
Enrique Rodriguez Lasterra




> Robert Nocera

>
> A JSP is a servlet so the "request" in your JSP is the same as the
> "request" passed to your Action from the ActionServlet.  Maybe your
> forward has redirect set to "true"?  If it does, the browser is making a
> new request and so anything you added with request.setAttribute will be
> lost.
>
> Robert Nocera
> New England Open Solutions
> www.neosllc.com
> "You supply the Vision.  We will do the rest."
>  
>
>
> -Original Message-
> From: Enrique Rodriguez [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, March 24, 2002 10:23 AM
> To: Struts Users Mailing List
> Subject: RE: Pass parameters between Action classes
>
> Hello,
>
> Thanks for your response. I think the problem is with the request
> object.
>
> When can i get the paremeters from it??? Only When I'm in a JSP?
>
> I Attach my example. Please take a look.
>
> Regards, Enrique.
> _
> Enrique Rodriguez Lasterra
>
>
> > Jim Crossley
> >
> >
> > As long as the first action's forward element in struts-config refers
> > to an Action servlet and not a jsp, your example should work.
> > Something like this maybe:
> >
> > 
> >   
> > 
> > 
> >
> > "Enrique Rodriguez" <[EMAIL PROTECTED]> writes:
> >
> > > I'm very newbie with struts and i have one question:
> > >
> > > Is possible pass paramter throwugh action classes???
> > >
> > > I explain it better??
> > >
> > > Action 1:
> > > String param = "param";
> > > request.setAttribute("param", param);
> > > return (mapping.findForward ("Action2"));
> > >
> > > Action 2:
> > > String param = (String)request.getAttribute("param");
> > >
> > >
> > > I'm trying to do it but its imposible. The only way to pass
> > parameters is
> > > with a Form class.
> > >
> > > What am I doing wrong???
> > >
> > > Thanks in advance and pardon for my english, Enrique.
> > >
> > > _
> > > Enrique Rodriguez Lasterra
> > >
> > >
> > > --
> > > To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
>
> --
> Jim Crossley
> http://www.lads.com/~jim
>
> --
> 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: Pass parameters between Action classes

2002-03-24 Thread Robert Nocera

A JSP is a servlet so the "request" in your JSP is the same as the
"request" passed to your Action from the ActionServlet.  Maybe your
forward has redirect set to "true"?  If it does, the browser is making a
new request and so anything you added with request.setAttribute will be
lost.

Robert Nocera
New England Open Solutions
www.neosllc.com
"You supply the Vision.  We will do the rest."
  


-Original Message-
From: Enrique Rodriguez [mailto:[EMAIL PROTECTED]] 
Sent: Sunday, March 24, 2002 10:23 AM
To: Struts Users Mailing List
Subject: RE: Pass parameters between Action classes

Hello,

Thanks for your response. I think the problem is with the request
object.

When can i get the paremeters from it??? Only When I'm in a JSP?

I Attach my example. Please take a look.

Regards, Enrique.
_
Enrique Rodriguez Lasterra


> Jim Crossley
>
>
> As long as the first action's forward element in struts-config refers
> to an Action servlet and not a jsp, your example should work.
> Something like this maybe:
>
> 
>   
> 
> 
>
> "Enrique Rodriguez" <[EMAIL PROTECTED]> writes:
>
> > I'm very newbie with struts and i have one question:
> >
> > Is possible pass paramter throwugh action classes???
> >
> > I explain it better??
> >
> > Action 1:
> > String param = "param";
> > request.setAttribute("param", param);
> > return (mapping.findForward ("Action2"));
> >
> > Action 2:
> > String param = (String)request.getAttribute("param");
> >
> >
> > I'm trying to do it but its imposible. The only way to pass
> parameters is
> > with a Form class.
> >
> > What am I doing wrong???
> >
> > Thanks in advance and pardon for my english, Enrique.
> >
> > _
> > Enrique Rodriguez Lasterra
> >
> >
> > --
> > To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>

--
Jim Crossley
http://www.lads.com/~jim

--
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: Pass parameters between Action classes

2002-03-24 Thread Enrique Rodriguez

Hello,

Thanks for your response. I think the problem is with the request object.

When can i get the paremeters from it??? Only When I'm in a JSP?

I Attach my example. Please take a look.

Regards, Enrique.
_
Enrique Rodriguez Lasterra


> Jim Crossley
>
>
> As long as the first action's forward element in struts-config refers
> to an Action servlet and not a jsp, your example should work.
> Something like this maybe:
>
> 
>   
> 
> 
>
> "Enrique Rodriguez" <[EMAIL PROTECTED]> writes:
>
> > I'm very newbie with struts and i have one question:
> >
> > Is possible pass paramter throwugh action classes???
> >
> > I explain it better??
> >
> > Action 1:
> > String param = "param";
> > request.setAttribute("param", param);
> > return (mapping.findForward ("Action2"));
> >
> > Action 2:
> > String param = (String)request.getAttribute("param");
> >
> >
> > I'm trying to do it but its imposible. The only way to pass
> parameters is
> > with a Form class.
> >
> > What am I doing wrong???
> >
> > Thanks in advance and pardon for my english, Enrique.
> >
> > _
> > Enrique Rodriguez Lasterra
> >
> >
> > --
> > To unsubscribe, e-mail:

> For additional commands, e-mail:


--
Jim Crossley
http://www.lads.com/~jim

--
To unsubscribe, e-mail:

For additional commands, e-mail:




Action1.java
Description: Binary data


Action2.java
Description: Binary data


example.jsp
Description: Binary data



http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd";>



  
  

  

  
  




  
  

  
  
  
  



  
  

   




--
To unsubscribe, e-mail:   
For additional commands, e-mail: 


Re: Pass parameters between Action classes

2002-03-23 Thread Jim Crossley

As long as the first action's forward element in struts-config refers
to an Action servlet and not a jsp, your example should work.
Something like this maybe:


  



"Enrique Rodriguez" <[EMAIL PROTECTED]> writes:

> I'm very newbie with struts and i have one question:
> 
> Is possible pass paramter throwugh action classes???
> 
> I explain it better??
> 
> Action 1:
> String param = "param";
> request.setAttribute("param", param);
> return (mapping.findForward ("Action2"));
> 
> Action 2:
> String param = (String)request.getAttribute("param");
> 
> 
> I'm trying to do it but its imposible. The only way to pass parameters is
> with a Form class.
> 
> What am I doing wrong???
> 
> Thanks in advance and pardon for my english, Enrique.
> 
> _
> Enrique Rodriguez Lasterra
> 
> 
> --
> To unsubscribe, e-mail:   
> For additional commands, e-mail: 

-- 
Jim Crossley
http://www.lads.com/~jim

--
To unsubscribe, e-mail:   
For additional commands, e-mail: