Re: best way to build a wizard

2003-07-10 Thread Michael Muller
It turns out that I can't pass the action into the html:form tag using 
tiles; that would involve nesting JSP tags.  Grr.

I guess my only recourse is to have the open html:form tag in the 
inserted body and the close html:form tag in the template.  Ick.

So now I'm trying to figure out a way to have one one action mapping. 
Any ideas?  Or alternative approaches?

  -- Mike

Michael Muller wrote:
My app has a bunch of wizard-style forms.  I have one "NextPageAction" 
Action class, and an separate mapping for each page.  The mappings all 
bind to the same form bean (a DynaValidatorForm) and invoke the 
"NextPageAction".

I was hoping to have only one action mapping, with a whole bunch of 
forwards for "page1", "page2", etc.  The problem that prevents me from 
having one action mapping is validation:  I need the "input" attribute 
to redirect me to the correct wizard screen.

So I went back to having lots of mappings.  No big deal.  Until...

I factored the "next" and "back" buttons into the template.  With those 
buttons, wend the closing "html:form" tag.  Makes sense to move the 
opening "html:form" tag into the template, too, right?  Oops, my action 
is in there.

What do I do?

I could leave the closing tag in the template and the opening tag in the 
inserted body.  Gross.

I could try and pass the action into the template through my tiles-defs. 
 That's kinda kludgy, too.

I'm back to thinking I should have one action mapping.  But I don't know 
how to accomplish this.

Suggestions?

Thanks,

Mike



-
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: best way to build a wizard

2003-07-10 Thread Rodney Paul
Check out the lookupDispatchAction classes.
These classes were designed specifically for Actions which require more
than one execute method (in this instance a method for back and next).
That is what I have used, and is perfect for use when developing wizard applications.

Cheers
Rodney

-Original Message-
From: Michael Muller [mailto:[EMAIL PROTECTED]
Sent: Friday, 11 July 2003 8:41 AM
To: Struts Users Mailing List
Subject: Re: best way to build a wizard



It turns out that I can't pass the action into the html:form tag using 
tiles; that would involve nesting JSP tags.  Grr.

I guess my only recourse is to have the open html:form tag in the 
inserted body and the close html:form tag in the template.  Ick.

So now I'm trying to figure out a way to have one one action mapping. 
Any ideas?  Or alternative approaches?

   -- Mike

Michael Muller wrote:
> 
> My app has a bunch of wizard-style forms.  I have one "NextPageAction" 
> Action class, and an separate mapping for each page.  The mappings all 
> bind to the same form bean (a DynaValidatorForm) and invoke the 
> "NextPageAction".
> 
> I was hoping to have only one action mapping, with a whole bunch of 
> forwards for "page1", "page2", etc.  The problem that prevents me from 
> having one action mapping is validation:  I need the "input" attribute 
> to redirect me to the correct wizard screen.
> 
> So I went back to having lots of mappings.  No big deal.  Until...
> 
> I factored the "next" and "back" buttons into the template.  With those 
> buttons, wend the closing "html:form" tag.  Makes sense to move the 
> opening "html:form" tag into the template, too, right?  Oops, my action 
> is in there.
> 
> What do I do?
> 
> I could leave the closing tag in the template and the opening tag in the 
> inserted body.  Gross.
> 
> I could try and pass the action into the template through my tiles-defs. 
>  That's kinda kludgy, too.
> 
> I'm back to thinking I should have one action mapping.  But I don't know 
> how to accomplish this.
> 
> Suggestions?
> 
> Thanks,
> 
> Mike
> 
> 
> 
> -
> 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: best way to build a wizard

2003-07-10 Thread Michael Muller
I'm not sure that really solves my problem.  What do I put as the 
"input" for this action?  I can't use the same action; whatever 
attribute I used to indicate that I want to move to the next page would 
still be in the system, so validation failures would bring me to the 
next page rather than the same page.

I'm pondering an approach with two actions, a "next page" action which 
has a "same page" action as its input.

  -- Mike

Rodney Paul wrote:

Check out the lookupDispatchAction classes.
These classes were designed specifically for Actions which require more
than one execute method (in this instance a method for back and next).
That is what I have used, and is perfect for use when developing wizard applications.
Cheers
Rodney
-Original Message-
From: Michael Muller [mailto:[EMAIL PROTECTED]
Sent: Friday, 11 July 2003 8:41 AM
To: Struts Users Mailing List
Subject: Re: best way to build a wizard


It turns out that I can't pass the action into the html:form tag using 
tiles; that would involve nesting JSP tags.  Grr.

I guess my only recourse is to have the open html:form tag in the 
inserted body and the close html:form tag in the template.  Ick.

So now I'm trying to figure out a way to have one one action mapping. 
Any ideas?  Or alternative approaches?

   -- Mike

Michael Muller wrote:

My app has a bunch of wizard-style forms.  I have one "NextPageAction" 
Action class, and an separate mapping for each page.  The mappings all 
bind to the same form bean (a DynaValidatorForm) and invoke the 
"NextPageAction".

I was hoping to have only one action mapping, with a whole bunch of 
forwards for "page1", "page2", etc.  The problem that prevents me from 
having one action mapping is validation:  I need the "input" attribute 
to redirect me to the correct wizard screen.

So I went back to having lots of mappings.  No big deal.  Until...

I factored the "next" and "back" buttons into the template.  With those 
buttons, wend the closing "html:form" tag.  Makes sense to move the 
opening "html:form" tag into the template, too, right?  Oops, my action 
is in there.

What do I do?

I could leave the closing tag in the template and the opening tag in the 
inserted body.  Gross.

I could try and pass the action into the template through my tiles-defs. 
That's kinda kludgy, too.

I'm back to thinking I should have one action mapping.  But I don't know 
how to accomplish this.

Suggestions?

Thanks,

Mike



-
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]




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


RE: best way to build a wizard

2003-07-10 Thread Rodney Paul
Well with the LookupDispatchAction class you can name a parameter to be used 
to determine what method to execute. In this instance The "Next" and "Previous" 
buttons would point to a same parameter to be used.

eg.













Now the code in the LookupDispatchAction class would look something like this:

public class MyAction extends LookupDispatchAction {
protected java.util.Map getKeyMethodMap() {
Map map = new HashMap();
map.put("button.previous", "previous");
map.put("button.next", "next");
return map;
}

public ActionForward previous(ActionMapping mapping, ActionForm form,
  HttpServletRequest request, HttpServletResponse 
response)
  throws IOException, ServletException {
String target = "previous";
...
return (ActionForward)mapping.findForward(target);
}

public ActionForward next(ActionMapping mapping, ActionForm form,
  HttpServletRequest request, HttpServletResponse response)
  throws IOException, ServletException {
String target = "next";
...
return (ActionForward)mapping.findForward(target);
}


So both submit buttons would go to the next page, and within that action you would
transfer control to the previous or next pages.


Cheers
Rodney


-Original Message-
From: Michael Muller [mailto:[EMAIL PROTECTED]
Sent: Friday, 11 July 2003 9:41 AM
To: Struts Users Mailing List
Subject: Re: best way to build a wizard



I'm not sure that really solves my problem.  What do I put as the 
"input" for this action?  I can't use the same action; whatever 
attribute I used to indicate that I want to move to the next page would 
still be in the system, so validation failures would bring me to the 
next page rather than the same page.

I'm pondering an approach with two actions, a "next page" action which 
has a "same page" action as its input.

   -- Mike

Rodney Paul wrote:

> Check out the lookupDispatchAction classes.
> These classes were designed specifically for Actions which require more
> than one execute method (in this instance a method for back and next).
> That is what I have used, and is perfect for use when developing wizard applications.
> 
> Cheers
> Rodney
> 
> -Original Message-
> From: Michael Muller [mailto:[EMAIL PROTECTED]
> Sent: Friday, 11 July 2003 8:41 AM
> To: Struts Users Mailing List
> Subject: Re: best way to build a wizard
> 
> 
> 
> It turns out that I can't pass the action into the html:form tag using 
> tiles; that would involve nesting JSP tags.  Grr.
> 
> I guess my only recourse is to have the open html:form tag in the 
> inserted body and the close html:form tag in the template.  Ick.
> 
> So now I'm trying to figure out a way to have one one action mapping. 
> Any ideas?  Or alternative approaches?
> 
>-- Mike
> 
> Michael Muller wrote:
> 
>>My app has a bunch of wizard-style forms.  I have one "NextPageAction" 
>>Action class, and an separate mapping for each page.  The mappings all 
>>bind to the same form bean (a DynaValidatorForm) and invoke the 
>>"NextPageAction".
>>
>>I was hoping to have only one action mapping, with a whole bunch of 
>>forwards for "page1", "page2", etc.  The problem that prevents me from 
>>having one action mapping is validation:  I need the "input" attribute 
>>to redirect me to the correct wizard screen.
>>
>>So I went back to having lots of mappings.  No big deal.  Until...
>>
>>I factored the "next" and "back" buttons into the template.  With those 
>>buttons, wend the closing "html:form" tag.  Makes sense to move the 
>>opening "html:form" tag into the template, too, right?  Oops, my action 
>>is in there.
>>
>>What do I do?
>>
>>I could leave the closing tag in the template and the opening tag in the 
>>inserted body.  Gross.
>>
>>I could try and pass the action into the template through my tiles-defs. 
>> That's kinda kludgy, too.
>>
>>I'm back to thinking I should have one action mapping.  But I don't know 
>>how to accomplish this.
>>
>>Suggestions?
>>
>>Thanks,
>>
>>Mike
>>
>>
>>
>>-
>>To unsubscribe, e-mail: [EMAIL PROTECTED]
>>For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 
> 
> 
> ---

Re: best way to build a wizard

2003-07-11 Thread Sandeep Takhar
Personally I don't think there is anything wrong with
having multiple mappings.  You are doing the right
thing by mapping to the same action and form.  The jsp
can define the action individually.  

After reading Ted's book I think of mappings and
actions as just presentation layer components that
help with presentation layer flow, but shouldn't
really care about accessing the business logic.

It is difficult to explain, but I think it has taken
me a 1.5 years of experience with Struts and
re-reading the book to finally grasp the significance
of what he is saying.  Quite profound actually and I'm
not just kissing ***.

Hopefully I am not spilling the beans on everything in
the book, but I highly recommend it for any architect.

So in that sense- Have as many mappings as you like. 
Ideally these mappings should not be tied to any
business logic.  So for example if you call one
mapping - you are calling it for the presentation
component that you will present as well as the
possible paths of success or failure.  You should not
be calling it because you know that it has some
business logic that you want to execute.

sandeep
--- Michael Muller <[EMAIL PROTECTED]> wrote:
> 
> It turns out that I can't pass the action into the
> html:form tag using 
> tiles; that would involve nesting JSP tags.  Grr.
> 
> I guess my only recourse is to have the open
> html:form tag in the 
> inserted body and the close html:form tag in the
> template.  Ick.
> 
> So now I'm trying to figure out a way to have one
> one action mapping. 
> Any ideas?  Or alternative approaches?
> 
>-- Mike
> 
> Michael Muller wrote:
> > 
> > My app has a bunch of wizard-style forms.  I have
> one "NextPageAction" 
> > Action class, and an separate mapping for each
> page.  The mappings all 
> > bind to the same form bean (a DynaValidatorForm)
> and invoke the 
> > "NextPageAction".
> > 
> > I was hoping to have only one action mapping, with
> a whole bunch of 
> > forwards for "page1", "page2", etc.  The problem
> that prevents me from 
> > having one action mapping is validation:  I need
> the "input" attribute 
> > to redirect me to the correct wizard screen.
> > 
> > So I went back to having lots of mappings.  No big
> deal.  Until...
> > 
> > I factored the "next" and "back" buttons into the
> template.  With those 
> > buttons, wend the closing "html:form" tag.  Makes
> sense to move the 
> > opening "html:form" tag into the template, too,
> right?  Oops, my action 
> > is in there.
> > 
> > What do I do?
> > 
> > I could leave the closing tag in the template and
> the opening tag in the 
> > inserted body.  Gross.
> > 
> > I could try and pass the action into the template
> through my tiles-defs. 
> >  That's kinda kludgy, too.
> > 
> > I'm back to thinking I should have one action
> mapping.  But I don't know 
> > how to accomplish this.
> > 
> > Suggestions?
> > 
> > Thanks,
> > 
> > Mike
> > 
> > 
> > 
> >
>
-
> > 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]
> 


__
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

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



RE: best way to build a wizard

2003-07-11 Thread Mathew, Manoj
I have a method which dynamically create my current form .I used this when i had one 
action on multiple forms and i gave only one mapping for the action and didn't give 
form name in the mapping.






public static ActionForm createActionForm(HttpServletRequest request, ActionMapping 
mapping, String name)throws 
// name = "frm name"
javax.servlet.ServletException {

FormBeanConfig config = mapping.getModuleConfig().findFormBeanConfig(name);
if (config == null) {
return (null);
}

ActionForm instance = null;
HttpSession session = null;
 
instance = (ActionForm) request.getAttribute(name);
if (instance == null){
//session = request.getSession();
instance = (ActionForm) request.getSession().getAttribute(name);
}

// Create and return a new form bean instance 
if (instance == null){
if (config.getDynamic()) {
try {
DynaActionFormClass dynaClass = 
DynaActionFormClass.createDynaActionFormClass(config);
instance = (ActionForm) dynaClass.newInstance();
} catch (Throwable t) {
return (null);
}
} 
else {
try {
instance = (ActionForm) 
org.apache.struts.util.RequestUtils.applicationInstance(config.getType());

 } catch (Throwable t) {
return (null);
}
}

}
RequestUtils.populate(instance, null, null,
  request);
 return (instance);

}

-Original Message-
From: Sandeep Takhar [mailto:[EMAIL PROTECTED]
Sent: Friday, July 11, 2003 8:45 AM
To: Struts Users Mailing List
Subject: Re: best way to build a wizard


Personally I don't think there is anything wrong with
having multiple mappings.  You are doing the right
thing by mapping to the same action and form.  The jsp
can define the action individually.  

After reading Ted's book I think of mappings and
actions as just presentation layer components that
help with presentation layer flow, but shouldn't
really care about accessing the business logic.

It is difficult to explain, but I think it has taken
me a 1.5 years of experience with Struts and
re-reading the book to finally grasp the significance
of what he is saying.  Quite profound actually and I'm
not just kissing ***.

Hopefully I am not spilling the beans on everything in
the book, but I highly recommend it for any architect.

So in that sense- Have as many mappings as you like. 
Ideally these mappings should not be tied to any
business logic.  So for example if you call one
mapping - you are calling it for the presentation
component that you will present as well as the
possible paths of success or failure.  You should not
be calling it because you know that it has some
business logic that you want to execute.

sandeep
--- Michael Muller <[EMAIL PROTECTED]> wrote:
> 
> It turns out that I can't pass the action into the
> html:form tag using 
> tiles; that would involve nesting JSP tags.  Grr.
> 
> I guess my only recourse is to have the open
> html:form tag in the 
> inserted body and the close html:form tag in the
> template.  Ick.
> 
> So now I'm trying to figure out a way to have one
> one action mapping. 
> Any ideas?  Or alternative approaches?
> 
>-- Mike
> 
> Michael Muller wrote:
> > 
> > My app has a bunch of wizard-style forms.  I have
> one "NextPageAction" 
> > Action class, and an separate mapping for each
> page.  The mappings all 
> > bind to the same form bean (a DynaValidatorForm)
> and invoke the 
> > "NextPageAction".
> > 
> > I was hoping to have only one action mapping, with
> a whole bunch of 
> > forwards for "page1", "page2", etc.  The problem
> that prevents me from 
> > having one action mapping is validation:  I need
> the "input" attribute 
> > to redirect me to the correct wizard screen.
> > 
> > So I went back to having lots of mappings.  No big
> deal.  Until...
> > 
> > I factored the "next" and "back" buttons into the
> template.  With those 
> > buttons, wend the closing "html:form" tag.  Makes
> sense to move the 
> > opening "html:form" tag into the template, too,
> right?  Oops, my action 
> > is in there.
> > 
> > What do I do?
> > 
> > I could leave the closing tag in the template and
> the opening tag in the 
> > inserted body.  Gross.
> > 
> > I could try and pass the action into the template
> through my tiles-defs. 
> >  That