RE: Two Phase ActionClass

2002-09-12 Thread Cohan, Sean

Craig, in this thread you said I shouldn't have to have hidden fields
because the username
and password fields should still be set on the form bean associated with
"loginUser".  Do I have to do anything in the Logon action to make these
fields available to the loginWarning.jsp (like
session.setAttribute(mapping.getAttribute(), form);)?  I wasn't doing so.

thanks. 

-Original Message-
From: Craig Tataryn [mailto:[EMAIL PROTECTED]]
Sent: Monday, September 09, 2002 2:54 PM
To: Struts Users Mailing List
Subject: Re: Two Phase ActionClass


Create hidden fields (html:hidden) on the loginWarning.jsp page with the
same name of the username and password fields.  So long as they are within
the  tag as the others, it should pickup the values from the
FormBean that were set in login.jsp.

Actually, you shouldn't even need the hidden fields, because the username
and password fields should still be set on the form bean associated with
"loginUser".  This is the same action you are using for the Continue button.
So basically, inside the continue method as well as the continue else branch
of showWarningIfNecessary you should be able to dig those values out of the
form.

Let me know if that works for you,

Craig.


- Original Message -
From: "Cohan, Sean" <[EMAIL PROTECTED]>
To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
Sent: Monday, September 09, 2002 2:36 PM
Subject: RE: Two Phase ActionClass


> After clicking on continue on the loginWarning.jsp page, I no longer have
> the username and password fields that are validated in the validate method
> of the loginForm.  How should I make this available?  Thanks.
>
> -Original Message-
> From: Craig Tataryn [mailto:[EMAIL PROTECTED]]
> Sent: Friday, September 06, 2002 11:01 PM
> To: [EMAIL PROTECTED]
> Subject: Re: Two Phase ActionClass
>
>
> Sean, not sure if I would recycle the login page to show the warning,
> instead I would have another page called loginWarning.jsp which showed
them
> a message and then presented a Continue and Cancel button.  The Continue
> button would send them back to the logon Action class and the Cancel
button
> would simply be a link back to the login.jsp page.
>
> However, I would change my Action class to a DispatchAction class and
setup
> things like they have in the DispatchAction API doc, in your case,
something
>
> like this:
>
> type="my.package.LoginUserAction"
>name="subscriptionForm"
>scope="request"
>input="/login.jsp"
>parameter="action">
>
>
>
> 
>
> I would then have two jsps, one for logging in (login.jsp) and then the
one
> for warning (loginWarning.jsp), and I would code my DispatachAction class
as
>
> follows:
>
> import org.apache.struts.action.DispatchAction;
>
> public class LoginUserAction extends DispatchAction {
> //have one method named for each possible function name you will be
> //passing in the "action" parameter
>
> //invoked when our Action class is called with
action=showWarningIfNecessary
> public ActionForward showWarningIfNecessary(ActionMapping mapping,
> ActionForm form, HttpServletRequest request, HttpServletResponse response)
> throws Exception
> {
>//if the user is already logged in
>//return mappings.findForward("warning");
>//else return mappings.findForward("success");
> }
>
> //invoked when our Action class is called with action=continue
> public ActionForward continue(ActionMapping mapping, ActionForm form,
> HttpServletRequest request, HttpServletResponse response) throws Exception
> {
>return mappings.findForward("success");
> }
>
> }
>
> In login.jsp, you would have a hidden form field with a name of "action"
and
>
> a value of "showWarningIfNecessary":
>
> 
>
> In loginWarning.jsp your continue button could just be a link to:
> loginUser.do?action=continue (or you could have a hidden field named
action
> like in login.jsp, but the value would be "continue")
>
> And your cancel button could be a link to:
> login.jsp
>
> If you read the API doc on DispatchAction, this will all make sense.
>
> Hope that helped!
>
> Craig.
>
> >From: "Cohan, Sean" <[EMAIL PROTECTED]>
> >Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> >To: 'Struts Users Mailing List' <[EMAIL PROTECTED]>
> >Subject: Two Phase ActionClass
> >Date: Fri, 6 Sep 2002 20:14:37 -0400
> >
> >Within my logon ActionClass, I want to check the user's user id/password
> >and
> >whether they are currently logged on anywh

Re: Two Phase ActionClass

2002-09-09 Thread Craig Tataryn

Create hidden fields (html:hidden) on the loginWarning.jsp page with the
same name of the username and password fields.  So long as they are within
the  tag as the others, it should pickup the values from the
FormBean that were set in login.jsp.

Actually, you shouldn't even need the hidden fields, because the username
and password fields should still be set on the form bean associated with
"loginUser".  This is the same action you are using for the Continue button.
So basically, inside the continue method as well as the continue else branch
of showWarningIfNecessary you should be able to dig those values out of the
form.

Let me know if that works for you,

Craig.


- Original Message -
From: "Cohan, Sean" <[EMAIL PROTECTED]>
To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
Sent: Monday, September 09, 2002 2:36 PM
Subject: RE: Two Phase ActionClass


> After clicking on continue on the loginWarning.jsp page, I no longer have
> the username and password fields that are validated in the validate method
> of the loginForm.  How should I make this available?  Thanks.
>
> -Original Message-
> From: Craig Tataryn [mailto:[EMAIL PROTECTED]]
> Sent: Friday, September 06, 2002 11:01 PM
> To: [EMAIL PROTECTED]
> Subject: Re: Two Phase ActionClass
>
>
> Sean, not sure if I would recycle the login page to show the warning,
> instead I would have another page called loginWarning.jsp which showed
them
> a message and then presented a Continue and Cancel button.  The Continue
> button would send them back to the logon Action class and the Cancel
button
> would simply be a link back to the login.jsp page.
>
> However, I would change my Action class to a DispatchAction class and
setup
> things like they have in the DispatchAction API doc, in your case,
something
>
> like this:
>
> type="my.package.LoginUserAction"
>name="subscriptionForm"
>scope="request"
>input="/login.jsp"
>parameter="action">
>
>
>
> 
>
> I would then have two jsps, one for logging in (login.jsp) and then the
one
> for warning (loginWarning.jsp), and I would code my DispatachAction class
as
>
> follows:
>
> import org.apache.struts.action.DispatchAction;
>
> public class LoginUserAction extends DispatchAction {
> //have one method named for each possible function name you will be
> //passing in the "action" parameter
>
> //invoked when our Action class is called with
action=showWarningIfNecessary
> public ActionForward showWarningIfNecessary(ActionMapping mapping,
> ActionForm form, HttpServletRequest request, HttpServletResponse response)
> throws Exception
> {
>//if the user is already logged in
>//return mappings.findForward("warning");
>//else return mappings.findForward("success");
> }
>
> //invoked when our Action class is called with action=continue
> public ActionForward continue(ActionMapping mapping, ActionForm form,
> HttpServletRequest request, HttpServletResponse response) throws Exception
> {
>return mappings.findForward("success");
> }
>
> }
>
> In login.jsp, you would have a hidden form field with a name of "action"
and
>
> a value of "showWarningIfNecessary":
>
> 
>
> In loginWarning.jsp your continue button could just be a link to:
> loginUser.do?action=continue (or you could have a hidden field named
action
> like in login.jsp, but the value would be "continue")
>
> And your cancel button could be a link to:
> login.jsp
>
> If you read the API doc on DispatchAction, this will all make sense.
>
> Hope that helped!
>
> Craig.
>
> >From: "Cohan, Sean" <[EMAIL PROTECTED]>
> >Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> >To: 'Struts Users Mailing List' <[EMAIL PROTECTED]>
> >Subject: Two Phase ActionClass
> >Date: Fri, 6 Sep 2002 20:14:37 -0400
> >
> >Within my logon ActionClass, I want to check the user's user id/password
> >and
> >whether they are currently logged on anywhere else.  If they are logged
on
> >elsewhere, I want to go back to the logon page to warn them and give them
a
> >chance to continue or to bail.  If they continue, I want to skip over the
> >check whether they are logged on elsewhere.  I'm struggling with how from
> >my
> >logon.jsp page I can instruct the logon action to one thing one time and
> >another thing another time.  I was thinking maybe the ActionMapping
> >parameter, but I don't really know how to use it.  I'm searching.  Can
> >someone g

RE: Two Phase ActionClass

2002-09-09 Thread Cohan, Sean

After clicking on continue on the loginWarning.jsp page, I no longer have
the username and password fields that are validated in the validate method
of the loginForm.  How should I make this available?  Thanks.

-Original Message-
From: Craig Tataryn [mailto:[EMAIL PROTECTED]]
Sent: Friday, September 06, 2002 11:01 PM
To: [EMAIL PROTECTED]
Subject: Re: Two Phase ActionClass


Sean, not sure if I would recycle the login page to show the warning, 
instead I would have another page called loginWarning.jsp which showed them 
a message and then presented a Continue and Cancel button.  The Continue 
button would send them back to the logon Action class and the Cancel button 
would simply be a link back to the login.jsp page.

However, I would change my Action class to a DispatchAction class and setup 
things like they have in the DispatchAction API doc, in your case, something

like this:



   
   


I would then have two jsps, one for logging in (login.jsp) and then the one 
for warning (loginWarning.jsp), and I would code my DispatachAction class as

follows:

import org.apache.struts.action.DispatchAction;

public class LoginUserAction extends DispatchAction {
//have one method named for each possible function name you will be
//passing in the "action" parameter

//invoked when our Action class is called with action=showWarningIfNecessary
public ActionForward showWarningIfNecessary(ActionMapping mapping, 
ActionForm form, HttpServletRequest request, HttpServletResponse response) 
throws Exception
{
   //if the user is already logged in
   //return mappings.findForward("warning");
   //else return mappings.findForward("success");
}

//invoked when our Action class is called with action=continue
public ActionForward continue(ActionMapping mapping, ActionForm form, 
HttpServletRequest request, HttpServletResponse response) throws Exception
{
   return mappings.findForward("success");
}

}

In login.jsp, you would have a hidden form field with a name of "action" and

a value of "showWarningIfNecessary":



In loginWarning.jsp your continue button could just be a link to:
loginUser.do?action=continue (or you could have a hidden field named action 
like in login.jsp, but the value would be "continue")

And your cancel button could be a link to:
login.jsp

If you read the API doc on DispatchAction, this will all make sense.

Hope that helped!

Craig.

>From: "Cohan, Sean" <[EMAIL PROTECTED]>
>Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
>To: 'Struts Users Mailing List' <[EMAIL PROTECTED]>
>Subject: Two Phase ActionClass
>Date: Fri, 6 Sep 2002 20:14:37 -0400
>
>Within my logon ActionClass, I want to check the user's user id/password 
>and
>whether they are currently logged on anywhere else.  If they are logged on
>elsewhere, I want to go back to the logon page to warn them and give them a
>chance to continue or to bail.  If they continue, I want to skip over the
>check whether they are logged on elsewhere.  I'm struggling with how from 
>my
>logon.jsp page I can instruct the logon action to one thing one time and
>another thing another time.  I was thinking maybe the ActionMapping
>parameter, but I don't really know how to use it.  I'm searching.  Can
>someone give me a good way to do what I'm trying to do?  Should I go to a
>different ActionClass instead of trying to use the same one?
>
>Also, I was going to return the warning to the user in ActionErrors.  Is
>there a way I can poll the error from the jsp (logic tag?) and then if it's
>this warning put a yes/no form on the logon page?  Or should I warn them on
>a different page?  I do want other ActionErrors to display without the
>yes/no form (e.g., username required.)  Thanks.
>
>--
>To unsubscribe, e-mail:   
><mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail: 
><mailto:[EMAIL PROTECTED]>
>


Craig W. Tataryn
Programmer/Analyst
Compuware

_
Chat with friends online, try MSN Messenger: http://messenger.msn.com


--
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: Two Phase ActionClass

2002-09-09 Thread Craig Tataryn

No prob, glad to help!

- Original Message -
From: "Cohan, Sean" <[EMAIL PROTECTED]>
To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
Sent: Monday, September 09, 2002 9:11 AM
Subject: RE: Two Phase ActionClass


> Craig, I greatly appreciate you taking the time to provide such a detailed
> answer.  This is a tremendous help.  Thanks.
>

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




RE: Two Phase ActionClass

2002-09-09 Thread Cohan, Sean

Craig, I greatly appreciate you taking the time to provide such a detailed
answer.  This is a tremendous help.  Thanks.

-Original Message-
From: Craig Tataryn [mailto:[EMAIL PROTECTED]]
Sent: Friday, September 06, 2002 11:01 PM
To: [EMAIL PROTECTED]
Subject: Re: Two Phase ActionClass


Sean, not sure if I would recycle the login page to show the warning, 
instead I would have another page called loginWarning.jsp which showed them 
a message and then presented a Continue and Cancel button.  The Continue 
button would send them back to the logon Action class and the Cancel button 
would simply be a link back to the login.jsp page.

However, I would change my Action class to a DispatchAction class and setup 
things like they have in the DispatchAction API doc, in your case, something

like this:



   
   


I would then have two jsps, one for logging in (login.jsp) and then the one 
for warning (loginWarning.jsp), and I would code my DispatachAction class as

follows:

import org.apache.struts.action.DispatchAction;

public class LoginUserAction extends DispatchAction {
//have one method named for each possible function name you will be
//passing in the "action" parameter

//invoked when our Action class is called with action=showWarningIfNecessary
public ActionForward showWarningIfNecessary(ActionMapping mapping, 
ActionForm form, HttpServletRequest request, HttpServletResponse response) 
throws Exception
{
   //if the user is already logged in
   //return mappings.findForward("warning");
   //else return mappings.findForward("success");
}

//invoked when our Action class is called with action=continue
public ActionForward continue(ActionMapping mapping, ActionForm form, 
HttpServletRequest request, HttpServletResponse response) throws Exception
{
   return mappings.findForward("success");
}

}

In login.jsp, you would have a hidden form field with a name of "action" and

a value of "showWarningIfNecessary":



In loginWarning.jsp your continue button could just be a link to:
loginUser.do?action=continue (or you could have a hidden field named action 
like in login.jsp, but the value would be "continue")

And your cancel button could be a link to:
login.jsp

If you read the API doc on DispatchAction, this will all make sense.

Hope that helped!

Craig.

>From: "Cohan, Sean" <[EMAIL PROTECTED]>
>Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
>To: 'Struts Users Mailing List' <[EMAIL PROTECTED]>
>Subject: Two Phase ActionClass
>Date: Fri, 6 Sep 2002 20:14:37 -0400
>
>Within my logon ActionClass, I want to check the user's user id/password 
>and
>whether they are currently logged on anywhere else.  If they are logged on
>elsewhere, I want to go back to the logon page to warn them and give them a
>chance to continue or to bail.  If they continue, I want to skip over the
>check whether they are logged on elsewhere.  I'm struggling with how from 
>my
>logon.jsp page I can instruct the logon action to one thing one time and
>another thing another time.  I was thinking maybe the ActionMapping
>parameter, but I don't really know how to use it.  I'm searching.  Can
>someone give me a good way to do what I'm trying to do?  Should I go to a
>different ActionClass instead of trying to use the same one?
>
>Also, I was going to return the warning to the user in ActionErrors.  Is
>there a way I can poll the error from the jsp (logic tag?) and then if it's
>this warning put a yes/no form on the logon page?  Or should I warn them on
>a different page?  I do want other ActionErrors to display without the
>yes/no form (e.g., username required.)  Thanks.
>
>--
>To unsubscribe, e-mail:   
><mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail: 
><mailto:[EMAIL PROTECTED]>
>


Craig W. Tataryn
Programmer/Analyst
Compuware

_
Chat with friends online, try MSN Messenger: http://messenger.msn.com


--
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: Two Phase ActionClass

2002-09-06 Thread Craig Tataryn

Sean, not sure if I would recycle the login page to show the warning, 
instead I would have another page called loginWarning.jsp which showed them 
a message and then presented a Continue and Cancel button.  The Continue 
button would send them back to the logon Action class and the Cancel button 
would simply be a link back to the login.jsp page.

However, I would change my Action class to a DispatchAction class and setup 
things like they have in the DispatchAction API doc, in your case, something 
like this:



   
   


I would then have two jsps, one for logging in (login.jsp) and then the one 
for warning (loginWarning.jsp), and I would code my DispatachAction class as 
follows:

import org.apache.struts.action.DispatchAction;

public class LoginUserAction extends DispatchAction {
//have one method named for each possible function name you will be
//passing in the "action" parameter

//invoked when our Action class is called with action=showWarningIfNecessary
public ActionForward showWarningIfNecessary(ActionMapping mapping, 
ActionForm form, HttpServletRequest request, HttpServletResponse response) 
throws Exception
{
   //if the user is already logged in
   //return mappings.findForward("warning");
   //else return mappings.findForward("success");
}

//invoked when our Action class is called with action=continue
public ActionForward continue(ActionMapping mapping, ActionForm form, 
HttpServletRequest request, HttpServletResponse response) throws Exception
{
   return mappings.findForward("success");
}

}

In login.jsp, you would have a hidden form field with a name of "action" and 
a value of "showWarningIfNecessary":



In loginWarning.jsp your continue button could just be a link to:
loginUser.do?action=continue (or you could have a hidden field named action 
like in login.jsp, but the value would be "continue")

And your cancel button could be a link to:
login.jsp

If you read the API doc on DispatchAction, this will all make sense.

Hope that helped!

Craig.

>From: "Cohan, Sean" <[EMAIL PROTECTED]>
>Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
>To: 'Struts Users Mailing List' <[EMAIL PROTECTED]>
>Subject: Two Phase ActionClass
>Date: Fri, 6 Sep 2002 20:14:37 -0400
>
>Within my logon ActionClass, I want to check the user's user id/password 
>and
>whether they are currently logged on anywhere else.  If they are logged on
>elsewhere, I want to go back to the logon page to warn them and give them a
>chance to continue or to bail.  If they continue, I want to skip over the
>check whether they are logged on elsewhere.  I'm struggling with how from 
>my
>logon.jsp page I can instruct the logon action to one thing one time and
>another thing another time.  I was thinking maybe the ActionMapping
>parameter, but I don't really know how to use it.  I'm searching.  Can
>someone give me a good way to do what I'm trying to do?  Should I go to a
>different ActionClass instead of trying to use the same one?
>
>Also, I was going to return the warning to the user in ActionErrors.  Is
>there a way I can poll the error from the jsp (logic tag?) and then if it's
>this warning put a yes/no form on the logon page?  Or should I warn them on
>a different page?  I do want other ActionErrors to display without the
>yes/no form (e.g., username required.)  Thanks.
>
>--
>To unsubscribe, e-mail:   
><mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail: 
><mailto:[EMAIL PROTECTED]>
>


Craig W. Tataryn
Programmer/Analyst
Compuware

_
Chat with friends online, try MSN Messenger: http://messenger.msn.com


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




Two Phase ActionClass

2002-09-06 Thread Cohan, Sean

Within my logon ActionClass, I want to check the user's user id/password and
whether they are currently logged on anywhere else.  If they are logged on
elsewhere, I want to go back to the logon page to warn them and give them a
chance to continue or to bail.  If they continue, I want to skip over the
check whether they are logged on elsewhere.  I'm struggling with how from my
logon.jsp page I can instruct the logon action to one thing one time and
another thing another time.  I was thinking maybe the ActionMapping
parameter, but I don't really know how to use it.  I'm searching.  Can
someone give me a good way to do what I'm trying to do?  Should I go to a
different ActionClass instead of trying to use the same one?

Also, I was going to return the warning to the user in ActionErrors.  Is
there a way I can poll the error from the jsp (logic tag?) and then if it's
this warning put a yes/no form on the logon page?  Or should I warn them on
a different page?  I do want other ActionErrors to display without the
yes/no form (e.g., username required.)  Thanks.

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