Calling JSP directly.

2004-10-04 Thread Shabada, Gnaneshwer

Hi,
Was wondering if calling a JSP directly a good approach in struts or should
I always go through Action/Action Mappings. I have a situation where I have
a result list displayed in a table and each row has email icon which when
clicked should display a JSP where one can enter email text and preview the
email. So I thought I could directly call JSP using html:link
page=email.jsp. But I also want to send the To: email address of from
the row where it is clikced. Can I pass it as a request paramter when I call
the JSP directly or do I call an Action instead ?
If I can call thru JSP, how do I retrieve that email value in the next JSP??

Thanks for your help
Gnan

 
This email message is for the sole use of the intended recipient (s) and may
contain confidential and privileged information. Any unauthorized review,
use, disclosure or distribution is prohibited. If you are not the intended
recipient, please contact the sender by reply email and destroy all copies
of the original message. To reply to our email administrator directly, send
an email to [EMAIL PROTECTED] 
Toys R Us, Inc.

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



Re: Calling JSP directly.

2004-10-04 Thread Jeff Beal
You *can* call a JSP directly in this way, but it is not generally 
considered to be the best approach.  It's better to always link to an 
Action class.  Even if you use the Struts ForwardAction 
(http://struts.apache.org/api/org/apache/struts/actions/ForwardAction.html), 
which doesn't do anything with the request except forward it to a JSP 
page, you at least have the option of adding a different Action class 
later without chaning any links.

That said, if you do want to link directly to a JSP page, the method you 
describe will probably work.  Review 
http://struts.apache.org/userGuide/struts-html.html#link to see some 
ideas on adding request parameters dynamically using the html:link/ 
tag.  In your JSP page, you will be able to access these parameters as 
usual.

HTH,
Jeff
Shabada, Gnaneshwer wrote:
Hi,
Was wondering if calling a JSP directly a good approach in struts or should
I always go through Action/Action Mappings. I have a situation where I have
a result list displayed in a table and each row has email icon which when
clicked should display a JSP where one can enter email text and preview the
email. So I thought I could directly call JSP using html:link
page=email.jsp. But I also want to send the To: email address of from
the row where it is clikced. Can I pass it as a request paramter when I call
the JSP directly or do I call an Action instead ?
If I can call thru JSP, how do I retrieve that email value in the next JSP??
Thanks for your help
Gnan
 
This email message is for the sole use of the intended recipient (s) and may
contain confidential and privileged information. Any unauthorized review,
use, disclosure or distribution is prohibited. If you are not the intended
recipient, please contact the sender by reply email and destroy all copies
of the original message. To reply to our email administrator directly, send
an email to [EMAIL PROTECTED] 
Toys R Us, Inc.

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

Re: Calling JSP directly.

2004-10-04 Thread Frank W. Zammetti
You CAN call JSPs directly, but it's not generally thought of as a good 
idea.  If you need to display a JSP and don't really need any 
functionality behind it, you can use a ForwardAction, which is a kind of 
Action specifically designed to just forward to a JSP.  This keeps your 
control layer involved.

In your case, you can do that and I'm pretty sure there's no reason you 
can't add the eMail address as a query string parameter, then access it 
through the request object on your JSP page.  However, I think it's 
probably a better design to have an ActionForm and an Action to submit 
to, forward to your JSP and access it through the form as you normally 
would in Struts.  Certainly will make your life easier later if you need 
to extend what's being done.

--
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
Shabada, Gnaneshwer wrote:
Hi,
Was wondering if calling a JSP directly a good approach in struts or should
I always go through Action/Action Mappings. I have a situation where I have
a result list displayed in a table and each row has email icon which when
clicked should display a JSP where one can enter email text and preview the
email. So I thought I could directly call JSP using html:link
page=email.jsp. But I also want to send the To: email address of from
the row where it is clikced. Can I pass it as a request paramter when I call
the JSP directly or do I call an Action instead ?
If I can call thru JSP, how do I retrieve that email value in the next JSP??
Thanks for your help
Gnan
 
This email message is for the sole use of the intended recipient (s) and may
contain confidential and privileged information. Any unauthorized review,
use, disclosure or distribution is prohibited. If you are not the intended
recipient, please contact the sender by reply email and destroy all copies
of the original message. To reply to our email administrator directly, send
an email to [EMAIL PROTECTED] 
Toys R Us, Inc.

-
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: Calling JSP directly.

2004-10-04 Thread Shabada, Gnaneshwer

OK. I created an Action class (DisplayEmail) and called it instead of the
ForwardAction class. In my action class I am setting the values in the
ActionForm (EmailForm) and displaying the JSP. EmailForm has fromEmail,
toEmail, subject and emailBody as the attributes. Works fine until here and
gets the fromEmail and toEmail values and displays on the JSP using
bean:write tags. Now, when I add Subject and Email text and hit send,
it goes to a diff Action Class(SendEmailAction) and when I try to get the
fromEmail and toEmail from the ActionForm (EmailForm), they return null.
I have the EmailForm set to request scope in the config file for this
action. I thought I should see those values in the ActionClass but no luck.
Can anyone point out if I am doing anything wrong. Does the ActionForm
retrieve values if I use bean:write tags in the previous JSP or should
they be alwatys input tags..

Let me know if you need more info.

Thanks for your help
Gnan


-Original Message-
From: Shabada, Gnaneshwer [mailto:[EMAIL PROTECTED]
Sent: Monday, October 04, 2004 4:41 PM
To: 'Struts Users Mailing List'
Subject: RE: Calling JSP directly.




Thanks for your replies guys. I implemented the ForwardAction class as you
suggested and it works. But I ran into another problem Like I said I am
displaying the value from the request scope as below. 

td%=request.getParameter(email)%/td

This displays what I want. But can I set this to my ActionForm for this JSP,
so that I can retrieve the same value in my Action Class and use it for
soemthing else.

I tried this but didnt work:

tdbean:write name=emailForm
property=%=request.getParameter(email)%//td

is there any other way that I can set this value to an ActionForm using bean
tags

Thanks again

-Original Message-
From: Frank W. Zammetti [mailto:[EMAIL PROTECTED]
Sent: Monday, October 04, 2004 2:23 PM
To: Struts Users Mailing List
Subject: Re: Calling JSP directly.


You CAN call JSPs directly, but it's not generally thought of as a good 
idea.  If you need to display a JSP and don't really need any 
functionality behind it, you can use a ForwardAction, which is a kind of 
Action specifically designed to just forward to a JSP.  This keeps your 
control layer involved.

In your case, you can do that and I'm pretty sure there's no reason you 
can't add the eMail address as a query string parameter, then access it 
through the request object on your JSP page.  However, I think it's 
probably a better design to have an ActionForm and an Action to submit 
to, forward to your JSP and access it through the form as you normally 
would in Struts.  Certainly will make your life easier later if you need 
to extend what's being done.



 
This email message is for the sole use of the intended recipient (s) and may
contain confidential and privileged information. Any unauthorized review,
use, disclosure or distribution is prohibited. If you are not the intended
recipient, please contact the sender by reply email and destroy all copies
of the original message. To reply to our email administrator directly, send
an email to [EMAIL PROTECTED] 
Toys R Us, Inc.

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



RE: Calling JSP directly.

2004-10-04 Thread Shabada, Gnaneshwer


Never mind. Got it. I used html:hidden fields with those bean:write tags
and it works, :)

Thanks anyways guys.

-Original Message-
From: Shabada, Gnaneshwer [mailto:[EMAIL PROTECTED]
Sent: Monday, October 04, 2004 5:37 PM
To: 'Struts Users Mailing List'
Subject: RE: Calling JSP directly.



OK. I created an Action class (DisplayEmail) and called it instead of the
ForwardAction class. In my action class I am setting the values in the
ActionForm (EmailForm) and displaying the JSP. EmailForm has fromEmail,
toEmail, subject and emailBody as the attributes. Works fine until here and
gets the fromEmail and toEmail values and displays on the JSP using
bean:write tags. Now, when I add Subject and Email text and hit send,
it goes to a diff Action Class(SendEmailAction) and when I try to get the
fromEmail and toEmail from the ActionForm (EmailForm), they return null.
I have the EmailForm set to request scope in the config file for this
action. I thought I should see those values in the ActionClass but no luck.
Can anyone point out if I am doing anything wrong. Does the ActionForm
retrieve values if I use bean:write tags in the previous JSP or should
they be alwatys input tags..

Let me know if you need more info.

Thanks for your help
Gnan


-Original Message-
From: Shabada, Gnaneshwer [mailto:[EMAIL PROTECTED]
Sent: Monday, October 04, 2004 4:41 PM
To: 'Struts Users Mailing List'
Subject: RE: Calling JSP directly.




Thanks for your replies guys. I implemented the ForwardAction class as you
suggested and it works. But I ran into another problem Like I said I am
displaying the value from the request scope as below. 

td%=request.getParameter(email)%/td

This displays what I want. But can I set this to my ActionForm for this JSP,
so that I can retrieve the same value in my Action Class and use it for
soemthing else.

I tried this but didnt work:

tdbean:write name=emailForm
property=%=request.getParameter(email)%//td

is there any other way that I can set this value to an ActionForm using bean
tags

Thanks again

-Original Message-
From: Frank W. Zammetti [mailto:[EMAIL PROTECTED]
Sent: Monday, October 04, 2004 2:23 PM
To: Struts Users Mailing List
Subject: Re: Calling JSP directly.


You CAN call JSPs directly, but it's not generally thought of as a good 
idea.  If you need to display a JSP and don't really need any 
functionality behind it, you can use a ForwardAction, which is a kind of 
Action specifically designed to just forward to a JSP.  This keeps your 
control layer involved.

In your case, you can do that and I'm pretty sure there's no reason you 
can't add the eMail address as a query string parameter, then access it 
through the request object on your JSP page.  However, I think it's 
probably a better design to have an ActionForm and an Action to submit 
to, forward to your JSP and access it through the form as you normally 
would in Struts.  Certainly will make your life easier later if you need 
to extend what's being done.



 
This email message is for the sole use of the intended recipient (s) and may
contain confidential and privileged information. Any unauthorized review,
use, disclosure or distribution is prohibited. If you are not the intended
recipient, please contact the sender by reply email and destroy all copies
of the original message. To reply to our email administrator directly, send
an email to [EMAIL PROTECTED] 
Toys R Us, Inc.

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

 
This email message is for the sole use of the intended recipient (s) and may
contain confidential and privileged information. Any unauthorized review,
use, disclosure or distribution is prohibited. If you are not the intended
recipient, please contact the sender by reply email and destroy all copies
of the original message. To reply to our email administrator directly, send
an email to [EMAIL PROTECTED] 
Toys R Us, Inc.

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