Re: STRUTS popup action jsp not finding path as normal

2005-02-16 Thread Carlos Cajina
Hi Eric... please see Ted Husted's Struts-Tips #9 & #10 
(http://husted.com/struts/tips/009.html  / 
http://husted.com/struts/tips/010.htm)

I think they might give you a hint... ;^)
Good luck!
 Carlos
- Original Message - 
From: "Eric Lemle" <[EMAIL PROTECTED]>
To: 
Sent: Wednesday, February 16, 2005 1:29 PM
Subject: STRUTS popup action jsp not finding path as normal


I have several jsp's in the same folder.
They all have...

at the top.
but when one is used in a popup via window.open action
it does not find the .js.
I tried other paths and none work.
Where is struts going in this situation as far as a home path?
-Eric
Eric D. Lemle
Senior Programmer / Analyst
Intermountain Health Care
36 South State Street, Suite 1100
Salt Lake City, Utah 84111
United States of America (USA)
(801) 442-3688 -- 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: javascript validation in struts

2005-02-15 Thread Carlos Cajina
Hi Jonathan.
A quick "dissection" of the code you posted might clarify some of your 
doubts..


onsubmit="return validateSigninForm(this)"
* This piece of code calls a dynamically generated JavaScript function 
that's created when the page is rendered (for this to happen you have to 
include  within the JSP containing the 
form.) As you can see, the function name is composed of three parts: 
"validate", which is a default value, + "Signin", which is the name of your 
form and the name specified in the  tag, + "Form", 
which is another default value.

action="signin"
* This is just the Action name that's defined in struts-config.xml for this 
JSP an its associated Form bean.

method="post">
* You also know what this is :^)
The validating JavaScript functions containing the different kinds of 
validation for a given form are generated within the JSP code (although you 
can override this default behavior. See 
http://struts.apache.org/userGuide/struts-html.html#javascript). You should 
check the examples included in the Struts distribution to verify this (view 
source of JSP's after the browser renders'em).

On every submit the JavaScript validation routines are called for every 
field participating in the validation process.

Hope it helps...
Regards,
   Carlos
- Original Message - 
From: "Jonathan M Z" <[EMAIL PROTECTED]>
To: 
Sent: Tuesday, February 15, 2005 5:55 PM
Subject: javascript validation in struts


Hi folks,
I am trying to understand struts validation from some
example code, it has something like this:

validateSigninForm is a javascript validation.  I
looked up in validation.xml and validator-rules,
neither this javascript function nor anything contain
the word "signin" is to be found, so how does struts
do its magic clientside validation? (the jsp itself
obviously does not have this javasription function
either.
thanks!

__
Do you Yahoo!?
The all-new My Yahoo! - Get yours free!
http://my.yahoo.com

-
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 practise for dynamic website Navigation in struts

2005-02-11 Thread Carlos Cajina
Hi Michael.
You should take a look at http://struts-menu.sourceforge.net/ and 
http://demo.raibledesigns.com/struts-menu/dynamicMenu.jsp  It is relatively 
simple to implement/use and works fine in a WebApp.

Cheers,
Carlos
- Original Message - 
From: "Riedling, Michael" <[EMAIL PROTECTED]>
To: 
Sent: Friday, February 11, 2005 3:17 AM
Subject: best practise for dynamic website Navigation in struts

hello
i am searching for a good struts practise, open source, pattern or "ready to 
start tool" to implement a dynamic menu in my website!

At the moment I am catching the relevant data from a database with 
attributes like "nodeId", "name", "parentId", "contentList" with Help from 
Data Object Beans and store all in ArrayLists which i put in the Session. In 
the website i tried with jstl tags and struts logic tags to handle a 
navigation. It works, but its imho not the best way...
But how can i manage this at best in my website menu without using too much 
logic in the view?

Any suggestions?
Thx
Michael
-
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: [UNICODE characters in Mask validation rule]

2005-01-31 Thread Carlos Cajina - Hotmail
I just couldn't resist :^P  ... Tomorrow I'll try it, but for now this looks 
like a "simpler" solution to the character encoding problem:

http://www.servletsuite.com/servlets/encflt.htm

- Original Message - 
From: "Kishore Senji" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" 
Sent: Monday, January 31, 2005 7:47 PM
Subject: Re: [UNICODE characters in Mask validation rule]


Good evening. I'm a little stuck trying to create a global constant in 
validation.xml that allows the mask rule to validate "special" spanish 
characters like Ñ [ UNICODE =  \u00d1 ] for names, surnames, city names 
and so... Can someone give a hint ;^) ? Mi RegExp is like this: 
^[A-Z.Ñ\s]*$
Something like this, I suppose

   
 name
  ^[A-Z.\u00d1\s]*$
 
But make sure you use the right character encoding for the request.
http://marc.theaimsgroup.com/?l=struts-user&m=110484806414499&w=2
should give your more information on character encoding
-
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: [UNICODE characters in Mask validation rule]

2005-01-31 Thread Carlos Cajina - Hotmail
Hi Kishore, thanks for the tip... I tried what you suggested but it didn't 
work... while googling for answers I read somewhere that including UNICODE 
codes was only possible in *.properties files, not in *.XML ... from my 
experience, that seems to be right...

Anyway, I'm going through the thread you pointed... So far it seems the 
Character Encoding Filter is a good solution, but I keep hoping that some 
"simpler" solution is around the corner :^)

Thanks again Kishore... Have a good night!
Regards,
Carlos
- Original Message - 
From: "Kishore Senji" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" 
Sent: Monday, January 31, 2005 7:47 PM
Subject: Re: [UNICODE characters in Mask validation rule]


Good evening. I'm a little stuck trying to create a global constant in 
validation.xml that allows the mask rule to validate "special" spanish 
characters like Ñ [ UNICODE =  \u00d1 ] for names, surnames, city names 
and so... Can someone give a hint ;^) ? Mi RegExp is like this: 
^[A-Z.Ñ\s]*$
Something like this, I suppose

   
 name
  ^[A-Z.\u00d1\s]*$
 
But make sure you use the right character encoding for the request.
http://marc.theaimsgroup.com/?l=struts-user&m=110484806414499&w=2
should give your more information on character encoding
-
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]


[UNICODE characters in Mask validation rule]

2005-01-31 Thread Carlos Cajina
Good evening. I'm a little stuck trying to create a global constant in 
validation.xml that allows the mask rule to validate "special" spanish 
characters like Ñ [ UNICODE =  \u00d1 ] for names, surnames, city names and 
so... Can someone give a hint ;^) ? Mi RegExp is like this: ^[A-Z.Ñ\s]*$

Regards,

Carlos

Re: Best approach to implement date dropdown

2004-12-07 Thread Carlos Cajina
Good mornign Ben...
I've settled for the quick & easy solution: there are lots of JavaScript 
scripts that can handle date selection boxes :^) The thing is I don't know 
much about Velocity :^(

As for the validation, with the Validator Framework (VF) you can validate 
that the dates entered/selected by the user are valid dates (i.e. dates in a 
specific format [pattern]) You can also combine the VF with ValidatorForm's 
validate() method to check date ranges or any other complex date validation.

I'm not shure why you'd want to use a "date bean" in the form of a 
DynaValidatorForm, maybe you could comment more on your intended solution...

Regards,
   Carlos
- Original Message - 
From: "Ben" <[EMAIL PROTECTED]>
To: "Struts" <[EMAIL PROTECTED]>
Sent: Tuesday, December 07, 2004 5:17 AM
Subject: Best approach to implement date dropdown


Hi
I am using Struts with Velocity as a replacement to JSP. I would like
to implement a date drop down list and love to hear your opinions on
the best way to implement it.
I like to have something like these on my ActionForms and use
ValidatorPlugin to validate the data:
[MM] [DD] []
Or
From [MM] [DD] [] to [MM] [DD] []
I am planning to create two DynaValidatorForm: DateForm and
TimePeriodForm. Something like these:
DateForm {
Integer month;
Integer day;
Integer year;
}
TimePeriodForm {
DateForm start = new DateForm();
DateForm end = new DateForm();
}
So in my form, I can call them as timeperiod.start.month,
timeperiod.start.day and timeperiod.start.year, etc...
My concern is how to validate the data and make sure the start date
less than the end date.
I am looking forward to hear from you.
Thanks,
Ben
-
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: Pre-populating a form from a database

2004-12-02 Thread Carlos Cajina
However, I can't get the action to trigger when I go to the form 
initially.
I am a bit lost on this one even though I'm trying to understand these
tutorials.
One of the solutions I've implemented is to create an intermediate action 
that loads data from a database, populates de ActionForm, and directs the 
user to the apropiate JSP.
One way to achive almost "automagically" ActionForm population (and to 
obtain DTO's from ActionForm data) is through Jakarta Commons Beanutils. I'm 
supposed to add a mini-how-to to Commons Wiki but day-time job keeps me busy 
even @ night :^P So here's an extract:

"* Since I'm using Struts in my current J2EE project one of my concerns was 
to find a way to transfer data between the presentation layer and the data 
layer. From the Struts part I have ActionForms and from the data persistence 
part I have Value Objects and CMP Entity Beans.
* According to Ted Husted's "Struts in Action" (2003, Manning) there are 
several strategies to transfer values between tiers. I was using one that 
relies on "factory methods" ("A helper method encapsulates, instantiates, 
and populates a business tier bean."), but including such methods in my 
ActionForms to instantiate, populate, and return a specific value object 
brought along (at least to me) messy code to handle data type conversions 
and validations, moreover, as Ted points it "This strategy binds the 
ActionForm to the business-tier type". Of course there are advantages to 
this approach, but the use of reflection -as I hope you'll see- is a cleaner 
and safer path, and introduces very little overhead.

* For the sake of simplicity in my ActionForms I only have string 
properties -even though users "see" and save String, Date, Integer, Boolean, 
Timestamp, and Float values. Considering that the BeanUtils methods can 
convert data between Strings and native types this seemed like a good 
decision. If you have "exotic" data types,s you'll have to implement "bridge 
methods" to keep data type conversion transparent (I'll show a rather simple 
example later)

Having described some of my scenario, here's what I did:
1. Following commons-beanutils JavaDocs' two-step recipe, I wrote a class 
that implemented the Converter interface. Within this class the convert() 
method should accept theclass that you want to convert to, and a String 
representing the incoming value to be converted. I had to go through this 
first step because from the user perspective dates are handled in dd-mm- 
format but they go into the database as an SQL DATE value, using -mm-dd 
format. To implement the Converter interface I kind of cheated because I 
grabbed commons-beanutils source code and peek into the default 
SqlDateConverter class code (written by Mr. Craig R. McClanahan) What I did 
next was re-implement the convert() method to add code within the try to 
"reverse" the date format, like this:

int year,month,day;
String userDate = (String) value;
year = Integer.parseInt(userDate.substring(6));
month = Integer.parseInt(userDate.substring(3,5));
day = Integer.parseInt(userDate.substring(0,2));
GregorianCalendar dbDate = new GregorianCalendar(year, month-1, day);
Date correctDate = new Date(dbDate.getTimeInMillis());
return (correctDate);
NOTE: there are default converters that use Locale objects, if you need 
something more refined (you can "load" them during App startup an 
define -depending on the constructor you use- the default values to be 
returned)

2. The next step in the recipe is to "register an instance of your converter 
class by calling the ConvertUtils.register() method". It is suggested that 
this be done at application startup time, and since I already had a 
ServletContext Listener I just added the following lines in the 
contextInitialized method:

appContext.log("Registering MyOwnSqlDateConverter...");
ConvertUtils.register(new MyOwnSqlDateConverter(),java.sql.Date.class);
appContext.log("MyOwnSqlDateConverter registered...");
As you can imagine, for every String to java.sql.Date conversion that takes 
place in the application the converter to use will be the one I'm providing 
in step 1 and registering in step 2.

3. Finally, to populate ActionForms and create Value Objects you should add 
some simple methods:

   public void populateFormFromValueObjectData(Object vo) throws Exception
   {
   try {
   BeanUtils.copyProperties(this, vo);
   } catch (Throwable t) {
   throw new PopulateSolicitudDataException(t);
   }
   }
and
   public SomeValueObject getSomeValueObjectFromFormData() throws Exception
   {
   SomeValueObject svo = new SomeValueObject();
   try {
   BeanUtils.copyProperties(svo, this);
   } catch (Throwable t) {
   throw new PopulateSolicitudVOException(t);
   }
   return svo;
   }
In both cases, "this" references the ActionForm. In the first method, 
BeanUtils.copyProperties(this, vo) copy property values from the origin bean 
(vo) to the destination be

Re: ImageButtonBean & LookupDispatchAction

2004-09-30 Thread Carlos Cajina - Hotmail
Hi Ben.

I see that Mike McGrady already pointed you in the right direction :^)
I've tried the solution he proposes with execelent results... if you have
any further questions or doubts I'll be glad to help.

Regards,

Carlos

"Premature optimization is the root of all evil."
Donald E. Knuth
- Original Message - 
From: "Ben" <[EMAIL PROTECTED]>
To: "Struts" <[EMAIL PROTECTED]>
Sent: Wednesday, September 29, 2004 11:58 PM
Subject: ImageButtonBean & LookupDispatchAction


> Hi
>
> Anyone knows any example on how to use ImageButtonBean in
> LookupDispatchAction? Or can someone give me an example
> implementation? Thanks.
>
> Regards,
> Ben
>
> -
> 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: validator-rules.xml

2004-09-28 Thread Carlos Cajina - Hotmail
Anna:

You can dig in any of the struts sample applications (*.war) that are
shipped with the binary distribution of Struts. The "most  pure form" of
this file should be in struts-blank.war

Regards,

Carlos


- Original Message - 
From: "Anna Kerekes" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Tuesday, September 28, 2004 2:00 PM
Subject: validator-rules.xml


Does anyone know where I can get a copy of this file?  In its default form?

thanks,
Anna

-
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: [HOW TO? ImageButtonBeanManager Extension]

2004-09-24 Thread Carlos Cajina - Hotmail
I think I got it Mr. McGrady! I went for the DispatchUtil approach and as
far as I've tested it with a simple-no-validations-yet-three-step wizard
things look promising. I can even "feel" a boost in the page navigation
performance using your solution instead of the ones the Struts Framework
offers (LookupDispatchAction, for instance) I'll move to my "real" project
and post any interesting finds in the next days.

Regarding the page polishing, I could craft a step-by-step tutorial with
sample code (at least for the first two solutions) to add it to the page if
that seems OK with you, I could also look for typos in the current docs to
correct them... as a starting point this is...

I set eyes on your email address and I took the liberty to visit your web
site... Good cat pictures you got there ;^)  I like cats too...

Thanks a lot Mr. McGrady. I really appreciate your help.

I'll keep in touch.

Carlos

- Original Message - 
From: "Michael McGrady" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Friday, September 24, 2004 12:34 PM
Subject: Re: [HOW TO? ImageButtonBeanManager Extension]


> Thanks, Carlos,
>
> The difficulty in getting the page up had rather overshadowed any
> discussion of what they say.  I have quite a lot yet to add to the
> page.  I would indeed appreciate any efforts to assist.  Be my guest.
>
> Michael McGrady
>
> Carlos Cajina - Hotmail wrote:
>
> >I'll sure be waiting for them Mr. McGrady :^)  Thanks for your time! By
the
> >way, I'll be glad to help out with "polishing" the page, if there's
anything
> >I can do please let me know; the solutions proposed are worth the effort
of
> >a good documentation...
> >
> >- Original Message - 
> >From: "Michael McGrady" <[EMAIL PROTECTED]>
> >To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> >Sent: Friday, September 24, 2004 12:17 PM
> >Subject: Re: [HOW TO? ImageButtonBeanManager Extension]
> >
> >
> >
> >
> >>Answers to your other questions to follow in a bit, Carlos.
> >>
> >>Carlos Cajina - Hotmail wrote:
> >>
> >>
> >>
> >>>Good morning.
> >>>
> >>>Thanks to Mr. McGrady for his suggestion. I think the persistent nature
> >>>
> >>>
> >of
> >
> >
> >>>the need to handle multiple (image) buttons in web applications is
> >>>
> >>>
> >precisely
> >
> >
> >>>what makes this problem so recurrent ;^)
> >>>I've moved from the 'ImageButtonBeanManager Extension' approach and
> >>>
> >>>
> >decided
> >
> >
> >>>to try to get SOLUTION TWO up & running but I've ran into a few
problems
> >>>
> >>>
> >and
> >
> >
> >>>thought that maybe you could spare some time to help me out.
> >>>
> >>>Issue #1
> >>>---
> >>>- In the SOLUTON ONE: DispatchUtil Solution Code the 'log' variable
> >>>declaration is as follows: protected static Log log =
> >>>LogFactory.getLog(DispatchUtil.class);
> >>>- In the SOLUTION TWO: (new) DispatchAction Solution Code the 'log'
> >>>
> >>>
> >variable
> >
> >
> >>>declaration is as follows: protected static Log log =
> >>>LogFactory.getLog(SimpleDispatchAction.class);
> >>>* My first question is: In the second 'log' variable declaration, Where
> >>>
> >>>
> >does
> >
> >
> >>>SimpleDispatchAction.class comes from? Shouldn't it read
> >>>DispatchAction.class?
> >>>
> >>>Issue #2
> >>>---
> >>>- I have a class that extends my (new) DispatchAction class. Within
this
> >>>class I have coded the methods that will perform the actions referenced
> >>>
> >>>
> >by
> >
> >
> >>>the  buttons in my forms, i.e.
> >>>public ActionForward [ next | back | finish ] (
> >>> ActionMapping mapping,
> >>> ActionForm form,
> >>> HttpServletRequest request,
> >>> HttpServletResponse response)
> >>> throws Exception
> >>>{ ... }
> >>>- In my JSP forms, every button is defined like this:
> >>> 
> >>>  
> >>>
> >>>  
> >>>  
> >>>
> >>>  
> >>>   
> >>>

Re: [HOW TO? ImageButtonBeanManager Extension]

2004-09-24 Thread Carlos Cajina - Hotmail
I'll sure be waiting for them Mr. McGrady :^)  Thanks for your time! By the
way, I'll be glad to help out with "polishing" the page, if there's anything
I can do please let me know; the solutions proposed are worth the effort of
a good documentation...

- Original Message - 
From: "Michael McGrady" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Friday, September 24, 2004 12:17 PM
Subject: Re: [HOW TO? ImageButtonBeanManager Extension]


> Answers to your other questions to follow in a bit, Carlos.
>
> Carlos Cajina - Hotmail wrote:
>
> >Good morning.
> >
> >Thanks to Mr. McGrady for his suggestion. I think the persistent nature
of
> >the need to handle multiple (image) buttons in web applications is
precisely
> >what makes this problem so recurrent ;^)
> >I've moved from the 'ImageButtonBeanManager Extension' approach and
decided
> >to try to get SOLUTION TWO up & running but I've ran into a few problems
and
> >thought that maybe you could spare some time to help me out.
> >
> >Issue #1
> >---
> >- In the SOLUTON ONE: DispatchUtil Solution Code the 'log' variable
> >declaration is as follows: protected static Log log =
> >LogFactory.getLog(DispatchUtil.class);
> >- In the SOLUTION TWO: (new) DispatchAction Solution Code the 'log'
variable
> >declaration is as follows: protected static Log log =
> >LogFactory.getLog(SimpleDispatchAction.class);
> >* My first question is: In the second 'log' variable declaration, Where
does
> >SimpleDispatchAction.class comes from? Shouldn't it read
> >DispatchAction.class?
> >
> >Issue #2
> >---
> >- I have a class that extends my (new) DispatchAction class. Within this
> >class I have coded the methods that will perform the actions referenced
by
> >the  buttons in my forms, i.e.
> > public ActionForward [ next | back | finish ] (
> >  ActionMapping mapping,
> >  ActionForm form,
> >  HttpServletRequest request,
> >  HttpServletResponse response)
> >  throws Exception
> > { ... }
> >- In my JSP forms, every button is defined like this:
> >  
> >   
> >
> >   
> >   
> >
> >   
> >
> >   
> >
> >   
> >
> >   
> >
> >   
> >
> >   
> >  
> >* My second question is kinda stupid: What's next? I mean, It seems like
I
> >can use struts-config.xml to get things working MappingDispatchAction
style
> >or LookupDispatchAction style, but since the (new) DispatchAction (aka
> >DispatchUtil) takes care of things transparently, What would be the next
> >step to implement SOLUTION TWO?
> >
> >Issue #3
> >---
> >* I don't get what this means :^(  [Section  3.1. Action Class Code to
Use]
> >"In all the following tag uses, you use the Action class code in
> >execute(...) or process(...) as given directly below.
> >  ActionForward = forward = new
> >DispatchUtil().dispatch(this,mapping,form,request,response);"
> >
> >Again, any help would be greatly appreciated.
> >
> >Have a nice day!
> >
> >Regards,
> >
> >Carlos
> >
> >
> >- Original Message - 
> >From: "Michael McGrady" <[EMAIL PROTECTED]>
> >To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> >Sent: Thursday, September 23, 2004 9:00 PM
> >Subject: Re: [HOW TO? ImageButtonBeanManager Extension]
> >
> >
> >
> >
> >>Carlos,
> >>
> >>This solution just adds weight (ImageButtonBean) on top of
> >>(DispatchAction) and combines what are the same solutions really.  I
> >>would suggest you look at what might be improvements to this sort of
> >>suggestion at
> >>http://wiki.apache.org/struts/StrutsCatalogFiveMultipleButtonSolutions .
> >>
> >>Amazing how oftent this comes up.
> >>
> >>Michael McGrady
> >>
> >>Carlos Cajina - Hotmail wrote:
> >>
> >>
> >>
> >>>Hi. I'm tryin' to add this Strust extension to my project and from the
> >>>
> >>>
> >documentation I understand that what I need to do is create my Action
Flow
> >using the SubmitButtonForwardDispatchAction, but after coding my Action
Form
> >and Action classes and setting up struts-config.xml I keep getting this
> >error:
> >
> >
> >>>2004-09-23 19:10:08,062 DEBUG
[org.apache.struts.ac

Re: [HOW TO? ImageButtonBeanManager Extension]

2004-09-24 Thread Carlos Cajina - Hotmail
Good morning.

Thanks to Mr. McGrady for his suggestion. I think the persistent nature of
the need to handle multiple (image) buttons in web applications is precisely
what makes this problem so recurrent ;^)
I've moved from the 'ImageButtonBeanManager Extension' approach and decided
to try to get SOLUTION TWO up & running but I've ran into a few problems and
thought that maybe you could spare some time to help me out.

Issue #1
---
- In the SOLUTON ONE: DispatchUtil Solution Code the 'log' variable
declaration is as follows: protected static Log log =
LogFactory.getLog(DispatchUtil.class);
- In the SOLUTION TWO: (new) DispatchAction Solution Code the 'log' variable
declaration is as follows: protected static Log log =
LogFactory.getLog(SimpleDispatchAction.class);
* My first question is: In the second 'log' variable declaration, Where does
SimpleDispatchAction.class comes from? Shouldn't it read
DispatchAction.class?

Issue #2
---
- I have a class that extends my (new) DispatchAction class. Within this
class I have coded the methods that will perform the actions referenced by
the  buttons in my forms, i.e.
 public ActionForward [ next | back | finish ] (
  ActionMapping mapping,
  ActionForm form,
  HttpServletRequest request,
  HttpServletResponse response)
  throws Exception
 { ... }
- In my JSP forms, every button is defined like this:
  
   

   
   

   

   

   

   

   

   
  
* My second question is kinda stupid: What's next? I mean, It seems like I
can use struts-config.xml to get things working MappingDispatchAction style
or LookupDispatchAction style, but since the (new) DispatchAction (aka
DispatchUtil) takes care of things transparently, What would be the next
step to implement SOLUTION TWO?

Issue #3
---
* I don't get what this means :^(  [Section  3.1. Action Class Code to Use]
"In all the following tag uses, you use the Action class code in
execute(...) or process(...) as given directly below.
  ActionForward = forward = new
DispatchUtil().dispatch(this,mapping,form,request,response);"

Again, any help would be greatly appreciated.

Have a nice day!

Regards,

Carlos


- Original Message - 
From: "Michael McGrady" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Thursday, September 23, 2004 9:00 PM
Subject: Re: [HOW TO? ImageButtonBeanManager Extension]


> Carlos,
>
> This solution just adds weight (ImageButtonBean) on top of
> (DispatchAction) and combines what are the same solutions really.  I
> would suggest you look at what might be improvements to this sort of
> suggestion at
> http://wiki.apache.org/struts/StrutsCatalogFiveMultipleButtonSolutions .
>
> Amazing how oftent this comes up.
>
> Michael McGrady
>
> Carlos Cajina - Hotmail wrote:
>
> >Hi. I'm tryin' to add this Strust extension to my project and from the
documentation I understand that what I need to do is create my Action Flow
using the SubmitButtonForwardDispatchAction, but after coding my Action Form
and Action classes and setting up struts-config.xml I keep getting this
error:
> >
> >2004-09-23 19:10:08,062 DEBUG [org.apache.struts.action.RequestProcessor]
Looking for Action instance for class
com.mitranosoft.struts.actions.SubmitButtonForwardDispatchAction
> >2004-09-23 19:10:08,062 DEBUG [org.apache.struts.action.RequestProcessor]
Creating new Action instance
> >2004-09-23 19:10:08,156 WARN
[com.mitranosoft.struts.actions.SubmitButtonForwardDispatchAction]
SubmitButtonForwardDispatchAction.execute(): Warning - Error encountered and
handled while attempting to locate ActionForward property-name=[ submit ] of
[EMAIL PROTECTED], for Request=[
[EMAIL PROTECTED]/webm/asiste
nte.do,contextPath=/webm,method=POST,queryString=,sessionId=BDCA619715
A1B419D6785F9CAADC7185] ].
> >2004-09-23 19:10:08,156 DEBUG
[com.mitranosoft.struts.util.DefaultActionForwardSelector]
DefaultActionForwardSelector.getActionForward(): Returning a default
ActionForward matching name=[ otherwise ]. ActionForward=[
[EMAIL PROTECTED],path=/index.js
p,redirect=false,contextRelative=false] ], ActionForm=[
[EMAIL PROTECTED] ], for Request=[
[EMAIL PROTECTED]/webm/asiste
nte.do,contextPath=/webm,method=POST,queryString=,sessionId=BDCA619715
A1B419D6785F9CAADC7185] ]
> >2004-09-23 19:10:08,156 WARN
[com.mitranosoft.struts.actions.SubmitButtonForwardDispatchAction]
SubmitButtonForwardDispatchAction.execute(): Warning - A default ActionForm
has been selected or created, ActionForward=[
[EMAIL PROTECTED],path=/index.js
p,redirect=false,contextRelative=false] ], because no property was found for
property-name=[ submit ] of [EMAIL PROTECTED], for
Request=[
[EMAIL PROTECTED]/webm/asiste
nte.do,contextPath=/webm,method=POST,queryString=,sessionId=BDCA619715
A1B419D6785F9CAADC7185] ]
>

[HOW TO? ImageButtonBeanManager Extension]

2004-09-23 Thread Carlos Cajina - Hotmail
Hi. I'm tryin' to add this Strust extension to my project and from the documentation I 
understand that what I need to do is create my Action Flow using the 
SubmitButtonForwardDispatchAction, but after coding my Action Form and Action classes 
and setting up struts-config.xml I keep getting this error:

2004-09-23 19:10:08,062 DEBUG [org.apache.struts.action.RequestProcessor]  Looking for 
Action instance for class 
com.mitranosoft.struts.actions.SubmitButtonForwardDispatchAction
2004-09-23 19:10:08,062 DEBUG [org.apache.struts.action.RequestProcessor]   Creating 
new Action instance
2004-09-23 19:10:08,156 WARN  
[com.mitranosoft.struts.actions.SubmitButtonForwardDispatchAction] 
SubmitButtonForwardDispatchAction.execute(): Warning - Error encountered and handled 
while attempting to locate ActionForward property-name=[ submit ] of [EMAIL 
PROTECTED], for Request=[ [EMAIL 
PROTECTED]/webm/asistente.do,contextPath=/webm,method=POST,queryString=,sessionId=BDCA619715A1B419D6785F9CAADC7185]
 ].
2004-09-23 19:10:08,156 DEBUG 
[com.mitranosoft.struts.util.DefaultActionForwardSelector] 
DefaultActionForwardSelector.getActionForward(): Returning a default ActionForward 
matching name=[ otherwise ]. ActionForward=[ [EMAIL 
PROTECTED],path=/index.jsp,redirect=false,contextRelative=false] ], ActionForm=[ 
[EMAIL PROTECTED] ], for Request=[ [EMAIL 
PROTECTED]/webm/asistente.do,contextPath=/webm,method=POST,queryString=,sessionId=BDCA619715A1B419D6785F9CAADC7185]
 ]
2004-09-23 19:10:08,156 WARN  
[com.mitranosoft.struts.actions.SubmitButtonForwardDispatchAction] 
SubmitButtonForwardDispatchAction.execute(): Warning - A default ActionForm has been 
selected or created, ActionForward=[ [EMAIL 
PROTECTED],path=/index.jsp,redirect=false,contextRelative=false] ], because no 
property was found for property-name=[ submit ] of [EMAIL PROTECTED], for Request=[ 
[EMAIL 
PROTECTED]/webm/asistente.do,contextPath=/webm,method=POST,queryString=,sessionId=BDCA619715A1B419D6785F9CAADC7185]
 ]
2004-09-23 19:10:08,156 DEBUG [org.apache.struts.action.RequestProcessor] 
processForwardConfig(ForwardConfig[name=otherwise,path=/index.jsp,redirect=false])


- In each of JSP's I have this for my buttons except for :


 // Where  could be 'next', 'back', 'finish' 



I understand that the extension -through the SubmitButtonForwardDispatchAction action- 
does the job of automatically mapping a  button to an Action that is 
supposed to process the specific business logic that button encapsulates, acting like 
some kind of hub for every incoming button click in the JSP forms, but I don't know 
whether I am missing something because things just won't work.

It's worth saying that the mapping in the SubmitButtonForwardDispatchAction for a 
'cancel' action works fine, whenever I hit the cancel button in my form I'm redirected 
to the correct location; also the 'otherwise' mapping works good... it's were I'm 
taken to everytime I hit the next button and the errors pops up in the log files :^P

For any help, my eternal gratitude :^)

Have a nice evening.

Regards,

Carlos