Proper way to do it

2005-03-18 Thread Hond4
Hallo list members!
I'm looking for best practise how to implement password change for my 
appliaction.
I'm using securityfilter for auth, problem is that i would like to 
create forward to password change page if user password == "default".
Is it possible to put some logic into ActionServlet's service() to check 
is user password == "default" and then forward to PasswordChange action? 
I know that I can crete base action (with passowrd check logic) for all 
action's but i think there should be more proper way to solve my problem.

Thanks for help,
H0nd4
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Free Struts ebook

2005-03-18 Thread Srikanth Shenoy
Hi All,

Back in 2003, I wrote the book "Struts Survival Guide - Basics to Best
Practices" and subsequently published it.
The book was wildly successful and I sold off all the copies of the book.
I don't have any intention of reprinting it.

Hence I am giving away the ebook in PDF format free of cost. (And yes the
PDF is printable :-D)
Grab the ebook and other Struts goodies from http://www.objectsource.com

Cheers,
Srikanth Shenoy




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



Relative URLs

2005-03-18 Thread tarek.nabil
Hi everyone,

Can someone please explain how to build relative URLs that are higher in
the file hierarchy than the module. For example

/
/images/some-image.gif
/some-action.do
/folder/some-jsp.jsp

I'm building this application inside an existing application that does
not use Struts. I can not change the location of images or stylesheet
and I can not duplicate them. I get the HTMLs from the graphic designer
with the stylesheets and images as relative URLs, e.g.
../images/some-image.gif.

I thought that for the images, I can solve it with the html:img tag, but
then I discovered that I have some td tags with an image background.

I thought about URL re-writing, and then I found out I only have two
options:
1- Specify a forward for every image which is time consuming and
tedious.
2- Use the page attribute, which means that the module has to be on the
same level as the images, because the documentation states that the page
attribute has to start with a "/".

In my application, I go to the JSP directly and then through an action.
Since they're both on different levels, when I go through the action,
the images disappear. I thought about going to the JSP through an action
all the time, but I then I thought I could still face a problem if I
ever decide to switch to multiple modules.

For example, in the above setup, I would use the page attribute and
write page=3D"/images/some-image.gif". But then if I ever decide to use
multiple modules and moved my action to /some-module/some-action.do I
will not be able to change the page attribute because I can NOT say (as
far as I understand) page=3D"../images/some-image.gif".

Can someone please help me with this problem.

Thanks,
Tarek

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



Re: Multiple ActionForms per ActionMapping

2005-03-18 Thread Vamsee Kanakala
Joe Germuska wrote:
I don't know if we've all landed on most people's kill-filters or 
what, but one gets the sense that what some of us are interested in 
arguing thoroughly about is of little import to regular users.

I'm as 'regular' a user as you can get, but I thoroughly enjoy these 
technical discussions. For me, it's very educational. I don't understand 
everything, but  I feel really happy when I do. To use a cliche, I can 
"stand on the shoulders of giants". I might not go and start playing 
with 1.3 right now, but one of these days, I will muster enough courage 
to do so. Please do whatever you're doing, it's working ;)

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


Re: what do you suggest me? iBatis or Hibernate

2005-03-18 Thread Tak Yoshida
Oops, sorry third one is usually not happend, so could be out of selection.
What about first tow?
I did couple of enterprise application,
which consists of Web front end, and many backend programs in both PL/SQL and 
java.
The same SQLs must be appplied for different events from both front end and 
backend.
I'm really comfortable with sharing same SQL statement in SQLMap and PL/SQL.
and I just don't know how I can do this with Hibernate?

Tak

Diego Espada wrote in <[EMAIL PROTECTED]>
>I disagree with you in some of those points.
>
>If you don't know SQL, don't go with Hibernate.
>You'll have terrible performance problems if you do so. Hibernate has
>very complete features to tweak performance and optimize queries, and
>to make use of that you have to know SQL.
>
>I don't know iBATIS, so i don't know what advantages has over
>Hibernate. But i can tell you that I've used Hibernate in an
>enterprise application that was running previously on a commercial
>J2EE application server with CMS with 80 users constantly beating the
>Database, and the performance gains where impressive.
>
>For the other part, if you don't know SQL, I wouldn't recommend that
>you use the domain model pattern... It would be too dangerous. I would
>use transactions scripts with JDBC, let a DBA design the database and
>that's it.
>
>Bye !!!
>
>
>On Fri, 18 Mar 2005 21:54:28 -0500, Tak Yoshida
><[EMAIL PROTECTED]> wrote:
>> I think,
>> 
>> If you don't have to work with DBA to tune up your application's SQL
>> or
>> if you don't have to work with or share SQLs to any backend PL/SQL programmer
>> or
>> you don't know SQL very much
>> The answer could be Hibernate.
>> 
>> If yes, as usual enterprise applications, iBATIS could be the answer.
>> 
>> Tak
>> 
>> Milson Cardona wrote in <[EMAIL PROTECTED]>
>> >Hi
>> >
>> >I am novice in J2EE.
>> >
>> >I have been working with JDBC (SQL statements within of business
>> >class), but now desire to work with persitence objects.
>> >
>> >I know that this are different, Hibernate is then biggest, but iBatis
>> >have a knowledge curve very short
>> >
>> >what do you suggest me?  iBatis or Hibernate.
>> >
>> >thanks
>> >
>> >-
>> >To unsubscribe, e-mail: [EMAIL PROTECTED]
>> >For additional commands, e-mail: [EMAIL PROTECTED]
>> 
>> --
>> Tak Yoshida mailto:[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]

-- 
Tak Yoshida mailto:[EMAIL PROTECTED]

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



Re: what do you suggest me? iBatis or Hibernate

2005-03-18 Thread David Haynes
Hibernate uses the database as a reliable data store for serialized 
objects. It does not exploit the higher level capabilities of the 
database to assist with referential integrity or the benefits of a more 
normalized form. (At least it looks that way in examining the results of 
its UML to data schema translations.)

If that is sufficient for your needs it should be OK. If you need any of 
these higher level functions or want to access the database efficiently 
through alternate means (e.g. ETL to DSS stores) this may present an issue.

-david-
Tak Yoshida wrote:
I think,
If you don't have to work with DBA to tune up your application's SQL
or
if you don't have to work with or share SQLs to any backend PL/SQL programmer
or
you don't know SQL very much
The answer could be Hibernate.
If yes, as usual enterprise applications, iBATIS could be the answer.
Tak
Milson Cardona wrote in <[EMAIL PROTECTED]>
 

Hi
I am novice in J2EE.
I have been working with JDBC (SQL statements within of business
class), but now desire to work with persitence objects.
I know that this are different, Hibernate is then biggest, but iBatis
have a knowledge curve very short
what do you suggest me?  iBatis or Hibernate.
thanks
-
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: what do you suggest me? iBatis or Hibernate

2005-03-18 Thread Diego Espada
I disagree with you in some of those points.

If you don't know SQL, don't go with Hibernate.
You'll have terrible performance problems if you do so. Hibernate has
very complete features to tweak performance and optimize queries, and
to make use of that you have to know SQL.

I don't know iBATIS, so i don't know what advantages has over
Hibernate. But i can tell you that I've used Hibernate in an
enterprise application that was running previously on a commercial
J2EE application server with CMS with 80 users constantly beating the
Database, and the performance gains where impressive.

For the other part, if you don't know SQL, I wouldn't recommend that
you use the domain model pattern... It would be too dangerous. I would
use transactions scripts with JDBC, let a DBA design the database and
that's it.

Bye !!!


On Fri, 18 Mar 2005 21:54:28 -0500, Tak Yoshida
<[EMAIL PROTECTED]> wrote:
> I think,
> 
> If you don't have to work with DBA to tune up your application's SQL
> or
> if you don't have to work with or share SQLs to any backend PL/SQL programmer
> or
> you don't know SQL very much
> The answer could be Hibernate.
> 
> If yes, as usual enterprise applications, iBATIS could be the answer.
> 
> Tak
> 
> Milson Cardona wrote in <[EMAIL PROTECTED]>
> >Hi
> >
> >I am novice in J2EE.
> >
> >I have been working with JDBC (SQL statements within of business
> >class), but now desire to work with persitence objects.
> >
> >I know that this are different, Hibernate is then biggest, but iBatis
> >have a knowledge curve very short
> >
> >what do you suggest me?  iBatis or Hibernate.
> >
> >thanks
> >
> >-
> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >For additional commands, e-mail: [EMAIL PROTECTED]
> 
> --
> Tak Yoshida mailto:[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: Wouldn't validation be better performed by Actions rather than ActionForms?

2005-03-18 Thread Dakota Jack
I for one am more than interested in honest, informed, opinion such as
yours, David.  Thanks!  To be fair, Struts presently is in a bit of a
transition with things a bit in the air.  On the one hand, the
origional architect is hired on another competing project and is
trying to pull a heist on the name (keep smiling, Craig ///;-)),
evenyone has gone a bit over-ga-ga about using Chain/Command to solve
a problem self-created by using the Template Method pattern in writing
a composable RequestProcessor, etc.  But, I think this is a really
creative time around here and that much good is bound to come of it. 
Ted will tell you that only code matters.  But, I think some things
other than just code matter to some of the people involved.  Glad to
hear your voice.

Jack


On Sat, 19 Mar 2005 02:01:28 +, David Kennedy
<[EMAIL PROTECTED]> wrote:
> Sorry, this is going to be a fairly off-topic reaction post, but
> Lawrie's comments struck a chord with me.
> 
> Lawrie Gallardo wrote:
> > I'm relatively new to Struts and I have to say that I've found it to
> > have a realtively steep learning curve. And the only reason for this is
> > that there are so many different ways to do things and no definitive
> > best ways of achieving anything.
> 
> I totally agree. I have just transitioned to the web tier from a career
> slaving away at the back-end of large Java server systems for telecomms
> and finance. I was looking forward to using Struts quite a bit,
> suspecting, perhaps wrongly, that the nature of web tier work would mean
> a fast evolution of high-quality tools. Maybe I've been spoilt by a life
> dominated by strict (read: paranoid) coding practices, Ant and JUnit,
> but Struts is rather a confusing mess once past the initial "Oh, cool, a
> working action and page!" phase. And this is coming from someone who has
> just fled EJB land...
> 
> For example, I've got a couple of Really Common Requirements - logon and
> a side nav bar / tree view. I've been amazed that I've not found a
> simple, standard example for either of these. Instead, I've tripped over
> a wealth of little fiddly details that derailed my progress. Nothing
> like lots of soft XML config to really trip you up with details I
> find... "I've never even heard of that option, and when I tried to use
> it I wasted 5 hours not noticing a typo in one of the repeated strings!"
> 
> > I'd much rather there was a bit
> > of focus to the framework than the mass of competing options. "Make the
> > simple things simple and the hard things possible" and all that...
> 
> Totally agree. For example, I did some work with Struts Layout:Treeview
> for my nav bar prototype. I very much appreciate volunteer effort, and
> don't wish to knock anyone's efforts, but I have to say that for a
> standard solution advocated by a couple of books it's fairly poor...
> There were a couple of immediate show-stoppers with working with the
> Treeview which was very disappointing. (Turns out the license precludes
> commercial use anyway.) The point of this isn't to knock Layout (again,
> I appreciate effort and feel guilty that I don't pay back into the
> commnunity that makes me fine tools), but rather to illustrate how
> something fairly standard - a treeview nav bar with a load of
> actions/forwards - is surprisingly difficult for a beginner with the
> toolkit to knock up cleanly.
> 
> I guess some of this cognitive whiplash comes from the fact that several
> of the core components are Very Cool. The core idea of the actions is
> just Very Sensible, the basic idea of using ResourceBundle keys
> everywhere Just Works, etc. I particularly like Validator, although I
> can see, as this thread is discussing, room for disagreement about
> alternative implementations. Custom rules are very nice, and very easily
> added. I'm just troubled by the fact that most of the elements I find
> straightforward and cleanly finished are those which my boss just
> doesn't see! The basic project elements he wants in a couple of days -
> that tree view in a readable/maintainable form, a nice simple PAM login
> & timeout mechanism* - turn into real timesinks. (Actually, to be fair,
> the move from 1.0 -> 1.1 and similar shifts in several libaries also led
> to confusion when working from Googled, and often conflicting, advice.)
> 
> This is a rather rude rant I know, and I appreciate people are
> scratching their own itches, but it would be nice to seem some concerted
> effort to solve some of the FAQs cleanly, and to generate more of a core
> catalogue of Patterns for noobs like myself. (Kudos to people like Ted
> Husted who do maintain some useful resources.) In that vein, I'm very
> much looking forwards to the new Struts Cookbook that O'Reilly have just
> put out, was rather hoping to see it in the post this morning. Might
> well answer lots of questions for me.
> 
> I'm not sure I should hit 'Send' on this for fear of offending people,
> please just see this as constructive initial impression feed

Re: what do you suggest me? iBatis or Hibernate

2005-03-18 Thread Tak Yoshida
I think,

If you don't have to work with DBA to tune up your application's SQL
or
if you don't have to work with or share SQLs to any backend PL/SQL programmer
or
you don't know SQL very much
The answer could be Hibernate.

If yes, as usual enterprise applications, iBATIS could be the answer.

Tak

Milson Cardona wrote in <[EMAIL PROTECTED]>
>Hi
>
>I am novice in J2EE.
>
>I have been working with JDBC (SQL statements within of business
>class), but now desire to work with persitence objects.
>
>I know that this are different, Hibernate is then biggest, but iBatis
>have a knowledge curve very short
>
>what do you suggest me?  iBatis or Hibernate.
>
>thanks
>
>-
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]

-- 
Tak Yoshida mailto:[EMAIL PROTECTED]

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



Re: Wouldn't validation be better performed by Actions rather than ActionForms?

2005-03-18 Thread Dakota Jack
The thing, for me, Frank, is that I like to reuse code as much as
possible.  So, I treat most aspects of coding in Struts not unlike
coding an application which is good for any environment, and any
framework.  This is also true of validation for me.  I don't want to
be tied to any particular solution, and that is why I am constantly
harping when someone ties things needed for an application to Struts,
such as some of the multipart processing stuff, the
LoookupDispatchAction, etc.  That is also why I vastly prefer that
framework problems, like the recently discussed multiple forms per
action discussion, be solved strictly by the framework without
necessitating further code.  That is an advantage of the way you
suggested as well.  The flexibility of chain is, I think, overrated in
relation to other alternatives, but I am also concerned that allowing
us to solve certain problems might in time come to require us to do
it, and that is not framework good, I think.

A framework should define what it will do for you and then get out of the way.

Jack


On Fri, 18 Mar 2005 17:58:27 -0500, Frank W. Zammetti
<[EMAIL PROTECTED]> wrote:
> Interesting approach Jack.  It seems like a somewhat unnecassery layer
> though... But then again, as with all architectural decisions, if you
> had a reason for it, then it's a good solution (unless it's a bad
> solution! :) )
> 
> I suppose it comes down to what is actually in an Action... If it is
> absolutely ideal (i.e., copy ActionForm to VO, pass VO to business
> delegate, all of, what, 3-5 lines of code??), then a DispatchAction
> doesn't bother me QUITE as much as it otherwise would.
> 
> It's interesting to me... the idea of the chain implementation is to
> allow easy swapping of commands anywhere in the chain... Isn't having
> individual Actions for everything in a non-chain environment really akin
> to that?  If I have a DispatchAction with 10 functions in it, even if
> they are small and simple, isn't it a little harder then to change the
> flow of an application?
> 
> Besides, for the instances where you have a team development environment
> and the Actions maybe do just a little more than they should (not
> uncommon in my experience), it's easier if three developers can check
> out three different class that has one discrete function rather than all
> three of them needing to check out the same class at the same time.
> Reduces serialization of the development process.  Honestly, I've only
> very rarely been in such a situation myself, so I don't want to make it
> sound like this is some huge problem with DispatchActions.  It's not.
> 
> Frank
> 
> Dakota Jack wrote:
> > You don't have to have a large file.  I use the dispatching to
> > organize in a sort of "controller" fashion delegating processing to
> > other files.  I do this when I have an AdministrativeAction, for
> > example.  I use separate classes not unlike the way you use
> > instantiations of Action subclasses in your model.  The difference is
> > merely that I use non-Actions, as follows:
> >
> >
> >   public ActionForward execute(ActionMapping mapping,
> >ActionForm form,
> >HttpServletRequest request,
> >HttpServletResponse response)
> >   throws IOException,
> >  ServletException {
> >
> > ActionForward forward= null;
> >
> > try {
> >   forward = method(this,mapping,form,request,response);
> > } catch (Exception e) { }
> >
> > return forward;
> >   }
> >
> >   public ActionForward guestApplicationExit (ActionMapping mapping,
> >  ActionForm form,
> >  HttpServletRequest request,
> >  HttpServletResponse response) throws IOException, ServletException {
> >  return new
> >  
> > AdminActionGuestApplicationExit().execute(mapping,form,request,response);
> > }
> >
> > [many methods calling classes left out here.
> >
> >   public ActionForward webmasterView (ActionMapping mapping,
> >   ActionForm form,
> >   HttpServletRequest request,
> >   HttpServletResponse response) throws IOException, ServletException {
> >   return new
> >   
> > AdminActionWebmasterView().execute(mapping,form,request,response);
> > }
> > }
> >
> >
> > On Fri, 18 Mar 2005 13:21:18 -0500 (EST), Frank W. Zammetti
> > <[EMAIL PROTECTED]> wrote:
> >
> >>I've always felt that class sizes should be reduced wherever possible.
> >>Even when the code is extremely simplistic, as should be the case in
> >>Actions generally, it's still more difficult to look through a higher
> >>volume of code (this is in fact a known metric that most code analysis
> >>tools use).  DispatchActions and their bretherin seem to fly in the face
> >>of this idea.  I don't mean to imply they are bad in every case, certainly
> >>not, but I personally find them to be a bit overused.
> >>
> >>I only mentioned it because of the comment by the O

Re: help needed on ActionForm and ActionForward behaviour

2005-03-18 Thread Diego Espada
Did you check the scope configuration parameter ?
Bye


On Fri, 18 Mar 2005 16:21:23 +0100, Gaet <[EMAIL PROTECTED]> wrote:
> In other words, I would like to implemnt a button "Save and display next
> employee"
> 
> How to do this?
> 
> 
> - Original Message -
> From: "Gaet" <[EMAIL PROTECTED]>
> To: "Mailing List Struts" 
> Sent: Friday, March 18, 2005 10:06 AM
> Subject: help needed on ActionForm and ActionForward behaviour
> 
> Hi,
> 
> I have a DispatchAction class, that I use to handle the employee information
> Edit.
> On my jsp page, I have two button, on to validate the updates and forward
> back to the employee list => that works great.
> On the other button, I want to validate the updates and display the next
> employeeI could'nt make it work :o(
> 
> When my JSP page is refreshed after a click on this buttoon, the problem is
> that when the form displayed contains the information of the employee we
> have validatedbut the form in my action class contains the information
> of the next employeewhy this behaviour?
> 
> Many thanks for your help since I'm on this problem for 2 days now! it looks
> me crazy...
> 
> -
> 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: html: tags part2

2005-03-18 Thread Diego Espada
You could just use

 wrote:
> Scott Purcell wrote the following on 3/18/2005 1:29 PM:
> 
> > Can I create a image that is a src for a submit, or cancel, or js function?
> 
> Why not just use a regular image wrapped with an href and use javascript?
> 
> example...
> 
> 
>
> 
> 
> --
> Rick
> 
> -
> 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: Wouldn't validation be better performed by Actions rather than ActionForms?

2005-03-18 Thread Diego Espada
I do all my validations in the action, and it works great for me. I
built a layer upon the action that allows me to activate / deactivate
validation for some actions. So i turned my actions into page
controllers.

I suppose some people would argue that this "resists" the framework,
but i think that i'm so comfortable working like that !!

bye


On Sat, 19 Mar 2005 02:01:28 +, David Kennedy
<[EMAIL PROTECTED]> wrote:
> Sorry, this is going to be a fairly off-topic reaction post, but
> Lawrie's comments struck a chord with me.
> 
> Lawrie Gallardo wrote:
> > I'm relatively new to Struts and I have to say that I've found it to
> > have a realtively steep learning curve. And the only reason for this is
> > that there are so many different ways to do things and no definitive
> > best ways of achieving anything.
> 
> I totally agree. I have just transitioned to the web tier from a career
> slaving away at the back-end of large Java server systems for telecomms
> and finance. I was looking forward to using Struts quite a bit,
> suspecting, perhaps wrongly, that the nature of web tier work would mean
> a fast evolution of high-quality tools. Maybe I've been spoilt by a life
> dominated by strict (read: paranoid) coding practices, Ant and JUnit,
> but Struts is rather a confusing mess once past the initial "Oh, cool, a
> working action and page!" phase. And this is coming from someone who has
> just fled EJB land...
> 
> For example, I've got a couple of Really Common Requirements - logon and
> a side nav bar / tree view. I've been amazed that I've not found a
> simple, standard example for either of these. Instead, I've tripped over
> a wealth of little fiddly details that derailed my progress. Nothing
> like lots of soft XML config to really trip you up with details I
> find... "I've never even heard of that option, and when I tried to use
> it I wasted 5 hours not noticing a typo in one of the repeated strings!"
> 
> > I'd much rather there was a bit
> > of focus to the framework than the mass of competing options. "Make the
> > simple things simple and the hard things possible" and all that...
> 
> Totally agree. For example, I did some work with Struts Layout:Treeview
> for my nav bar prototype. I very much appreciate volunteer effort, and
> don't wish to knock anyone's efforts, but I have to say that for a
> standard solution advocated by a couple of books it's fairly poor...
> There were a couple of immediate show-stoppers with working with the
> Treeview which was very disappointing. (Turns out the license precludes
> commercial use anyway.) The point of this isn't to knock Layout (again,
> I appreciate effort and feel guilty that I don't pay back into the
> commnunity that makes me fine tools), but rather to illustrate how
> something fairly standard - a treeview nav bar with a load of
> actions/forwards - is surprisingly difficult for a beginner with the
> toolkit to knock up cleanly.
> 
> I guess some of this cognitive whiplash comes from the fact that several
> of the core components are Very Cool. The core idea of the actions is
> just Very Sensible, the basic idea of using ResourceBundle keys
> everywhere Just Works, etc. I particularly like Validator, although I
> can see, as this thread is discussing, room for disagreement about
> alternative implementations. Custom rules are very nice, and very easily
> added. I'm just troubled by the fact that most of the elements I find
> straightforward and cleanly finished are those which my boss just
> doesn't see! The basic project elements he wants in a couple of days -
> that tree view in a readable/maintainable form, a nice simple PAM login
> & timeout mechanism* - turn into real timesinks. (Actually, to be fair,
> the move from 1.0 -> 1.1 and similar shifts in several libaries also led
> to confusion when working from Googled, and often conflicting, advice.)
> 
> This is a rather rude rant I know, and I appreciate people are
> scratching their own itches, but it would be nice to seem some concerted
> effort to solve some of the FAQs cleanly, and to generate more of a core
> catalogue of Patterns for noobs like myself. (Kudos to people like Ted
> Husted who do maintain some useful resources.) In that vein, I'm very
> much looking forwards to the new Struts Cookbook that O'Reilly have just
> put out, was rather hoping to see it in the post this morning. Might
> well answer lots of questions for me.
> 
> I'm not sure I should hit 'Send' on this for fear of offending people,
> please just see this as constructive initial impression feedback. I see
> a lot of promise in the Struts toolkit, better be, sort of bet the
> project on it now!, and would love to see more consensus emerging about
> Best Practices.
> --
> David Kennedy
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
>

---

Re: what do you suggest me? iBatis or Hibernate

2005-03-18 Thread Diego Espada
I haven't used iBatis to tell the truth, but I've used Hibernate
extensively (even in a critic project) and it is really a great
product. It has an amazing set of features and a big base of users.

The learning curve is a bit high, though. If you use Hibernate, you
should plan taking into account that.

Bye.


On Fri, 18 Mar 2005 15:38:45 -0500, Milson Cardona
<[EMAIL PROTECTED]> wrote:
> Hi
> 
> I am novice in J2EE.
> 
> I have been working with JDBC (SQL statements within of business
> class), but now desire to work with persitence objects.
> 
> I know that this are different, Hibernate is then biggest, but iBatis
> have a knowledge curve very short
> 
> what do you suggest me?  iBatis or Hibernate.
> 
> thanks
> 
> -
> 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: Wouldn't validation be better performed by Actions rather than ActionForms?

2005-03-18 Thread David Kennedy
Sorry, this is going to be a fairly off-topic reaction post, but 
Lawrie's comments struck a chord with me.

Lawrie Gallardo wrote:
I'm relatively new to Struts and I have to say that I've found it to 
have a realtively steep learning curve. And the only reason for this is 
that there are so many different ways to do things and no definitive 
best ways of achieving anything. 
I totally agree. I have just transitioned to the web tier from a career 
slaving away at the back-end of large Java server systems for telecomms 
and finance. I was looking forward to using Struts quite a bit, 
suspecting, perhaps wrongly, that the nature of web tier work would mean 
a fast evolution of high-quality tools. Maybe I've been spoilt by a life 
dominated by strict (read: paranoid) coding practices, Ant and JUnit, 
but Struts is rather a confusing mess once past the initial "Oh, cool, a 
working action and page!" phase. And this is coming from someone who has 
just fled EJB land...

For example, I've got a couple of Really Common Requirements - logon and 
a side nav bar / tree view. I've been amazed that I've not found a 
simple, standard example for either of these. Instead, I've tripped over 
a wealth of little fiddly details that derailed my progress. Nothing 
like lots of soft XML config to really trip you up with details I 
find... "I've never even heard of that option, and when I tried to use 
it I wasted 5 hours not noticing a typo in one of the repeated strings!"

I'd much rather there was a bit 
of focus to the framework than the mass of competing options. "Make the 
simple things simple and the hard things possible" and all that...
Totally agree. For example, I did some work with Struts Layout:Treeview 
for my nav bar prototype. I very much appreciate volunteer effort, and 
don't wish to knock anyone's efforts, but I have to say that for a 
standard solution advocated by a couple of books it's fairly poor... 
There were a couple of immediate show-stoppers with working with the 
Treeview which was very disappointing. (Turns out the license precludes 
commercial use anyway.) The point of this isn't to knock Layout (again, 
I appreciate effort and feel guilty that I don't pay back into the 
commnunity that makes me fine tools), but rather to illustrate how 
something fairly standard - a treeview nav bar with a load of 
actions/forwards - is surprisingly difficult for a beginner with the 
toolkit to knock up cleanly.

I guess some of this cognitive whiplash comes from the fact that several 
of the core components are Very Cool. The core idea of the actions is 
just Very Sensible, the basic idea of using ResourceBundle keys 
everywhere Just Works, etc. I particularly like Validator, although I 
can see, as this thread is discussing, room for disagreement about 
alternative implementations. Custom rules are very nice, and very easily 
added. I'm just troubled by the fact that most of the elements I find 
straightforward and cleanly finished are those which my boss just 
doesn't see! The basic project elements he wants in a couple of days - 
that tree view in a readable/maintainable form, a nice simple PAM login 
& timeout mechanism* - turn into real timesinks. (Actually, to be fair, 
the move from 1.0 -> 1.1 and similar shifts in several libaries also led 
to confusion when working from Googled, and often conflicting, advice.)

This is a rather rude rant I know, and I appreciate people are 
scratching their own itches, but it would be nice to seem some concerted 
effort to solve some of the FAQs cleanly, and to generate more of a core 
catalogue of Patterns for noobs like myself. (Kudos to people like Ted 
Husted who do maintain some useful resources.) In that vein, I'm very 
much looking forwards to the new Struts Cookbook that O'Reilly have just 
put out, was rather hoping to see it in the post this morning. Might 
well answer lots of questions for me.

I'm not sure I should hit 'Send' on this for fear of offending people, 
please just see this as constructive initial impression feedback. I see 
a lot of promise in the Struts toolkit, better be, sort of bet the 
project on it now!, and would love to see more consensus emerging about 
Best Practices.
--
David Kennedy

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


Re: Wouldn't validation be better performed by Actions rather than ActionForms?

2005-03-18 Thread Frank W. Zammetti
Interesting approach Jack.  It seems like a somewhat unnecassery layer 
though... But then again, as with all architectural decisions, if you 
had a reason for it, then it's a good solution (unless it's a bad 
solution! :) )

I suppose it comes down to what is actually in an Action... If it is 
absolutely ideal (i.e., copy ActionForm to VO, pass VO to business 
delegate, all of, what, 3-5 lines of code??), then a DispatchAction 
doesn't bother me QUITE as much as it otherwise would.

It's interesting to me... the idea of the chain implementation is to 
allow easy swapping of commands anywhere in the chain... Isn't having 
individual Actions for everything in a non-chain environment really akin 
to that?  If I have a DispatchAction with 10 functions in it, even if 
they are small and simple, isn't it a little harder then to change the 
flow of an application?

Besides, for the instances where you have a team development environment 
and the Actions maybe do just a little more than they should (not 
uncommon in my experience), it's easier if three developers can check 
out three different class that has one discrete function rather than all 
three of them needing to check out the same class at the same time. 
Reduces serialization of the development process.  Honestly, I've only 
very rarely been in such a situation myself, so I don't want to make it 
sound like this is some huge problem with DispatchActions.  It's not.

Frank
Dakota Jack wrote:
You don't have to have a large file.  I use the dispatching to
organize in a sort of "controller" fashion delegating processing to
other files.  I do this when I have an AdministrativeAction, for
example.  I use separate classes not unlike the way you use
instantiations of Action subclasses in your model.  The difference is
merely that I use non-Actions, as follows:
  public ActionForward execute(ActionMapping mapping,
   ActionForm form,
   HttpServletRequest request,
   HttpServletResponse response)
  throws IOException,
 ServletException {
ActionForward forward= null;
try {
  forward = method(this,mapping,form,request,response);
} catch (Exception e) { }
return forward;
  }
  public ActionForward guestApplicationExit (ActionMapping mapping, 
 ActionForm form, 
 HttpServletRequest request,
 HttpServletResponse response) throws IOException, ServletException { 
 return new   
 AdminActionGuestApplicationExit().execute(mapping,form,request,response);
}

[many methods calling classes left out here.
  public ActionForward webmasterView (ActionMapping mapping, 
  ActionForm form, 
  HttpServletRequest request, 
  HttpServletResponse response) throws IOException, ServletException { 
  return new 
  AdminActionWebmasterView().execute(mapping,form,request,response);
}
} 

On Fri, 18 Mar 2005 13:21:18 -0500 (EST), Frank W. Zammetti
<[EMAIL PROTECTED]> wrote:
I've always felt that class sizes should be reduced wherever possible.
Even when the code is extremely simplistic, as should be the case in
Actions generally, it's still more difficult to look through a higher
volume of code (this is in fact a known metric that most code analysis
tools use).  DispatchActions and their bretherin seem to fly in the face
of this idea.  I don't mean to imply they are bad in every case, certainly
not, but I personally find them to be a bit overused.
I only mentioned it because of the comment by the OP about DispatchActions
being a "best practice".  Maybe they are considered that at this point, I
just wasn't aware if they are.
--
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
On Fri, March 18, 2005 1:08 pm, Dakota Jack said:
Where did you get this idea, Frank?  This seems out of the blue on a
thread about validation.  I personally like the "new" dispatch action
at http://www.michaelmcgrady.com/button/jsp/dispatch_action.jsp a lot.
///;-)
Jack
On Fri, 18 Mar 2005 12:25:00 -0500 (EST), Frank W. Zammetti
<[EMAIL PROTECTED]> wrote:
Is it really true that DispatchAction is now the accepted "best
practice"?
If so I have to say I disagree with that standard (if not, ignore me!)
--
"You can lead a horse to water but you cannot make it float on its back."
~Dakota Jack~
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



--
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Struts Menu

2005-03-18 Thread Matt Raible
Good to know - thanks for reporting back with the solution.
Matt
On Mar 18, 2005, at 2:57 AM, Vijaya S wrote:
Hi Matt,
I solved the menu problem I was having. The problem was that I was 
missing
log4j and commons_lang jar files in my web app lib.

Thanks,
Vijaya
-Original Message-
From: Matt Raible [mailto:[EMAIL PROTECTED]
Sent: Monday, March 14, 2005 7:32 PM
To: Struts Users Mailing List
Subject: Re: Struts Menu

On Mar 14, 2005, at 5:31 AM, Antony Joseph wrote:
Hi Vijaya,
You will need an entry in the web.xml similar to the one below:
  
/WEB-INF/struts-menu
/WEB-INF/struts-menu.tld
  
You should only need this if the URI in your JSP taglib declaration
points to the URI in your web.xml.  2.3 Servlet containers will scan
JARs and pick up the URIs from there.
Can you post your displayer mappings (from the top of menu-config.xml)
and the struts-menu part of your JSP?
Also, what version of Struts Menu are you using?
Matt
If you are still having problems, check out the application
https://workeffort.dev.java.net . It uses struts-menu.
- Original Message -
From: "Vijaya S" <[EMAIL PROTECTED]>
To: "Struts User mailing List" 
Subject: Struts Menu
Date: Mon, 14 Mar 2005 10:47:58 +0530
Hi,
Has anyone successfully implemented Struts Menu in your application?
I am
getting an error as
'The displayer mapping for the specified MenuDisplayer does not
exist'.
I have done the following
1. In my struts-config I have included the plugin
2. I have placed my menu-config.xml under WEB-INF.
3. My jsp has the corresponding taglibs included
4. struts-menu jar is placed under the lib directory of my
application.
Am I missing anything else? I posted my problem in struts-menu user
list but
no replies. If anyone of you is successful with struts-menu, can you
please
tell me what I am doing wrong?
Thanks,
Vijaya

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

Antony Joseph
http://www.logicden.com
https://workeffort.dev.java.net
--
___
NEW! Lycos Dating Search. The only place to search multiple dating
sites at once.
http://datingsearch.lycos.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]


-
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: what do you suggest me? iBatis or Hibernate

2005-03-18 Thread Ken Robinson
I don't know about iBatis, but I was able to get Hibernate up and
running in about 2 - 3 days, I'm a novice at this as well. I found a
really great site:
http://www.laliluna.de/struts-hibernate-integration-tutorial-en.html


-Original Message-
From: Milson Cardona [mailto:[EMAIL PROTECTED] 
Sent: Friday, March 18, 2005 3:39 PM
To: user@struts.apache.org
Subject: what do you suggest me? iBatis or Hibernate

Hi

I am novice in J2EE.

I have been working with JDBC (SQL statements within of business
class), but now desire to work with persitence objects.

I know that this are different, Hibernate is then biggest, but iBatis
have a knowledge curve very short

what do you suggest me?  iBatis or Hibernate.

thanks

-
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: Wouldn't validation be better performed by Actions rather than ActionForms?

2005-03-18 Thread Joe Germuska
However, even sticking to the current multithreaded Action model, 
why would this cause problems with validation? The ActionForm is 
currently passed by the ActionServlet as a parameter to the 
Action's execute() method - surely the ActionServlet could 
similarly pass the ActionFrom as a parameter to a validate() 
method on an Action object?
I was thinking you were still talking about the model where the 
Action and the ActionForm merged.  Maybe I misunderstood you 
earlier. But what does it gain to move the validation inside the 
action?
I wasn't really thinking of merging ActionForm and Action - my 
motivation was the centralising of all validation, transformations 
(ie convert separate day, month and year HTML fields to Java Date 
object), and mappings (ActionForm / HTML parameters to Domain POJOs 
/ DTOs) in just one place instead of these being split between 
ActionForm and Action classes. Plus it just seems odd to me to that:

1. You can have declarative validation occur through an invocation 
of the DynaValidatorForm class's validate() method but you need to 
manually create your own ValidatorActionForm if you need more 
complex (but still presentation-tier) validation. If instead 
declarative validation was invoked by the 
ActionServlet/RequestDispatcher through the Action's validate method 
then you could simply add any additional validation that there that 
could not be handled declaratively.
I see your point.  This is why it's good to have fresh blood. 
Theoretically, you could write your own custom validators to plug-in 
to commons-validator, although even then, there are cases which are 
likely to elude it.

Don't forget that you can extend DynaValidatorForm and still defer 
all the easy stuff to declarative validation -- doesn't address your 
point directly, of course.

We once had a job to write to a client's homegrown MVC model which 
implemented things the way you describe, wherein their controllers 
had a validate method and then a perform method.

To be honest, it's rare enough that I have such complicated 
validation needs that it's hard for me to get too fired up about a 
change like this, especially considering potential compatibility 
implications.  (not what you want to hear, I know...)  So of course, 
my fallback then is to ask "can you at least do it yourself outside 
of the framework?"  It would be extremely easy to write an abstract 
base action which called this.validate(mapping,form,req,resp) before 
calling this.execute(m,f,r,r).  It's less clear how you would deal 
with actually instructing it that validation was required without 
somehow disabling the stage in which the request processor calls 
form.validate() instead.  Or maybe you simply wouldn't need to do 
this -- just use the Action.validate form when you know you need it 
and only tend to the stuff which you know is more than the ActionForm 
can do.

2. If you have any complicated data transformation/mapping from HTML 
form fields to the type required by the business object, then the 
existing scheme would require the ActionForm to have knowledge of 
the business object(s) which seems wrong for a simple data holder / 
transfer object. Isn't an ActionForm supposed to just be a 
representation of the HTML request parameters in Java. If not, it 
suddenly becomes much less clear what it is actually supposed to 
represent.
Somewhat as before, the complexities in my apps usually don't lie in 
the form input, so this is a problem to which I haven't given much 
thought.  As Hubert noted, his FormDef plugin sounds like it 
addresses some of your concerns.  I think if a few more people gave 
that a try and started endorsing it, it would be a good candidate for 
inclusion in the core.  I'll admit I've never tried it, but it sounds 
like a good general solution to a common problem.  It's big enough 
that even though Hubert now has the power to just plug it in to 
Struts, it would still be good if a few more folks kicked it around 
and spoke up here about its strengths and weaknesses.

Again, this may be a philosophical difference, but I'm personally not 
that interested in having Struts solve every problem, especially if 
the community is willing to develop plugins that help solve common 
Struts problems without weighing down the core.  From some of what 
you've said, I think you might prefer one-stop shopping, but I think 
lighter is better in the long-term.

Joe
--
Joe Germuska
[EMAIL PROTECTED]  
http://blog.germuska.com
"Narrow minds are weapons made for mass destruction"  -The Ex

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


Re: Wouldn't validation be better performed by Actions rather than ActionForms?

2005-03-18 Thread Hubert Rabago
I was waiting for another period where tons of commits were happening.
 That's when I'd sneak in this one and see if anybody notices.  :)

Now before somebody thinks I was serious (about the sneaking in part)
-- this actually is on my radar.  I plan on digging up the arguments
around it.  Speaking for myself, I think it's very useful, especially
for those implementing custom base action classes.  Right now, though,
I'm finishing up config inheritance.

I've actually been thinking of stuff that'd be useful even without
being added to the core, such as a 1.2 compatible page prep through
custom ForwardConfig objects, and this ActionDispatcher, and the POJO
wrapper you outlined for 1.3.  I'm beginning to wonder if it'd be
worth the effort of implementing them and hosting them somewhere. 
Maybe the Struts SF site (I keep getting mixed signals as to its
status) or even just my own site.  Hmm... something like what Niall
has on his site.  Maybe he'll want to host these.  Think of them as
Struts counterpart of MS' TweakUI, or Struts goodies.

Some of them might just be a weekend itch for me (or someone else),
but who knows, people could find them helpful, if not by using them,
maybe by studying how they work.

Hubert


On Fri, 18 Mar 2005 15:13:31 -0600, Joe Germuska <[EMAIL PROTECTED]> wrote:
> Hubert Rabago wrote:
> >  > >That certainly is one practice.  Personally I don't use that.  I
> >>  >mostly use my own Action subclasses, or if I want dispatch
> >>  >functionality, I used to use MappingDispatchAction.  Now I use the
> >  > >ActionDispatcher class in
> >>  >http://issues.apache.org/bugzilla/show_bug.cgi?id=31270 .
> >  > >
> 
> Did nobody explain to you what being a "committer" actually meant? ;-)
> 
> Joe
> 
> --
> Joe Germuska
> [EMAIL PROTECTED]
> http://blog.germuska.com
> "Narrow minds are weapons made for mass destruction"  -The Ex
>

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



Re: Validating Nested DynaValidator Forms

2005-03-18 Thread jelything

Thanks for the feedback.

Why wouldn't I want to nest forms?  Its entirely possible I missed the
point, but I thought that was what  was for?  Everything
but the validating works just fine.

I'm sure that I could write my own validation method, but I'm trying
to KISS and use the nice validation.xml route

J

--- In [EMAIL PROTECTED], Rick Reumann <[EMAIL PROTECTED]> wrote:
> Ok couple of things...
> 
> 1) I would NOT nest forms. I think that's just asking for trouble. I 
> would simply use ONE form and have your collection a s property in that 
> form. (The of course your collection can hold objects which have 
> collections..etc etc). But just nest a collection of beans, or even one 
> bean with the collections inside.
> 
> 2) I'm not sure how declarative validation works over nested objects 
> (using validation rules). I know when I have a lot of nested objects 
> (which I do quite often), I find it easiest to just create my own 
> validation (Recurse over the nested objects and perform the checks).
> 
> -- 
> Rick
> 
> -
> 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: Wouldn't validation be better performed by Actions rather than ActionForms?

2005-03-18 Thread Dakota Jack
You don't have to have a large file.  I use the dispatching to
organize in a sort of "controller" fashion delegating processing to
other files.  I do this when I have an AdministrativeAction, for
example.  I use separate classes not unlike the way you use
instantiations of Action subclasses in your model.  The difference is
merely that I use non-Actions, as follows:


  public ActionForward execute(ActionMapping mapping,
   ActionForm form,
   HttpServletRequest request,
   HttpServletResponse response)
  throws IOException,
 ServletException {

ActionForward forward= null;

try {
  forward = method(this,mapping,form,request,response);
} catch (Exception e) { }

return forward;
  }

  public ActionForward guestApplicationExit (ActionMapping mapping, 
 ActionForm form, 
 HttpServletRequest request,
 HttpServletResponse response) throws IOException, ServletException { 
 return new   
 
AdminActionGuestApplicationExit().execute(mapping,form,request,response);
}

[many methods calling classes left out here.

  public ActionForward webmasterView (ActionMapping mapping, 
  ActionForm form, 
  HttpServletRequest request, 
  HttpServletResponse response) throws IOException, ServletException { 
  return new 
  AdminActionWebmasterView().execute(mapping,form,request,response);
}
} 


On Fri, 18 Mar 2005 13:21:18 -0500 (EST), Frank W. Zammetti
<[EMAIL PROTECTED]> wrote:
> I've always felt that class sizes should be reduced wherever possible.
> Even when the code is extremely simplistic, as should be the case in
> Actions generally, it's still more difficult to look through a higher
> volume of code (this is in fact a known metric that most code analysis
> tools use).  DispatchActions and their bretherin seem to fly in the face
> of this idea.  I don't mean to imply they are bad in every case, certainly
> not, but I personally find them to be a bit overused.
> 
> I only mentioned it because of the comment by the OP about DispatchActions
> being a "best practice".  Maybe they are considered that at this point, I
> just wasn't aware if they are.
> 
> --
> Frank W. Zammetti
> Founder and Chief Software Architect
> Omnytex Technologies
> http://www.omnytex.com
> 
> On Fri, March 18, 2005 1:08 pm, Dakota Jack said:
> > Where did you get this idea, Frank?  This seems out of the blue on a
> > thread about validation.  I personally like the "new" dispatch action
> > at http://www.michaelmcgrady.com/button/jsp/dispatch_action.jsp a lot.
> >
> > ///;-)
> >
> > Jack
> >
> > On Fri, 18 Mar 2005 12:25:00 -0500 (EST), Frank W. Zammetti
> > <[EMAIL PROTECTED]> wrote:
> >> Is it really true that DispatchAction is now the accepted "best
> >> practice"?
> >>  If so I have to say I disagree with that standard (if not, ignore me!)
> >>
> >
> > --
> > "You can lead a horse to water but you cannot make it float on its back."
> > ~Dakota Jack~
> >
> > -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> 
> 


-- 
"You can lead a horse to water but you cannot make it float on its back."
~Dakota Jack~

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



[OR] Re: Interesting problem...

2005-03-18 Thread Dakota Jack
///;-)


On Fri, 18 Mar 2005 13:22:01 -0500 (EST), Frank W. Zammetti
<[EMAIL PROTECTED]> wrote:
> I've wanted a nickname all my life (aside from the explicitives some would
> use!)... never thought it's be Radar :)
> 
> --
> Frank W. Zammetti
> Founder and Chief Software Architect
> Omnytex Technologies
> http://www.omnytex.com
> 
> On Fri, March 18, 2005 1:09 pm, Dakota Jack said:
> > The class works, but I don't think it is what you want.  Maybe it is.
> > Just don't have high expectations.  I did and was disappointed.  Just
> > trying to help you out, Radar!  ///;-)
> >
> > Jack



-- 
"You can lead a horse to water but you cannot make it float on its back."
~Dakota Jack~

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



Re: Validating Nested DynaValidator Forms

2005-03-18 Thread Rick Reumann
jelything wrote the following on 3/18/2005 1:40 PM:
I have a DynaValidatorForm that holds many items, including an
ArrayList of DynaValidatorForms.  Calling validate() on the main form
works just fine, but how do I get the nested forms to validate?
If I iterate through the ArrayList, and cast them back to a
DynaValidatorForm and then simply call validate on them, I get:
java.lang.NullPointerException at
org.apache.struts.validator.DynaValidatorForm.validate(DynaValidatorForm.java:144)
Any ideas?
Ok couple of things...
1) I would NOT nest forms. I think that's just asking for trouble. I 
would simply use ONE form and have your collection a s property in that 
form. (The of course your collection can hold objects which have 
collections..etc etc). But just nest a collection of beans, or even one 
bean with the collections inside.

2) I'm not sure how declarative validation works over nested objects 
(using validation rules). I know when I have a lot of nested objects 
(which I do quite often), I find it easiest to just create my own 
validation (Recurse over the nested objects and perform the checks).

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


Re: Wouldn't validation be better performed by Actions rather than ActionForms?

2005-03-18 Thread Joe Germuska
Hubert Rabago wrote:
 > >That certainly is one practice.  Personally I don't use that.  I
 >mostly use my own Action subclasses, or if I want dispatch
 >functionality, I used to use MappingDispatchAction.  Now I use the
 > >ActionDispatcher class in
 >http://issues.apache.org/bugzilla/show_bug.cgi?id=31270 .
 > >
Did nobody explain to you what being a "committer" actually meant? ;-)
Joe
--
Joe Germuska
[EMAIL PROTECTED]  
http://blog.germuska.com
"Narrow minds are weapons made for mass destruction"  -The Ex

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


Re: Wouldn't validation be better performed by Actions rather than ActionForms?

2005-03-18 Thread Lawrie Gallardo

From: Joe Germuska <[EMAIL PROTECTED]>
Reply-To: "Struts Users Mailing List" 
To: "Lawrie Gallardo" <[EMAIL PROTECTED]>, user@struts.apache.org
Subject: Re: Wouldn't validation be better performed by Actions rather than 
ActionForms?
Date: Fri, 18 Mar 2005 14:00:30 -0600

At 7:35 PM + 3/18/05, Lawrie Gallardo wrote:
Thanks for your detailed answers, Joe.
Just a few queries though:
Now, if my understanding is correct:
1. There is always a one-to-one mapping between an ActionForm and an 
ActionMapping,
Often not true.  Earlier today on the dev-list Ted H. described a case 
where you might have a long form composed
But isn't this subverting the ActionForm from its original design? I'll 
have to find that thread and read it before I say too much - but surely 
the whole point of an ActionForm is that it contains ALL the data from a 
submitted form?
Sorry.. and I didn't even finish my thought.
Here's Ted's msg: 
http://article.gmane.org/gmane.comp.jakarta.struts.devel/26129

But there are two things; first, Ted's use case was for having the same 
form (and form bean) submit to different action paths (i.e. different 
action mappings).  Also, a case where one ActionForm might not contain all 
the data would be if you were using a multi-page form/wizard type process, 
where each submission might carry only a subset of the overall data.  Not 
everyone likes to use multipage forms, but Struts supports it.


2. Struts best practice is to have each Action class handle all possible 
operations for the HTML request it deals with using DispatchLookupAction 
or something similar,
I don't know if dispatch style is "best practice."  It's my preferred 
approach, but many experienced Struts developers don't like it much at 
all.  And then you've got wackos like Frank Z who like to write more code 
just to show off their typing skills.

I'm relatively new to Struts and I have to say that I've found it to have 
a realtively steep learning curve. And the only reason for this is that 
there are so many different ways to do things and no definitive best ways 
of achieving anything. The phrase "Jack of all trades and master of none" 
springs (sic) to mind. I'd much rather there was a bit of focus to the 
framework than the mass of competing options. "Make the simple things 
simple and the hard things possible" and all that...

Now if this is the case, would it not be better to have the ActionForm 
as basically a dum data holder and have the validation method in the 
Action classes instead?
Sounds like WebWork.  http://opensymphony.com/webwork/
My main motivation for learning Struts is that a lot of contracts are now 
specifying it as a requirement. Unfortunately, there doesn't seem to be 
anywhere near the same demand for WebWork, Spring MVC or Tapestry so it 
looks like I'm pretty much stuck with learning Struts.
I wonder if there's an correlation between the many ways in which Struts 
can be done and the fact that it is popular in many environments.  Pure 
speculation on my part.

Is it just down to design decisions made in early versions of Struts and 
backward compatibility that things are the way they are? Or are there 
good arguments for having the validation method in ActionForm? Am I 
missing something here?
The main reason you can't do it that way in Struts today is that Actions 
may service multiple threads and thus must remain stateless, while 
request data is inherently about state.  WebWork, for example, 
instantiates its controller-type classes per-request, which makes it safe 
to populate them with request values and integrate request validation and 
control logic.

Is object creation / garbage collection really that expensive any more? Is 
there any real reason for sticking with the current multithreaded 
one-Action-for-all-requests model rather than moving to an 
Action-per-request model. It seems to me that there should be a very good 
one in order to justify the coding style restrictions that the 
multithreaded model entails.
To be honest, I don't think so it is all that expensive, but until some 
mechanism comes up whereby Actions actually do get state from the 
framework, then there's no motivation to change the framework. Meanwhile, 
it is entirely possible to subclass the RequestProcessor and make Struts 
instantiate new Actions for each request.  Spring's 
DelegatingRequestProcessor does exactly this.

However, even sticking to the current multithreaded Action model, why 
would this cause problems with validation? The ActionForm is currently 
passed by the ActionServlet as a parameter to the Action's execute() 
method - surely the ActionServlet could similarly pass the ActionFrom as a 
parameter to a validate() method on an Action object?
I was thinking you were still talking about the model where the Action and 
the ActionForm merged.  Maybe I misunderstood you earlier. But what does it 
gain to move the validation inside the action?
I wasn't really thinking of merging ActionForm and Action - my motivat

Re: Wouldn't validation be better performed by Actions rather than ActionForms?

2005-03-18 Thread Hubert Rabago
(I almost missed the questions you had inline, thinking that the
message you had at the top was all there was.)

> Could you give any example reasons why (/ situations when) you would use 
multiple individual Action classes in favour of an Action with dispatching 
functionality? I am still learning Struts so my assumptions are just based 
on the books and articles I've read (which frequently tell you what the 
various options are, but not why you would use one in preference to 
another...).

I like to keep my actions simple and focused.  I only switch to a
multi-function Action object when it's apparent that there's
functionality I want shared between actions that I don't want to
copy/paste but I don't feel like putting it in a shared class either.

Also, when I have operations that are almost pure CRUD, I usually
combine them into a dispatch-type action so I can deal with all of
them in one place.  In these situations, I usually write the whole
action, with all its CRUD methods, in one go.  This makes me feel
that, even though it's a dispatch-flavor action, it's still a simple
and focused Action class.

I don't necessarily advocate these as best practices; I do them
because they were what worked for me at the time given the situation I
faced then.  I guess that means you don't get much out of me, either. 
:)


> Again, I'd be most grateful if you could provide me with some real-world 
examples of when you might want to manually create an ActionForm...

This is when I need to do validation that's too complicated for
Validator, or I need to do more than
BeanUtils.copyProperties/FormUtils.set/getFormValues()  to map between
the form I show and my business object.  My favorite example is when I
had a form which had a list of maps of values.  I chose the regular
ActionForm subclass because I felt it was easier for both me and my
teammates to follow along with what was going on, thereby making it
easier to maintain.  If I had a search page with just a search string
and simple options, I'd certainly use dynamic forms, which in this
case would be easier to maintain.


hth,
Hubert


On Fri, 18 Mar 2005 20:24:19 +, Lawrie Gallardo
<[EMAIL PROTECTED]> wrote:
> Thanks Hubert - you have certainly given me a few things to think about...
> 
> >From: Hubert Rabago <[EMAIL PROTECTED]>
> >Reply-To: Hubert Rabago <[EMAIL PROTECTED]>
> >To: Struts Users Mailing List 
> >Subject: Re: Wouldn't validation be better performed by Actions rather than
> >ActionForms?
> >Date: Fri, 18 Mar 2005 11:39:33 -0600
> >
> >Inline.
> >
> >On Fri, 18 Mar 2005 17:17:39 +, Lawrie Gallardo
> ><[EMAIL PROTECTED]> wrote:
> > > I'm still relatively new to Struts, but I can't help but feel that
> > > validation would be better performed by Action classes rather than
> > > ActionForm classes.
> > >
> > > It seems to me that, ideally, you want
> > > 1. Validation,
> > > 2. Transformations (ie convert separate day, month and year HTML fields
> >to
> > > Java Date object), and
> > > 3. Mapping of ActionForm fields (/HTML parameters) to Domain POJOs /
> >DTOs
> > > to all be configured in the same config file (to minimise duplication)
> >and
> > > to be implemented in the same class rather than scattered between
> >multiple
> > > config files and classes.
> > >
> >
> >Hmm, you just described one use case for FormDef when coupled with its
> >Validator integration.  :)
> >https://formdef.dev.java.net
> >http://www.rabago.net/struts/formdef/manual.htm#combinedconfig
> >
> >
> > > Now, if my understanding is correct:
> > > 1. There is always a one-to-one mapping between an ActionForm and an
> > > ActionMapping,
> >
> >An action form holds the request parameters that accompany a request.
> >The most common use case is a form being submitted.  You submit each
> > to one URL - that's why there's a one-to-one mapping.
> >
> > > 2. Struts best practice is to have each Action class handle all possible
> > > operations for the HTML request it deals with using DispatchLookupAction
> >or
> > > something similar,
> >
> >That certainly is one practice.  Personally I don't use that.  I
> >mostly use my own Action subclasses, or if I want dispatch
> >functionality, I used to use MappingDispatchAction.  Now I use the
> >ActionDispatcher class in
> >http://issues.apache.org/bugzilla/show_bug.cgi?id=31270 .
> >
> 
> Could you give any example reasons why (/ situations when) you would use
> multiple individual Action classes in favour of an Action with dispatching
> functionality? I am still learning Struts so my assumptions are just based
> on the books and articles I've read (which frequently tell you what the
> various options are, but not why you would use one in preference to
> another...).
> 
> > > 3. Almost noone creates ActionForms manually any more - they use
> > > DynaActionForm (or validating variations of this). And for those who do
> > > still create ActionForms manually, they don't offer anything in the way
> >of
> > > reuse, and are basically throw-awa

Problem with extending TilesRequestProcessor

2005-03-18 Thread Schuster Joel M Contr ESC/NDC

I've been working with a custom RequestProcessor extention for awhile that
works great for my needs to validate and verify login and session for each
request.

I have now added in tiles configuration and am trying to get it working. So
one part of that conversion was to now extend from TilesRequestProcessor
instead.

I get this exception:

Java.lang.ClassCastException: org.apache.struts.tiles.TilesUtilImpl
   at
org.apache.struts.tiles.TilesRequestProcessor.initDefinitionsMapping(TilesRe
questProcessor.java:86)
   at
org.apache.struts.tiles.TilesRequestProcessor.init(TilesRequestProcessor.jav
a:77)
   at
org.apachestruts.action.ActionServlet.getRequestProcessor(ActionServlet.java
:585)



I've been looking at the code but nothing stands out to me, any hints would
be appreciated.

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



RE: what do you suggest me? iBatis or Hibernate

2005-03-18 Thread Schuster Joel M Contr ESC/NDC
Hibernate by proxy: ejb 3.0 via Jboss ;) 

> -Original Message-
> From: Rick Reumann [mailto:[EMAIL PROTECTED] 
> Sent: Friday, March 18, 2005 1:53 PM
> To: Struts Users Mailing List
> Subject: Re: what do you suggest me? iBatis or Hibernate
> 
> Milson Cardona wrote the following on 3/18/2005 3:38 PM:
> 
> > I am novice in J2EE.
> > 
> > I have been working with JDBC (SQL statements within of business 
> > class), but now desire to work with persitence objects.
> > 
> > I know that this are different, Hibernate is then biggest, 
> but iBatis 
> > have a knowledge curve very short
> > 
> > what do you suggest me?  iBatis or Hibernate.
> 
> This is starting to remind me of IDE wars:)...
> 
> anyway.. I prefer iBATIS. Ease of use, does what I need. Uses 
> standard SQL which you are used to.
> 
> --
> Rick
> 
> -
> 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: what do you suggest me? iBatis or Hibernate

2005-03-18 Thread Rick Reumann
Milson Cardona wrote the following on 3/18/2005 3:38 PM:
I am novice in J2EE.
I have been working with JDBC (SQL statements within of business
class), but now desire to work with persitence objects.
I know that this are different, Hibernate is then biggest, but iBatis
have a knowledge curve very short
what do you suggest me?  iBatis or Hibernate.
This is starting to remind me of IDE wars:)...
anyway.. I prefer iBATIS. Ease of use, does what I need. Uses standard 
SQL which you are used to.

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


Re: Present formbean value on jsp page.

2005-03-18 Thread Rick Reumann
Rick Reumann wrote the following on 3/18/2005 3:48 PM:
Using struts tags:

Correction, I think Jay's use of bean:write is the correct way:

It's been a long time since I used bean:write so I'm not sure if the way 
I described it would work?

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


Re: Present formbean value on jsp page.

2005-03-18 Thread Rick Reumann
Scott Purcell wrote the following on 3/18/2005 3:32 PM:
Well, as normal, I have once again ran into a new snag while building my app.
Up until today, I have pulled out my form-param values in my jsp like so into a 
textfield.
   
And this is great if you want to display it in a text field. But how can I just display it in html. I have some fields that I just want to show, as uneditable, so therefore just html. The values are in the form-bean, but I cannot figure out which tag to use for this mission.
You might want to look at some of the tons of struts examples that are 
out there. This is such a common thing that all the examples will show 
it. (Not that it's a bad question, just that a quick look at any of the 
struts examples will show displaying properties).

To answer your question there are several ways...
Using struts tags:

JSTL (prefered over bean:write):

JSP2.O:
${userBean.someField}
Preferred consesus is to use JSTL approach.
Should I just start using You shouldn't need to if your bean is already in scope, which it should 
be since you should set into scope in your Action class (or if it's a 
form bean it will automatically be in scope).

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


RE: Present formbean value on jsp page.

2005-03-18 Thread java
Can you use bean:write to accomplish what you're after e.g.



Jay
Vertical Technology Group
http://www.vtgroup.com/

 

-Original Message-
From: Scott Purcell [mailto:[EMAIL PROTECTED] 
Sent: Friday, March 18, 2005 2:32 PM
To: Struts Users Mailing List
Subject: Present formbean value on jsp page.

Well, as normal, I have once again ran into a new snag while building my app.

Up until today, I have pulled out my form-param values in my jsp like so into a
textfield.

   


And this is great if you want to display it in a text field. But how can I just
display it in html. I have some fields that I just want to show, as uneditable,
so therefore just html. The values are in the form-bean, but I cannot figure out
which tag to use for this mission.

The form tag is 
And the bean is named something like 'userbean'.

Should I just start using 

what do you suggest me? iBatis or Hibernate

2005-03-18 Thread Milson Cardona
Hi

I am novice in J2EE.

I have been working with JDBC (SQL statements within of business
class), but now desire to work with persitence objects.

I know that this are different, Hibernate is then biggest, but iBatis
have a knowledge curve very short

what do you suggest me?  iBatis or Hibernate.

thanks

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



Present formbean value on jsp page.

2005-03-18 Thread Scott Purcell
Well, as normal, I have once again ran into a new snag while building my app.

Up until today, I have pulled out my form-param values in my jsp like so into a 
textfield.

   


And this is great if you want to display it in a text field. But how can I just 
display it in html. I have some fields that I just want to show, as uneditable, 
so therefore just html. The values are in the form-bean, but I cannot figure 
out which tag to use for this mission.

The form tag is 
And the bean is named something like 'userbean'.

Should I just start using 

Re: Wouldn't validation be better performed by Actions rather than ActionForms?

2005-03-18 Thread Joe Germuska
At 7:35 PM + 3/18/05, Lawrie Gallardo wrote:
Thanks for your detailed answers, Joe.
Just a few queries though:
Now, if my understanding is correct:
1. There is always a one-to-one mapping between an ActionForm and 
an ActionMapping,
Often not true.  Earlier today on the dev-list Ted H. described a 
case where you might have a long form composed
But isn't this subverting the ActionForm from its original design? 
I'll have to find that thread and read it before I say too much - 
but surely the whole point of an ActionForm is that it contains ALL 
the data from a submitted form?
Sorry.. and I didn't even finish my thought.
Here's Ted's msg: 
http://article.gmane.org/gmane.comp.jakarta.struts.devel/26129

But there are two things; first, Ted's use case was for having the 
same form (and form bean) submit to different action paths (i.e. 
different action mappings).  Also, a case where one ActionForm might 
not contain all the data would be if you were using a multi-page 
form/wizard type process, where each submission might carry only a 
subset of the overall data.  Not everyone likes to use multipage 
forms, but Struts supports it.


2. Struts best practice is to have each Action class handle all 
possible operations for the HTML request it deals with using 
DispatchLookupAction or something similar,
I don't know if dispatch style is "best practice."  It's my 
preferred approach, but many experienced Struts developers don't 
like it much at all.  And then you've got wackos like Frank Z who 
like to write more code just to show off their typing skills.

I'm relatively new to Struts and I have to say that I've found it to 
have a realtively steep learning curve. And the only reason for this 
is that there are so many different ways to do things and no 
definitive best ways of achieving anything. The phrase "Jack of all 
trades and master of none" springs (sic) to mind. I'd much rather 
there was a bit of focus to the framework than the mass of competing 
options. "Make the simple things simple and the hard things 
possible" and all that...

Now if this is the case, would it not be better to have the 
ActionForm as basically a dum data holder and have the validation 
method in the Action classes instead?
Sounds like WebWork.  http://opensymphony.com/webwork/
My main motivation for learning Struts is that a lot of contracts 
are now specifying it as a requirement. Unfortunately, there doesn't 
seem to be anywhere near the same demand for WebWork, Spring MVC or 
Tapestry so it looks like I'm pretty much stuck with learning Struts.
I wonder if there's an correlation between the many ways in which 
Struts can be done and the fact that it is popular in many 
environments.  Pure speculation on my part.

Is it just down to design decisions made in early versions of 
Struts and backward compatibility that things are the way they 
are? Or are there good arguments for having the validation method 
in ActionForm? Am I missing something here?
The main reason you can't do it that way in Struts today is that 
Actions may service multiple threads and thus must remain 
stateless, while request data is inherently about state.  WebWork, 
for example, instantiates its controller-type classes per-request, 
which makes it safe to populate them with request values and 
integrate request validation and control logic.

Is object creation / garbage collection really that expensive any 
more? Is there any real reason for sticking with the current 
multithreaded one-Action-for-all-requests model rather than moving 
to an Action-per-request model. It seems to me that there should be 
a very good one in order to justify the coding style restrictions 
that the multithreaded model entails.
To be honest, I don't think so it is all that expensive, but until 
some mechanism comes up whereby Actions actually do get state from 
the framework, then there's no motivation to change the framework. 
Meanwhile, it is entirely possible to subclass the RequestProcessor 
and make Struts instantiate new Actions for each request.  Spring's 
DelegatingRequestProcessor does exactly this.

However, even sticking to the current multithreaded Action model, 
why would this cause problems with validation? The ActionForm is 
currently passed by the ActionServlet as a parameter to the Action's 
execute() method - surely the ActionServlet could similarly pass the 
ActionFrom as a parameter to a validate() method on an Action object?
I was thinking you were still talking about the model where the 
Action and the ActionForm merged.  Maybe I misunderstood you earlier. 
But what does it gain to move the validation inside the action?

I have to say that learning Struts has been a bit of a disheartening 
experience... There are frequently numerous ways of doing things, 
and often none of them seem ideal (and some appear to subvert the 
original design/architecture - the justification for which don't 
seem too coherent anymore). And whilst Struts offers a lot of 
function

Re: Wouldn't validation be better performed by Actions rather than ActionForms?

2005-03-18 Thread Lawrie Gallardo
Thanks Rick,
From what I have read so far it seems that Struts requires you to know quite 
a few "work-arounds" in order to get it to do what you want.
In fact, while I feel I have gained a pretty good idea of the Struts 
architecture and all the different ways of doing things, I still feel like I 
have a mountain ahead of me to learn all the necessary tips and tricks to do 
any serious development with it...

Lawrie.
From: Rick Reumann <[EMAIL PROTECTED]>
Reply-To: "Struts Users Mailing List" 
To: Struts Users Mailing List 
Subject: Re: Wouldn't validation be better performed by Actions rather than 
ActionForms?
Date: Fri, 18 Mar 2005 14:16:21 -0500

Lawrie Gallardo wrote the following on 3/18/2005 12:17 PM:
Now if this is the case, would it not be better to have the ActionForm as 
basically a dum data holder and have the validation method in the Action 
classes instead? The strus-config.xml file could contain all the required 
declarative validation, transformation and mapping info, and the Action 
class could contain any validation, transformation, and mapping operations 
that were too complicated to be set up declaratively.
I agree totally and I call my validation from my Action classes. Example 
here (at the end) http://reumann.net/struts/articles/request_lists.jsp

(Note in that example, I call the form's validate method from my Action, 
but I only do that in the example to show that it can be done and to keep 
it simple. In practice I think it's much better to not even do the 
validation in the ActionForm's validate method - even if you are just 
invoking that method from elsewhere.)

--
Rick
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
_
It's fast, it's easy and it's free. Get MSN Messenger today! 
http://www.msn.co.uk/messenger

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


RE: Problems using JSTL with struts

2005-03-18 Thread Karr, David
I'm not sure what you mean by JSTL 2.0.  Did you mean JSP 2.0?  If you're 
really trying to use Struts in a JSP 2.0 container, then don't use Struts-EL.  
In that environment, the Struts tags will use the EL natively, and you'd use 
the JSTL version compatible with JSP 2.0 (not the one compatible with JSP 1.2). 
 If you try to use Struts-EL in that environment, you'll get messed up.

> -Original Message-
> From: Rodolfo García Esteban/CYII [mailto:[EMAIL PROTECTED] 
> Sent: Friday, March 18, 2005 1:51 AM
> To: user@struts.apache.org
> Subject: Problems using JSTL with struts
> 
> 
> Hi,
> 
> I have a little application done with struts 1.2 and 
> hibernate 2.1, I want 
> to migrate it to JSTL 2.0, and struts-EL. I have done the next:
> 
> 1. Install jstl, adding to the WEB-INF/lib jstl.jar 
> 2. Writing in the pages then taglib clause to import the tags.
> 
> But I have the next problems.
> 
> 1 when I do  for get the actionForm return null, I 
> can manage the 
> form.
> 2. when I do  content of , I see as a literal "${}".
> 
> Has somebody use JSTL and Struts-EL with Struts 1.2? Do 
> somebody knows the 
> solution for my problem?
> 
> I would apreciatte any help
> 
> Best regards
> 
> Rodolfo
> 

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



Re: Wouldn't validation be better performed by Actions rather than ActionForms?

2005-03-18 Thread Lawrie Gallardo
Thanks for your detailed answers, Joe.
Just a few queries though:
Now, if my understanding is correct:
1. There is always a one-to-one mapping between an ActionForm and an 
ActionMapping,
Often not true.  Earlier today on the dev-list Ted H. described a case 
where you might have a long form composed
But isn't this subverting the ActionForm from its original design? I'll have 
to find that thread and read it before I say too much - but surely the whole 
point of an ActionForm is that it contains ALL the data from a submitted 
form?

2. Struts best practice is to have each Action class handle all possible 
operations for the HTML request it deals with using DispatchLookupAction 
or something similar,
I don't know if dispatch style is "best practice."  It's my preferred 
approach, but many experienced Struts developers don't like it much at all. 
 And then you've got wackos like Frank Z who like to write more code just 
to show off their typing skills.

I'm relatively new to Struts and I have to say that I've found it to have a 
realtively steep learning curve. And the only reason for this is that there 
are so many different ways to do things and no definitive best ways of 
achieving anything. The phrase "Jack of all trades and master of none" 
springs (sic) to mind. I'd much rather there was a bit of focus to the 
framework than the mass of competing options. "Make the simple things simple 
and the hard things possible" and all that...

Now if this is the case, would it not be better to have the ActionForm as 
basically a dum data holder and have the validation method in the Action 
classes instead?
Sounds like WebWork.  http://opensymphony.com/webwork/
My main motivation for learning Struts is that a lot of contracts are now 
specifying it as a requirement. Unfortunately, there doesn't seem to be 
anywhere near the same demand for WebWork, Spring MVC or Tapestry so it 
looks like I'm pretty much stuck with learning Struts.

If I didn't need to be pragmatic I would certainly be more than tempted to 
go with WebWork, Spring MVC or Tapestry (or a combination of them).

Is it just down to design decisions made in early versions of Struts and 
backward compatibility that things are the way they are? Or are there good 
arguments for having the validation method in ActionForm? Am I missing 
something here?
The main reason you can't do it that way in Struts today is that Actions 
may service multiple threads and thus must remain stateless, while request 
data is inherently about state.  WebWork, for example, instantiates its 
controller-type classes per-request, which makes it safe to populate them 
with request values and integrate request validation and control logic.

Is object creation / garbage collection really that expensive any more? Is 
there any real reason for sticking with the current multithreaded 
one-Action-for-all-requests model rather than moving to an 
Action-per-request model. It seems to me that there should be a very good 
one in order to justify the coding style restrictions that the multithreaded 
model entails.

However, even sticking to the current multithreaded Action model, why would 
this cause problems with validation? The ActionForm is currently passed by 
the ActionServlet as a parameter to the Action's execute() method - surely 
the ActionServlet could similarly pass the ActionFrom as a parameter to a 
validate() method on an Action object?

I have to say that learning Struts has been a bit of a disheartening 
experience... There are frequently numerous ways of doing things, and often 
none of them seem ideal (and some appear to subvert the original 
design/architecture - the justification for which don't seem too coherent 
anymore). And whilst Struts offers a lot of functionality, and is very 
flexible, it just seems to me  that there are a number of ways it could be 
improved upon / simplified that will never happen because it would break 
backwards-compatibility. I feel like it is going to take me weeks to work 
out the best way to do everything I need to be able to do (and whilst I'm 
doing this I'll have the thought at the back of my mind that I could be 
doing them much less painfully and efficiently with another framework...).

Lawrie.
From: Joe Germuska <[EMAIL PROTECTED]>
Reply-To: "Struts Users Mailing List" 
To: "Lawrie Gallardo" <[EMAIL PROTECTED]>, user@struts.apache.org
Subject: Re: Wouldn't validation be better performed by Actions rather than 
ActionForms?
Date: Fri, 18 Mar 2005 11:42:18 -0600

At 5:17 PM + 3/18/05, Lawrie Gallardo wrote:
I'm still relatively new to Struts, but I can't help but feel that 
validation would be better performed by Action classes rather than 
ActionForm classes.

It seems to me that, ideally, you want
1. Validation,
2. Transformations (ie convert separate day, month and year HTML fields to 
Java Date object), and
3. Mapping of ActionForm fields (/HTML parameters) to Domain POJOs / DTOs
to all be configured in the same config file (t

Re: html: tags part2

2005-03-18 Thread Rick Reumann
Scott Purcell wrote the following on 3/18/2005 1:29 PM:
Can I create a image that is a src for a submit, or cancel, or js function?
Why not just use a regular image wrapped with an href and use javascript?
example...

  

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


Re: Interesting problem...

2005-03-18 Thread Rick Reumann
I posed your question to a colleague of mine, because this problem is 
way beyond my puny knowledge. Anyway, his response, for what it's worth:

>
My first instinct is to call this a Supremely Bad Idea.  There WILL be
conflicts.  You can bet on it.  Best to have a single "maintenance"
process on a single host that fails over as needed.  Alternatively, rely
on shared/exclusive table-level locking which is extremely efficient,
widely supported, and does not suffer from the issues that row-level
locking is famous for.
If the random number generator is still insisted upon, there are
standard solutions for seeding it.  The java.security.SecureRandom class
uses host and network performance and latency metrics to seed itself.
While that might not be quite as well-seeded as a "pot of boiling
water", it's pretty darn close.
If that's not sufficient and you're running on a UNIX-style system
(Linux, BSD, Solaris, etc), you can read a block from /dev/random and
seed your generator with that.  It's a system-level random state that
survives reboot.
Finally, you can seed it with a UUID.  Most containers these days
provide some sort of UUID service, and if not then there are example
UUID generators all over the net.
<

Frank W. Zammetti wrote the following on 3/18/2005 10:35 AM:
Oh boy, I got a good one!  It's only related to Struts in that the
application in question is Struts-based, so I hope no one minds a semi-OT
question...
Here's the situation... An app I wrote has a daemon thread that is spawned
at startup (from a Struts plugin) that does periodic background processing
tasks.  This works great, never had a bit of trouble.
Now though, the app is moving from a single server to a clusted environment.
So, what's going to happen is that each server in the cluster will have
its own instance of the thread running on it.  Not a huge problem except
that I have to be sure only one instance of the thread (i.e., one server
in the cluster) is executing concurrently.
The easy solution is just a database table that is checked when the thread
wakes up.  If there is no entry in it, then there is no other instance
running, so it can write an entry to the table and go off and do its
thing.
I want to be extremely certain that no issues arise in terms of one
instance of the thread reading from the database while another instance is
writing, etc.  So, aside from transactional database calls and row-level
locking, I want to do one more thing: I want the thread to sleep a random
number of seconds (1-300) at startup.  This will ensure that, all the
database locking and such aside, the threads should all be offset from one
another in terms of when they run.
So, I need a random number generated when the thread starts up.  As we all
know though, random number generation on most computers that don't have
something like a Brownian motion sensor attached stuck in a cup of boiling
coffee can't generate truly random numbers.  So, in theory, what could
happen is that if all the servers in the cluster come up at the same time,
the threads could wind up running at the same time regardless of the
random sleep at the start!  It might never happen in reality, small
fluctuations would probably offset them anyway, but I want to be more
certain than that.
So now we're at the crux of the problem...
I can't just seed the random number generator with the current time
because it concievably might not be random enough.  So, I thought I could
just tally up the octets of the server's IP address and add that to the
current time.  Then the seed on each server should be different enough.
But, there doesn't appear to be any way to get the server IP address
independant of a request, so I can't get at it in my plugin.  Anyone know
differently?
Assuming that is the case, can anyone think of any other way to seed the
generator that would ensure a different value on different machines in the
cluster?  There are some options like encoding the individual server names
in my app's config file with a different seed value for each, but that
makes maintenance a pain if a new server is added or one removed or
addresses simply changed.
Any ideas?  Thanks!

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


RE: How to search this list?

2005-03-18 Thread Justin Morgan
Another option:
http://desktop.google.com/ (if you're using Outlook or other mail client
with a search plugin available)

-Justin



-Original Message-
From: jelything [mailto:[EMAIL PROTECTED] 
Sent: Friday, March 18, 2005 1:36 PM
To: struts-user@jakarta.apache.org
Subject: How to search this list?


Hi there,

What is the best way to access this list if you wanted to search it? 
My old method stopped working and the other sites I use to access it
don't seem to search at or or well.

Thanks,
J




-
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: Wouldn't validation be better performed by Actions rather than ActionForms?

2005-03-18 Thread Rick Reumann
Lawrie Gallardo wrote the following on 3/18/2005 12:17 PM:
Now if this is the case, would it not be better to have the ActionForm 
as basically a dum data holder and have the validation method in the 
Action classes instead? The strus-config.xml file could contain all the 
required declarative validation, transformation and mapping info, and 
the Action class could contain any validation, transformation, and 
mapping operations that were too complicated to be set up declaratively.
I agree totally and I call my validation from my Action classes. Example 
here (at the end) http://reumann.net/struts/articles/request_lists.jsp

(Note in that example, I call the form's validate method from my Action, 
but I only do that in the example to show that it can be done and to 
keep it simple. In practice I think it's much better to not even do the 
validation in the ActionForm's validate method - even if you are just 
invoking that method from elsewhere.)

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


Re: How to search this list?

2005-03-18 Thread jelything

Thanks!  That's exactly what I was looking for!

J

--- In [EMAIL PROTECTED], Hubert Rabago <[EMAIL PROTECTED]> wrote:
> I still use http://marc.theaimsgroup.com/?l=struts-user
> Some prefer http://news.gmane.org/gmane.comp.jakarta.struts.user
> Others like http://www.mail-archive.com/user%40struts.apache.org/
> 
> Hubert
> 




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



[MASSIVELY OT AT THIS POINT] Re: Interesting problem...

2005-03-18 Thread Frank W. Zammetti
On Fri, March 18, 2005 1:46 pm, Kris Schneider said:
> Actually, I was thinking more along the lines of Radar's precog abilities.
> So,
> if you weren't aware the nick was coming, then it obviously doesn't fit
> ;-).
> Anyway, for better or worse, you've already got a namesake from the show.
> All
> we can hope for you is that you've got your own real-life Hot
> Lips...whatever
> form that may take... ;-)

Ah, didn't catch that.  Very clever! :)

Actually, I always found Hot Lips rather unattractive, except in the movie
where she was quite nice for sure.  Not on the show though.

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



Re: How to search this list?

2005-03-18 Thread Hubert Rabago
I still use http://marc.theaimsgroup.com/?l=struts-user
Some prefer http://news.gmane.org/gmane.comp.jakarta.struts.user
Others like http://www.mail-archive.com/user%40struts.apache.org/

Hubert

On Fri, 18 Mar 2005 18:36:18 -, jelything <[EMAIL PROTECTED]> wrote:
> 
> Hi there,
> 
> What is the best way to access this list if you wanted to search it?
> My old method stopped working and the other sites I use to access it
> don't seem to search at or or well.
> 
> Thanks,
> J
> 
> -
> 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: ActionForm problem

2005-03-18 Thread Hyrum
Props to Rick as well.  You were dead on.

-Original Message-
From: Rick Reumann [mailto:[EMAIL PROTECTED] 
Sent: Friday, March 18, 2005 9:42 AM
To: Struts Users Mailing List
Subject: Re: ActionForm problem

Just curious, is your boolean getter autogenerated? It might be set up as

isSsnOnFile

which will work fine for booleans, but when you change to String it 
needs to find getSsnOnFile. My guess is maybe you changed the type but 
didn't change the syntax of the getter?

Hyrum wrote the following on 3/18/2005 10:14 AM:
> I would still like to know what the root problem is here, the tag thing
> aside.  Why can't the ValidatorActionForm see my value "ssnOnFile" when I
> change the type from boolean to String??  Just for future reference,
anyone
> have any ideas??
> 
> -Original Message-
> From: Hyrum [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, March 17, 2005 12:56 PM
> To: user@struts.apache.org
> Subject: ActionForm problem
> 
> I have successfully populated a jsp with items from a ValidatorActionForm.
> One of the properties is a boolean, and it is printing the word "true" on
my
> page, where I want a 'Y' or 'N'.  So I changed the ValidatorForm so that
the
> property is a string.  Now I am getting this error:
> 
>  
> 
> An error occurred while evaluating custom action attribute "value" with
> value "${manageFilerForm.ssnOnFile}": Unable to find a value for
"ssnOnFile"
> in object of class "com.trmarket.tax.forms.ManageFilerForm" using operator
> "." (null)
> 
>  
> 
> I haven't changed the name of the property, just the type.  Does anyone
know
> what is causing this error?  Any help would be much appreciated.  Thanx.
> 
>  
> 
> Hyrum Ward
> 
> Software Developer
> 
> T&R Tax Services
> 
>  
> 
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


-- 
Rick


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



RE: ActionForm problem

2005-03-18 Thread Hyrum
Props to Rick as well.  You were dead on.

-Original Message-
From: Rick Reumann [mailto:[EMAIL PROTECTED] 
Sent: Friday, March 18, 2005 9:42 AM
To: Struts Users Mailing List
Subject: Re: ActionForm problem

Just curious, is your boolean getter autogenerated? It might be set up as

isSsnOnFile

which will work fine for booleans, but when you change to String it 
needs to find getSsnOnFile. My guess is maybe you changed the type but 
didn't change the syntax of the getter?

Hyrum wrote the following on 3/18/2005 10:14 AM:
> I would still like to know what the root problem is here, the tag thing
> aside.  Why can't the ValidatorActionForm see my value "ssnOnFile" when I
> change the type from boolean to String??  Just for future reference,
anyone
> have any ideas??
> 
> -Original Message-
> From: Hyrum [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, March 17, 2005 12:56 PM
> To: user@struts.apache.org
> Subject: ActionForm problem
> 
> I have successfully populated a jsp with items from a ValidatorActionForm.
> One of the properties is a boolean, and it is printing the word "true" on
my
> page, where I want a 'Y' or 'N'.  So I changed the ValidatorForm so that
the
> property is a string.  Now I am getting this error:
> 
>  
> 
> An error occurred while evaluating custom action attribute "value" with
> value "${manageFilerForm.ssnOnFile}": Unable to find a value for
"ssnOnFile"
> in object of class "com.trmarket.tax.forms.ManageFilerForm" using operator
> "." (null)
> 
>  
> 
> I haven't changed the name of the property, just the type.  Does anyone
know
> what is causing this error?  Any help would be much appreciated.  Thanx.
> 
>  
> 
> Hyrum Ward
> 
> Software Developer
> 
> T&R Tax Services
> 
>  
> 
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


-- 
Rick


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



Re: Wouldn't validation be better performed by Actions rather than ActionForms?

2005-03-18 Thread Hubert Rabago
As to "whether this is the right thing to do", I would say yes, IMHO. 
I understand why you may not like it, though.  For the customization
you want, you can override the RequestProcessor (or implement your own
ComposableRequestProcessor commands if you're using 1.3) and change
how validation is performed.

Hubert

On Fri, 18 Mar 2005 18:20:56 +, Lawrie Gallardo
<[EMAIL PROTECTED]> wrote:
> Sorry Hubert, I think you misunderstood me... I realise that in the current
> design of Struts the Action class execute() method is only called by the
> ActionServlet after the ActionServlet has invoked the validate method of the
> ActionForm (which in the case of ValidatingActionForm baseclass invokes the
> Validator plug-in validation method). My question was whether this was the
> right thing to do, or whether Struts could be implemented so that
> ActioonServlet invoked the Validator plug-in validation from an Action
> baseclass's validate method() instead, with ActionForms being reduced to
> just dumb data holders.
> 
> The reasons why I wondered if this design was feasible / preferable are
> detailed in my original post.
> 
> Lawrie
> 
> >From: Hubert Rabago <[EMAIL PROTECTED]>
> >Reply-To: Hubert Rabago <[EMAIL PROTECTED]>
> >To: Struts Users Mailing List 
> >Subject: Re: Wouldn't validation be better performed by Actions rather than
> >ActionForms?
> >Date: Fri, 18 Mar 2005 11:55:24 -0600
> >
> >It allows you to handle simple validations outside of the Action
> >class, which would only be called when there's data that can be passed
> >to the business tier (which may, among other things, perform business
> >validation).  Also, as the Validator plugin shows, it enabled
> >declarative validation.  So now, we don't even have to write
> >validation code in our action forms.  By the time execution reaches
> >the Action object, it can go straight to conversion without having to
> >worry about ParseException or NumberFormatException.
> >
> >Hubert
> >
> >On Fri, 18 Mar 2005 17:47:14 +, Lawrie Gallardo
> ><[EMAIL PROTECTED]> wrote:
> > > I appreciate that there are different levels of validation - I just
> >can't
> > > see why any of them are better handled by ActionForm (which could
> >otherwise
> > > just be a dum strut object/ map / etc) than by Action. Surely it is
> >better
> > > to keep all your presentation tier validation together in one place
> >where
> > > possible (although obviously you want to keep your business logic
> >validation
> > > with your business objects)?
> > >
> > > Lawrie
> > >
> > > >From: Hubert Rabago <[EMAIL PROTECTED]>
> > > >Reply-To: Hubert Rabago <[EMAIL PROTECTED]>
> > > >To: Struts Users Mailing List 
> > > >Subject: Re: Wouldn't validation be better performed by Actions rather
> >than
> > > >ActionForms?
> > > >Date: Fri, 18 Mar 2005 11:27:11 -0600
> > > >
> > > >You raise a lot of points, and I admit I won't be able to respond to
> > > >all of them in one email (due mostly to time constraints).  Besides,
> > > >there are others who could respond, so I'll leave some out for them.
> > > >:)
> > > >
> > > >There are/can be different levels of validation.  Some validation you
> > > >perform before others.  For example, an HR entry screen might contain
> > > >a field for salary.  You would validate that the field contains a
> > > >valid String that can be converted into a double, and you'd also make
> > > >sure it doesn't exceed certain bounds (like, say, USD 10,000,000 for a
> > > >junior programmer).  If the field doesn't contain a valid double,
> > > >there's no sense checking its value boundaries.  The field itself is
> > > >not syntactically valid.  This level of validation is what's most
> > > >often assigned to the ActionForm.  Much of these can be
> > > >automated/declared and oftentimes the Action doesn't even need to
> > > >participate.  Hence, we let the ActionForm carry out this part, and if
> > > >it fails at this level, we don't even bother calling the Action.
> > > >
> > > >Hubert
> > > >
> > > >On Fri, 18 Mar 2005 17:17:39 +, Lawrie Gallardo
> > > ><[EMAIL PROTECTED]> wrote:
> > > > > I'm still relatively new to Struts, but I can't help but feel that
> > > > > validation would be better performed by Action classes rather than
> > > > > ActionForm classes.
> > > > >
> > > > > It seems to me that, ideally, you want
> > > > > 1. Validation,
> > > > > 2. Transformations (ie convert separate day, month and year HTML
> >fields
> > > >to
> > > > > Java Date object), and
> > > > > 3. Mapping of ActionForm fields (/HTML parameters) to Domain POJOs /
> > > >DTOs
> > > > > to all be configured in the same config file (to minimise
> >duplication)
> > > >and
> > > > > to be implemented in the same class rather than scattered between
> > > >multiple
> > > > > config files and classes.
> > > > >
> > > > > Now, if my understanding is correct:
> > > > > 1. There is always a one-to-one mapping between an ActionForm and an
> > > > > ActionMapping,
> > > > > 2. Struts best practice

Re: Interesting problem...

2005-03-18 Thread Kris Schneider
Quoting "Frank W. Zammetti" <[EMAIL PROTECTED]>:

> On Fri, March 18, 2005 1:30 pm, Kris Schneider said:
> > Quoting "Frank W. Zammetti" <[EMAIL PROTECTED]>:
> >
> >> I've wanted a nickname all my life (aside from the explicitives some
> >> would
> >> use!)... never thought it's be Radar :)
> >
> > Then it probably shouldn't be ;-)
> 
> Oh no, I opened my mouth with regard to my typing prowess of my own
> volition, and that was the catalyst for Radar so now I gotta suffer with
> it 'till the day I die. :)  I can blame no one but myself!

Actually, I was thinking more along the lines of Radar's precog abilities. So,
if you weren't aware the nick was coming, then it obviously doesn't fit ;-).
Anyway, for better or worse, you've already got a namesake from the show. All
we can hope for you is that you've got your own real-life Hot Lips...whatever
form that may take... ;-)

> I don't mind... the only problem is now I gotta go get all new business
> cards printed up :)
> 
> -- 
> Frank W. Zammetti
> Founder and Chief Software Architect
> Omnytex Technologies
> http://www.omnytex.com

-- 
Kris Schneider 
D.O.Tech   

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



Validating Nested DynaValidator Forms

2005-03-18 Thread jelything

I have a DynaValidatorForm that holds many items, including an
ArrayList of DynaValidatorForms.  Calling validate() on the main form
works just fine, but how do I get the nested forms to validate?

If I iterate through the ArrayList, and cast them back to a
DynaValidatorForm and then simply call validate on them, I get:

java.lang.NullPointerException at
org.apache.struts.validator.DynaValidatorForm.validate(DynaValidatorForm.java:144)

Any ideas?

J





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



Re: How to search this list?

2005-03-18 Thread PA
On Mar 18, 2005, at 19:36, jelything wrote:
What is the best way to access this list if you wanted to search it?
http://zoe.nu/
Cheers
--
PA, Onnay Equitursay
http://alt.textdrive.com/
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


How to search this list?

2005-03-18 Thread jelything

Hi there,

What is the best way to access this list if you wanted to search it? 
My old method stopped working and the other sites I use to access it
don't seem to search at or or well.

Thanks,
J




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



Re: Interesting problem...

2005-03-18 Thread Frank W. Zammetti
On Fri, March 18, 2005 1:30 pm, Kris Schneider said:
> Quoting "Frank W. Zammetti" <[EMAIL PROTECTED]>:
>
>> I've wanted a nickname all my life (aside from the explicitives some
>> would
>> use!)... never thought it's be Radar :)
>
> Then it probably shouldn't be ;-)

Oh no, I opened my mouth with regard to my typing prowess of my own
volition, and that was the catalyst for Radar so now I gotta suffer with
it 'till the day I die. :)  I can blame no one but myself!

I don't mind... the only problem is now I gotta go get all new business
cards printed up :)

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com


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



Re: Interesting problem...

2005-03-18 Thread Kris Schneider
Quoting "Frank W. Zammetti" <[EMAIL PROTECTED]>:

> I've wanted a nickname all my life (aside from the explicitives some would
> use!)... never thought it's be Radar :)

Then it probably shouldn't be ;-)

> -- 
> Frank W. Zammetti
> Founder and Chief Software Architect
> Omnytex Technologies
> http://www.omnytex.com
> 
> On Fri, March 18, 2005 1:09 pm, Dakota Jack said:
> > The class works, but I don't think it is what you want.  Maybe it is.
> > Just don't have high expectations.  I did and was disappointed.  Just
> > trying to help you out, Radar!  ///;-)
> >
> > Jack
> >
> >
> > On Fri, 18 Mar 2005 12:21:28 -0500 (EST), Frank W. Zammetti
> > <[EMAIL PROTECTED]> wrote:
> >> Why do you think it wouldn't work?  Does it sometimes return incorrect
> >> information in some setups?
> >>
> >> I thought of doing some kind of mini-browser-type thing, but before I go
> >> down that road I wanted to explore some simpler solutions.  The Commons
> >> ID
> >> thing is very nice, but I'm not so sure I'm comfortable putting in
> >> something that isn't actually released yet.
> >>
> >> That being said, what was on the site for it got me to thinking... I
> >> think
> >> if I do a combination of the sum of the MAC address digits + the current
> >> time + the hashCode of the IP address, that is probably as random as I
> >> need.  But, if you know something about InetAddress that would make this
> >> not work, I'm all ears :)
> >>
> >> Of course, I'm not sure how to get the MAC address yet, but one problem
> >> at
> >> a time...
> >>
> >> --
> >> Frank W. Zammetti
> >> Founder and Chief Software Architect
> >> Omnytex Technologies
> >> http://www.omnytex.com
> >>
> >> On Fri, March 18, 2005 12:14 pm, Dakota Jack said:
> >> > InetAddress might not get the answer for you, Frank.  I don't know
> >> > what your setup is, but you can go to any ip address service outside
> >> > your system and get a unique return address for your machines with a
> >> > mini-browser.
> >> >
> >> > Jack
> >> >
> >> >
> >> > On Fri, 18 Mar 2005 11:36:10 -0500 (EST), Frank W. Zammetti
> >> > <[EMAIL PROTECTED]> wrote:
> >> >> Yes, I think InetAddress just might do the trick.  Thank you Kris!
> >> >>
> >> >> --
> >> >> Frank W. Zammetti
> >> >> Founder and Chief Software Architect
> >> >> Omnytex Technologies
> >> >> http://www.omnytex.com
> >> >>
> >> >> On Fri, March 18, 2005 11:24 am, Kris Schneider said:
> >> >> > Will InetAddress.getLocalHost() work for you?
> >> >> > NetworkInterface.getNetworkInterfaces() might also be of interest.
> >> Or,
> >> >> you
> >> >> > might want to create yourself an instance of java.rmi.dgc.VMID...
> >> >> >
> >> >> > Quoting "Frank W. Zammetti" <[EMAIL PROTECTED]>:
> >> >> >
> >> >> >> Oh boy, I got a good one!  It's only related to Struts in that the
> >> >> >> application in question is Struts-based, so I hope no one minds a
> >> >> >> semi-OT
> >> >> >> question...
> >> >> >>
> >> >> >> Here's the situation... An app I wrote has a daemon thread that is
> >> >> >> spawned
> >> >> >> at startup (from a Struts plugin) that does periodic background
> >> >> >> processing
> >> >> >> tasks.  This works great, never had a bit of trouble.
> >> >> >>
> >> >> >> Now though, the app is moving from a single server to a clusted
> >> >> >> environment.
> >> >> >>
> >> >> >> So, what's going to happen is that each server in the cluster will
> >> >> have
> >> >> >> its own instance of the thread running on it.  Not a huge problem
> >> >> except
> >> >> >> that I have to be sure only one instance of the thread (i.e., one
> >> >> server
> >> >> >> in the cluster) is executing concurrently.
> >> >> >>
> >> >> >> The easy solution is just a database table that is checked when
> >> the
> >> >> >> thread
> >> >> >> wakes up.  If there is no entry in it, then there is no other
> >> >> instance
> >> >> >> running, so it can write an entry to the table and go off and do
> >> its
> >> >> >> thing.
> >> >> >>
> >> >> >> I want to be extremely certain that no issues arise in terms of
> >> one
> >> >> >> instance of the thread reading from the database while another
> >> >> instance
> >> >> >> is
> >> >> >> writing, etc.  So, aside from transactional database calls and
> >> >> row-level
> >> >> >> locking, I want to do one more thing: I want the thread to sleep a
> >> >> >> random
> >> >> >> number of seconds (1-300) at startup.  This will ensure that, all
> >> the
> >> >> >> database locking and such aside, the threads should all be offset
> >> >> from
> >> >> >> one
> >> >> >> another in terms of when they run.
> >> >> >>
> >> >> >> So, I need a random number generated when the thread starts up.
> >> As
> >> >> we
> >> >> >> all
> >> >> >> know though, random number generation on most computers that don't
> >> >> have
> >> >> >> something like a Brownian motion sensor attached stuck in a cup of
> >> >> >> boiling
> >> >> >> coffee can't generate truly random numbers.  So, in theory, what
> >> >> could
> >> >> >> happen is that if all the se

html: tags part2

2005-03-18 Thread Scott Purcell
Hello,
Sorry these tags are killing me today, I have the html: docs up, but they are 
long, and things are not clicking today.
 
I am trying to replace the following two buttons (one submits and one cancels 
the form) with html: tags, so my whole site is consistent.
current config has a hreflink with an image:

http://mysite/dealer> 
http://mysite/dealer";>


 
I am trying this using html: tags but i cannot figure out how to get an image 
to show:
startend
this shows the words "submit query" but does not show an image.
 
Can I create a image that is a src for a submit, or cancel, or js function?
 
Thanks
 
Scott 
 


Re: Interesting problem...

2005-03-18 Thread Frank W. Zammetti
I've wanted a nickname all my life (aside from the explicitives some would
use!)... never thought it's be Radar :)

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com

On Fri, March 18, 2005 1:09 pm, Dakota Jack said:
> The class works, but I don't think it is what you want.  Maybe it is.
> Just don't have high expectations.  I did and was disappointed.  Just
> trying to help you out, Radar!  ///;-)
>
> Jack
>
>
> On Fri, 18 Mar 2005 12:21:28 -0500 (EST), Frank W. Zammetti
> <[EMAIL PROTECTED]> wrote:
>> Why do you think it wouldn't work?  Does it sometimes return incorrect
>> information in some setups?
>>
>> I thought of doing some kind of mini-browser-type thing, but before I go
>> down that road I wanted to explore some simpler solutions.  The Commons
>> ID
>> thing is very nice, but I'm not so sure I'm comfortable putting in
>> something that isn't actually released yet.
>>
>> That being said, what was on the site for it got me to thinking... I
>> think
>> if I do a combination of the sum of the MAC address digits + the current
>> time + the hashCode of the IP address, that is probably as random as I
>> need.  But, if you know something about InetAddress that would make this
>> not work, I'm all ears :)
>>
>> Of course, I'm not sure how to get the MAC address yet, but one problem
>> at
>> a time...
>>
>> --
>> Frank W. Zammetti
>> Founder and Chief Software Architect
>> Omnytex Technologies
>> http://www.omnytex.com
>>
>> On Fri, March 18, 2005 12:14 pm, Dakota Jack said:
>> > InetAddress might not get the answer for you, Frank.  I don't know
>> > what your setup is, but you can go to any ip address service outside
>> > your system and get a unique return address for your machines with a
>> > mini-browser.
>> >
>> > Jack
>> >
>> >
>> > On Fri, 18 Mar 2005 11:36:10 -0500 (EST), Frank W. Zammetti
>> > <[EMAIL PROTECTED]> wrote:
>> >> Yes, I think InetAddress just might do the trick.  Thank you Kris!
>> >>
>> >> --
>> >> Frank W. Zammetti
>> >> Founder and Chief Software Architect
>> >> Omnytex Technologies
>> >> http://www.omnytex.com
>> >>
>> >> On Fri, March 18, 2005 11:24 am, Kris Schneider said:
>> >> > Will InetAddress.getLocalHost() work for you?
>> >> > NetworkInterface.getNetworkInterfaces() might also be of interest.
>> Or,
>> >> you
>> >> > might want to create yourself an instance of java.rmi.dgc.VMID...
>> >> >
>> >> > Quoting "Frank W. Zammetti" <[EMAIL PROTECTED]>:
>> >> >
>> >> >> Oh boy, I got a good one!  It's only related to Struts in that the
>> >> >> application in question is Struts-based, so I hope no one minds a
>> >> >> semi-OT
>> >> >> question...
>> >> >>
>> >> >> Here's the situation... An app I wrote has a daemon thread that is
>> >> >> spawned
>> >> >> at startup (from a Struts plugin) that does periodic background
>> >> >> processing
>> >> >> tasks.  This works great, never had a bit of trouble.
>> >> >>
>> >> >> Now though, the app is moving from a single server to a clusted
>> >> >> environment.
>> >> >>
>> >> >> So, what's going to happen is that each server in the cluster will
>> >> have
>> >> >> its own instance of the thread running on it.  Not a huge problem
>> >> except
>> >> >> that I have to be sure only one instance of the thread (i.e., one
>> >> server
>> >> >> in the cluster) is executing concurrently.
>> >> >>
>> >> >> The easy solution is just a database table that is checked when
>> the
>> >> >> thread
>> >> >> wakes up.  If there is no entry in it, then there is no other
>> >> instance
>> >> >> running, so it can write an entry to the table and go off and do
>> its
>> >> >> thing.
>> >> >>
>> >> >> I want to be extremely certain that no issues arise in terms of
>> one
>> >> >> instance of the thread reading from the database while another
>> >> instance
>> >> >> is
>> >> >> writing, etc.  So, aside from transactional database calls and
>> >> row-level
>> >> >> locking, I want to do one more thing: I want the thread to sleep a
>> >> >> random
>> >> >> number of seconds (1-300) at startup.  This will ensure that, all
>> the
>> >> >> database locking and such aside, the threads should all be offset
>> >> from
>> >> >> one
>> >> >> another in terms of when they run.
>> >> >>
>> >> >> So, I need a random number generated when the thread starts up.
>> As
>> >> we
>> >> >> all
>> >> >> know though, random number generation on most computers that don't
>> >> have
>> >> >> something like a Brownian motion sensor attached stuck in a cup of
>> >> >> boiling
>> >> >> coffee can't generate truly random numbers.  So, in theory, what
>> >> could
>> >> >> happen is that if all the servers in the cluster come up at the
>> same
>> >> >> time,
>> >> >> the threads could wind up running at the same time regardless of
>> the
>> >> >> random sleep at the start!  It might never happen in reality,
>> small
>> >> >> fluctuations would probably offset them anyway, but I want to be
>> more
>> >> >> certain than that.
>> >> >>
>> >> 

Re: Wouldn't validation be better performed by Actions rather than ActionForms?

2005-03-18 Thread Frank W. Zammetti
I've always felt that class sizes should be reduced wherever possible. 
Even when the code is extremely simplistic, as should be the case in
Actions generally, it's still more difficult to look through a higher
volume of code (this is in fact a known metric that most code analysis
tools use).  DispatchActions and their bretherin seem to fly in the face
of this idea.  I don't mean to imply they are bad in every case, certainly
not, but I personally find them to be a bit overused.

I only mentioned it because of the comment by the OP about DispatchActions
being a "best practice".  Maybe they are considered that at this point, I
just wasn't aware if they are.

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com

On Fri, March 18, 2005 1:08 pm, Dakota Jack said:
> Where did you get this idea, Frank?  This seems out of the blue on a
> thread about validation.  I personally like the "new" dispatch action
> at http://www.michaelmcgrady.com/button/jsp/dispatch_action.jsp a lot.
>
> ///;-)
>
> Jack
>
> On Fri, 18 Mar 2005 12:25:00 -0500 (EST), Frank W. Zammetti
> <[EMAIL PROTECTED]> wrote:
>> Is it really true that DispatchAction is now the accepted "best
>> practice"?
>>  If so I have to say I disagree with that standard (if not, ignore me!)
>>
>
> --
> "You can lead a horse to water but you cannot make it float on its back."
> ~Dakota Jack~
>
> -
> 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: [Shale] Resource initialisation best practice

2005-03-18 Thread Duncan Mills
Right, this is more or less what I've gone for in the end, but the 
managed bean I'm creating was not referenced directly in the page, and 
it would have been a little artificial in that case to put it in. 
So I've resorted to a createValueBinding in the Shale init() method 
which bootstraps the bean, along with the specified managed properties 
from the faces-config and then populates it correctly.  I had so simply 
add a flag to the parent object to not do the post-processing on 
subsequent invocations.

Duncan
Craig McClanahan wrote:
A technique I like (and is actually used in the Use Cases example) is
to make your reference data into an application-scoped managed bean
(for stuff common to all users; use session scope if it is user
specific).  Then, the first use of a value binding that needs to load
the reference data will cause it to happen (via the managed beans
facility).
For example, there is a "select many" component listing available
categories on (among others) the logon/profile3.jsp page:
 
   
 
The "domains" bean is an application scoped managed bean that (for the
simple lists) has a getter for each one.  The contents of the list can
be composed with literal Java statements (as was done here for
simplicity), loaded from a database or web service call, or whatever
you need.
For extra credit, you can hook up JSF-Spring and use Spring's
mechanisms to configure the managed bean for you.
Craig
On Fri, 18 Mar 2005 10:21:47 +, Duncan Mills
<[EMAIL PROTECTED]> wrote:
 

Fellow Shale'ers,
Given the scenario when you have reference data to set up, say on the
application, which is not dependent on a particular view, but which must
be put in place before the first view is displayed, and given that there
is no single entry point for the app, what approach would you take?
What I'm currently doing is inserting a custom command into the Shale
preprocess chain . This works OK, however, I'm "distressed" by the fact
that I can't save the relevant state using a valueBinding because at the
point in time the Chain command is first executed there is no
FacesContext.  So instead I have to set the application attributes
directly.
Plan B would be to do the same setup in a common superclass of
viewController which will have access to a valid FacesContext, however,
I'd rather keep this general setup logically away from the per page
setup. Does anyone have any other ideas?
Duncan Mills
http://www.groundside.com/blog
-
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: Multiple ActionForms per ActionMapping

2005-03-18 Thread Dakota Jack
This is probably obvious, but you can choose to validate other than in
the ActionForm, which I do, and not validate in the Action as well,
which I also do.  I leave validation to a validation application which
sits between the business logic and the view for me.

Jack


On Fri, 18 Mar 2005 11:33:08 -0600, Joe Germuska <[EMAIL PROTECTED]> wrote:
> Hijack alert!
> 
> At 11:09 AM -0500 3/18/05, Rick Reumann wrote:
> >Well, actually I like to have my own validate() method in each of my
> >Dispatch Actions. I don't like having the framework call validate
> >for me. One of the main reason is that if I'm in my action and I
> >manually call my own action's validate() method then, if validation
> >fails, I can make sure my prep method is always called. I wrote
> >about this here http://reumann.net/struts/articles/request_lists.jsp
> >and at the end I give an example of what I like to do. (I'm curious,
> >in that approach you came up with, if validation were to fail, would
> >the extra 'setup' that you added to the action mapping be called? If
> >so, that would be very nice! if not then I'd still end up having to
> >use my prep/set up method).
> 
> This is one of the reasons I like a design which associates prep
> logic with the destination (forward) instead of the action/request.
> 
> If that's the only reason you validate in your actions instead of in
> the framework, maybe you'd like it too...
> 
> Joe
> 
> --
> Joe Germuska
> [EMAIL PROTECTED]
> http://blog.germuska.com
> "Narrow minds are weapons made for mass destruction"  -The Ex
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


-- 
"You can lead a horse to water but you cannot make it float on its back."
~Dakota Jack~

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



Re: Interesting problem...

2005-03-18 Thread Dakota Jack
The class works, but I don't think it is what you want.  Maybe it is. 
Just don't have high expectations.  I did and was disappointed.  Just
trying to help you out, Radar!  ///;-)

Jack


On Fri, 18 Mar 2005 12:21:28 -0500 (EST), Frank W. Zammetti
<[EMAIL PROTECTED]> wrote:
> Why do you think it wouldn't work?  Does it sometimes return incorrect
> information in some setups?
> 
> I thought of doing some kind of mini-browser-type thing, but before I go
> down that road I wanted to explore some simpler solutions.  The Commons ID
> thing is very nice, but I'm not so sure I'm comfortable putting in
> something that isn't actually released yet.
> 
> That being said, what was on the site for it got me to thinking... I think
> if I do a combination of the sum of the MAC address digits + the current
> time + the hashCode of the IP address, that is probably as random as I
> need.  But, if you know something about InetAddress that would make this
> not work, I'm all ears :)
> 
> Of course, I'm not sure how to get the MAC address yet, but one problem at
> a time...
> 
> --
> Frank W. Zammetti
> Founder and Chief Software Architect
> Omnytex Technologies
> http://www.omnytex.com
> 
> On Fri, March 18, 2005 12:14 pm, Dakota Jack said:
> > InetAddress might not get the answer for you, Frank.  I don't know
> > what your setup is, but you can go to any ip address service outside
> > your system and get a unique return address for your machines with a
> > mini-browser.
> >
> > Jack
> >
> >
> > On Fri, 18 Mar 2005 11:36:10 -0500 (EST), Frank W. Zammetti
> > <[EMAIL PROTECTED]> wrote:
> >> Yes, I think InetAddress just might do the trick.  Thank you Kris!
> >>
> >> --
> >> Frank W. Zammetti
> >> Founder and Chief Software Architect
> >> Omnytex Technologies
> >> http://www.omnytex.com
> >>
> >> On Fri, March 18, 2005 11:24 am, Kris Schneider said:
> >> > Will InetAddress.getLocalHost() work for you?
> >> > NetworkInterface.getNetworkInterfaces() might also be of interest. Or,
> >> you
> >> > might want to create yourself an instance of java.rmi.dgc.VMID...
> >> >
> >> > Quoting "Frank W. Zammetti" <[EMAIL PROTECTED]>:
> >> >
> >> >> Oh boy, I got a good one!  It's only related to Struts in that the
> >> >> application in question is Struts-based, so I hope no one minds a
> >> >> semi-OT
> >> >> question...
> >> >>
> >> >> Here's the situation... An app I wrote has a daemon thread that is
> >> >> spawned
> >> >> at startup (from a Struts plugin) that does periodic background
> >> >> processing
> >> >> tasks.  This works great, never had a bit of trouble.
> >> >>
> >> >> Now though, the app is moving from a single server to a clusted
> >> >> environment.
> >> >>
> >> >> So, what's going to happen is that each server in the cluster will
> >> have
> >> >> its own instance of the thread running on it.  Not a huge problem
> >> except
> >> >> that I have to be sure only one instance of the thread (i.e., one
> >> server
> >> >> in the cluster) is executing concurrently.
> >> >>
> >> >> The easy solution is just a database table that is checked when the
> >> >> thread
> >> >> wakes up.  If there is no entry in it, then there is no other
> >> instance
> >> >> running, so it can write an entry to the table and go off and do its
> >> >> thing.
> >> >>
> >> >> I want to be extremely certain that no issues arise in terms of one
> >> >> instance of the thread reading from the database while another
> >> instance
> >> >> is
> >> >> writing, etc.  So, aside from transactional database calls and
> >> row-level
> >> >> locking, I want to do one more thing: I want the thread to sleep a
> >> >> random
> >> >> number of seconds (1-300) at startup.  This will ensure that, all the
> >> >> database locking and such aside, the threads should all be offset
> >> from
> >> >> one
> >> >> another in terms of when they run.
> >> >>
> >> >> So, I need a random number generated when the thread starts up.  As
> >> we
> >> >> all
> >> >> know though, random number generation on most computers that don't
> >> have
> >> >> something like a Brownian motion sensor attached stuck in a cup of
> >> >> boiling
> >> >> coffee can't generate truly random numbers.  So, in theory, what
> >> could
> >> >> happen is that if all the servers in the cluster come up at the same
> >> >> time,
> >> >> the threads could wind up running at the same time regardless of the
> >> >> random sleep at the start!  It might never happen in reality, small
> >> >> fluctuations would probably offset them anyway, but I want to be more
> >> >> certain than that.
> >> >>
> >> >> So now we're at the crux of the problem...
> >> >>
> >> >> I can't just seed the random number generator with the current time
> >> >> because it concievably might not be random enough.  So, I thought I
> >> >> could
> >> >> just tally up the octets of the server's IP address and add that to
> >> the
> >> >> current time.  Then the seed on each server should be different
> >> enough.
> >> >>
> >> >> But, there doesn't ap

Re: Wouldn't validation be better performed by Actions rather than ActionForms?

2005-03-18 Thread Dakota Jack
Where did you get this idea, Frank?  This seems out of the blue on a
thread about validation.  I personally like the "new" dispatch action
at http://www.michaelmcgrady.com/button/jsp/dispatch_action.jsp a lot.

///;-)

Jack

On Fri, 18 Mar 2005 12:25:00 -0500 (EST), Frank W. Zammetti
<[EMAIL PROTECTED]> wrote:
> Is it really true that DispatchAction is now the accepted "best practice"?
>  If so I have to say I disagree with that standard (if not, ignore me!)
> 

-- 
"You can lead a horse to water but you cannot make it float on its back."
~Dakota Jack~

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



Re: Wouldn't validation be better performed by Actions rather than ActionForms?

2005-03-18 Thread Lawrie Gallardo
This was just my perception from reading Struts in Action and it was also 
explicitly stated in a couple of "Struts Best Practices" articles I found on 
the web.

Personally, I found it a little bit disconcerting that Action classes, that 
I thought were supposed to be an implentation of the Command Design Pattern, 
were now being used to process multiple operations. The only rationale I 
have seen given for using DispatchAction and similar is that they reduce 
class clutter, which I feel is a fairly weak argument for distorting the 
original design.

However, I can see the appeal of mapping each JSP page to one Action which 
deals with all possible operations for that page. This means you then have a 
one-to-one mapping of ActionForm classes to Action classes. This in turn 
means you could make some simplifications to the framework (reducing its 
complexity and the relatively steep learning curve) and could reduce 
duplication when configuring applications.

Lawrie
From: "Frank W. Zammetti" <[EMAIL PROTECTED]>
Reply-To: "Struts Users Mailing List" 
To: "Struts Users Mailing List" 
CC: user@struts.apache.org
Subject: Re: Wouldn't validation be better performed by Actions rather than 
 ActionForms?
Date: Fri, 18 Mar 2005 12:25:00 -0500 (EST)

Is it really true that DispatchAction is now the accepted "best practice"?
 If so I have to say I disagree with that standard (if not, ignore me!)
--
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
On Fri, March 18, 2005 12:17 pm, Lawrie Gallardo said:
> I'm still relatively new to Struts, but I can't help but feel that
> validation would be better performed by Action classes rather than
> ActionForm classes.
>
> It seems to me that, ideally, you want
> 1. Validation,
> 2. Transformations (ie convert separate day, month and year HTML fields 
to
> Java Date object), and
> 3. Mapping of ActionForm fields (/HTML parameters) to Domain POJOs / 
DTOs
> to all be configured in the same config file (to minimise duplication) 
and
> to be implemented in the same class rather than scattered between 
multiple
> config files and classes.
>
> Now, if my understanding is correct:
> 1. There is always a one-to-one mapping between an ActionForm and an
> ActionMapping,
> 2. Struts best practice is to have each Action class handle all possible
> operations for the HTML request it deals with using DispatchLookupAction
> or
> something similar,
> 3. Almost noone creates ActionForms manually any more - they use
> DynaActionForm (or validating variations of this). And for those who do
> still create ActionForms manually, they don't offer anything in the way 
of
> reuse, and are basically throw-away classes.
>
> Now if this is the case, would it not be better to have the ActionForm 
as
> basically a dum data holder and have the validation method in the Action
> classes instead? The strus-config.xml file could contain all the 
required
> declarative validation, transformation and mapping info, and the Action
> class could contain any validation, transformation, and mapping 
operations
> that were too complicated to be set up declaratively.
>
> Is it just down to design decisions made in early versions of Struts and
> backward compatibility that things are the way they are? Or are there 
good
> arguments for having the validation method in ActionForm? Am I missing
> something here?
>
> _
> Stay in touch with absent friends - get MSN Messenger
> http://www.msn.co.uk/messenger
>
>
> -
> 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]
_
Want to block unwanted pop-ups? Download the free MSN Toolbar now!  
http://toolbar.msn.co.uk/

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


Re: Wouldn't validation be better performed by Actions rather than ActionForms?

2005-03-18 Thread Frank W. Zammetti
On Fri, March 18, 2005 12:42 pm, Joe Germuska said:
> I don't know if dispatch style is "best practice."  It's my preferred
> approach, but many experienced Struts developers don't like it much
> at all.  And then you've got wackos like Frank Z who like to write
> more code just to show off their typing skills.

Oh geez, thanks a lot Joe... I just had everyone around staring at me
because you made me laugh so loud! :)

>>3. Almost noone creates ActionForms manually any more - they use
>>DynaActionForm (or validating variations of this).
>
> Frank, again.  ;-)

You know, it is telling about the industry that me hand-coding ActionForms
is considered "old-school" when everyone was doing it too 6-12 months ago!
:)  Slow the hell down! :)

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com


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



Re: Interesting problem...

2005-03-18 Thread Frank W. Zammetti
Commons ID has been in the sandbox for a year already?  Ugh, someone get a
release out! :)

I think the solution I used is going to suffice nicely.  I mean, in a
cluster each machine still has a unique IP address anyway, so that in and
of itself would have been enough.  But, adding in the VMID and current
time makes it even MORE certain to be unique.  Plus, in reading the
Commons ID page, that's very similar to how it is generating the UUIDs
anyway.

Thanks again, I very much appreciate the insight Martin!

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com

On Fri, March 18, 2005 12:53 pm, Martin Wegner said:
> Frank,
>
> I was a little hinky myself about using Common ID in production.  But I've
> been using it or over a year and it has performed admirably.  We haven't
> seen any problems with the package.
>
> As for getting the MAC address I had to solve that problem about six
> months ago.  I had to resort to Runtime.getRuntime().exec() (yuck).  Here
> is where the madness all started:
>
>http://forum.java.sun.com/thread.jsp?forum=4&thread=245711
>
> It is ugly but it does indeed work.  Until you run on a box that is not
> using English.  And then you have the fun of boxes that have VPN software
> installed.  And you have to watch out for disconnected media.  Etc.  Etc.
> Etc.
>
> Anyway, I got it work and now I pluck the MAC address from the local box.
> It is ugly but I had to do it.
>
> If anyone has a better way of getting the MAC address I would like to
> know.
>
>
> --Marty
>
> --- "Frank W. Zammetti" <[EMAIL PROTECTED]> wrote:
>
>> Why do you think it wouldn't work?  Does it sometimes return incorrect
>> information in some setups?
>>
>> I thought of doing some kind of mini-browser-type thing, but before I go
>> down that road I wanted to explore some simpler solutions.  The Commons
>> ID
>> thing is very nice, but I'm not so sure I'm comfortable putting in
>> something that isn't actually released yet.
>>
>> That being said, what was on the site for it got me to thinking... I
>> think
>> if I do a combination of the sum of the MAC address digits + the current
>> time + the hashCode of the IP address, that is probably as random as I
>> need.  But, if you know something about InetAddress that would make this
>> not work, I'm all ears :)
>>
>> Of course, I'm not sure how to get the MAC address yet, but one problem
>> at
>> a time...
>>
>> --
>> Frank W. Zammetti
>> Founder and Chief Software Architect
>> Omnytex Technologies
>> http://www.omnytex.com
>>
>> On Fri, March 18, 2005 12:14 pm, Dakota Jack said:
>> > InetAddress might not get the answer for you, Frank.  I don't know
>> > what your setup is, but you can go to any ip address service outside
>> > your system and get a unique return address for your machines with a
>> > mini-browser.
>> >
>> > Jack
>> >
>> >
>> > On Fri, 18 Mar 2005 11:36:10 -0500 (EST), Frank W. Zammetti
>> > <[EMAIL PROTECTED]> wrote:
>> >> Yes, I think InetAddress just might do the trick.  Thank you Kris!
>> >>
>> >> --
>> >> Frank W. Zammetti
>> >> Founder and Chief Software Architect
>> >> Omnytex Technologies
>> >> http://www.omnytex.com
>> >>
>> >> On Fri, March 18, 2005 11:24 am, Kris Schneider said:
>> >> > Will InetAddress.getLocalHost() work for you?
>> >> > NetworkInterface.getNetworkInterfaces() might also be of interest.
>> Or,
>> >> you
>> >> > might want to create yourself an instance of java.rmi.dgc.VMID...
>> >> >
>> >> > Quoting "Frank W. Zammetti" <[EMAIL PROTECTED]>:
>> >> >
>> >> >> Oh boy, I got a good one!  It's only related to Struts in that the
>> >> >> application in question is Struts-based, so I hope no one minds a
>> >> >> semi-OT
>> >> >> question...
>> >> >>
>> >> >> Here's the situation... An app I wrote has a daemon thread that is
>> >> >> spawned
>> >> >> at startup (from a Struts plugin) that does periodic background
>> >> >> processing
>> >> >> tasks.  This works great, never had a bit of trouble.
>> >> >>
>> >> >> Now though, the app is moving from a single server to a clusted
>> >> >> environment.
>> >> >>
>> >> >> So, what's going to happen is that each server in the cluster will
>> >> have
>> >> >> its own instance of the thread running on it.  Not a huge problem
>> >> except
>> >> >> that I have to be sure only one instance of the thread (i.e., one
>> >> server
>> >> >> in the cluster) is executing concurrently.
>> >> >>
>> >> >> The easy solution is just a database table that is checked when
>> the
>> >> >> thread
>> >> >> wakes up.  If there is no entry in it, then there is no other
>> >> instance
>> >> >> running, so it can write an entry to the table and go off and do
>> its
>> >> >> thing.
>> >> >>
>> >> >> I want to be extremely certain that no issues arise in terms of
>> one
>> >> >> instance of the thread reading from the database while another
>> >> instance
>> >> >> is
>> >> >> writing, etc.  So, aside from transactional database calls and
>> >> row-level
>> >> >> lock

Re: Wouldn't validation be better performed by Actions rather than ActionForms?

2005-03-18 Thread Hubert Rabago
It allows you to handle simple validations outside of the Action
class, which would only be called when there's data that can be passed
to the business tier (which may, among other things, perform business
validation).  Also, as the Validator plugin shows, it enabled
declarative validation.  So now, we don't even have to write
validation code in our action forms.  By the time execution reaches
the Action object, it can go straight to conversion without having to
worry about ParseException or NumberFormatException.

Hubert

On Fri, 18 Mar 2005 17:47:14 +, Lawrie Gallardo
<[EMAIL PROTECTED]> wrote:
> I appreciate that there are different levels of validation - I just can't
> see why any of them are better handled by ActionForm (which could otherwise
> just be a dum strut object/ map / etc) than by Action. Surely it is better
> to keep all your presentation tier validation together in one place where
> possible (although obviously you want to keep your business logic validation
> with your business objects)?
> 
> Lawrie
> 
> >From: Hubert Rabago <[EMAIL PROTECTED]>
> >Reply-To: Hubert Rabago <[EMAIL PROTECTED]>
> >To: Struts Users Mailing List 
> >Subject: Re: Wouldn't validation be better performed by Actions rather than
> >ActionForms?
> >Date: Fri, 18 Mar 2005 11:27:11 -0600
> >
> >You raise a lot of points, and I admit I won't be able to respond to
> >all of them in one email (due mostly to time constraints).  Besides,
> >there are others who could respond, so I'll leave some out for them.
> >:)
> >
> >There are/can be different levels of validation.  Some validation you
> >perform before others.  For example, an HR entry screen might contain
> >a field for salary.  You would validate that the field contains a
> >valid String that can be converted into a double, and you'd also make
> >sure it doesn't exceed certain bounds (like, say, USD 10,000,000 for a
> >junior programmer).  If the field doesn't contain a valid double,
> >there's no sense checking its value boundaries.  The field itself is
> >not syntactically valid.  This level of validation is what's most
> >often assigned to the ActionForm.  Much of these can be
> >automated/declared and oftentimes the Action doesn't even need to
> >participate.  Hence, we let the ActionForm carry out this part, and if
> >it fails at this level, we don't even bother calling the Action.
> >
> >Hubert
> >
> >On Fri, 18 Mar 2005 17:17:39 +, Lawrie Gallardo
> ><[EMAIL PROTECTED]> wrote:
> > > I'm still relatively new to Struts, but I can't help but feel that
> > > validation would be better performed by Action classes rather than
> > > ActionForm classes.
> > >
> > > It seems to me that, ideally, you want
> > > 1. Validation,
> > > 2. Transformations (ie convert separate day, month and year HTML fields
> >to
> > > Java Date object), and
> > > 3. Mapping of ActionForm fields (/HTML parameters) to Domain POJOs /
> >DTOs
> > > to all be configured in the same config file (to minimise duplication)
> >and
> > > to be implemented in the same class rather than scattered between
> >multiple
> > > config files and classes.
> > >
> > > Now, if my understanding is correct:
> > > 1. There is always a one-to-one mapping between an ActionForm and an
> > > ActionMapping,
> > > 2. Struts best practice is to have each Action class handle all possible
> > > operations for the HTML request it deals with using DispatchLookupAction
> >or
> > > something similar,
> > > 3. Almost noone creates ActionForms manually any more - they use
> > > DynaActionForm (or validating variations of this). And for those who do
> > > still create ActionForms manually, they don't offer anything in the way
> >of
> > > reuse, and are basically throw-away classes.
> > >
> > > Now if this is the case, would it not be better to have the ActionForm
> >as
> > > basically a dum data holder and have the validation method in the Action
> > > classes instead? The strus-config.xml file could contain all the
> >required
> > > declarative validation, transformation and mapping info, and the Action
> > > class could contain any validation, transformation, and mapping
> >operations
> > > that were too complicated to be set up declaratively.
> > >
> > > Is it just down to design decisions made in early versions of Struts and
> > > backward compatibility that things are the way they are? Or are there
> >good
> > > arguments for having the validation method in ActionForm? Am I missing
> > > something here?
> > >
> >
> >-
> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >For additional commands, e-mail: [EMAIL PROTECTED]
> >
> 
> _
> It's fast, it's easy and it's free. Get MSN Messenger today!
> http://www.msn.co.uk/messenger
> 
>

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



Re: Wouldn't validation be better performed by Actions rather than ActionForms?

2005-03-18 Thread Joe Germuska
At 5:17 PM + 3/18/05, Lawrie Gallardo wrote:
I'm still relatively new to Struts, but I can't help but feel that 
validation would be better performed by Action classes rather than 
ActionForm classes.

It seems to me that, ideally, you want
1. Validation,
2. Transformations (ie convert separate day, month and year HTML 
fields to Java Date object), and
3. Mapping of ActionForm fields (/HTML parameters) to Domain POJOs / DTOs
to all be configured in the same config file (to minimise 
duplication) and to be implemented in the same class rather than 
scattered between multiple config files and classes.

Now, if my understanding is correct:
1. There is always a one-to-one mapping between an ActionForm and an 
ActionMapping,
Often not true.  Earlier today on the dev-list Ted H. described a 
case where you might have a long form composed

2. Struts best practice is to have each Action class handle all 
possible operations for the HTML request it deals with using 
DispatchLookupAction or something similar,
I don't know if dispatch style is "best practice."  It's my preferred 
approach, but many experienced Struts developers don't like it much 
at all.  And then you've got wackos like Frank Z who like to write 
more code just to show off their typing skills.

3. Almost noone creates ActionForms manually any more - they use 
DynaActionForm (or validating variations of this).
Frank, again.  ;-)
Now if this is the case, would it not be better to have the 
ActionForm as basically a dum data holder and have the validation 
method in the Action classes instead?
Sounds like WebWork.  http://opensymphony.com/webwork/
Is it just down to design decisions made in early versions of Struts 
and backward compatibility that things are the way they are? Or are 
there good arguments for having the validation method in ActionForm? 
Am I missing something here?
The main reason you can't do it that way in Struts today is that 
Actions may service multiple threads and thus must remain stateless, 
while request data is inherently about state.  WebWork, for example, 
instantiates its controller-type classes per-request, which makes it 
safe to populate them with request values and integrate request 
validation and control logic.

Joe
--
Joe Germuska
[EMAIL PROTECTED]  
http://blog.germuska.com
"Narrow minds are weapons made for mass destruction"  -The Ex

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


Re: Interesting problem...

2005-03-18 Thread Martin Wegner
Frank,

I was a little hinky myself about using Common ID in production.  But I've
been using it or over a year and it has performed admirably.  We haven't
seen any problems with the package.

As for getting the MAC address I had to solve that problem about six
months ago.  I had to resort to Runtime.getRuntime().exec() (yuck).  Here
is where the madness all started:

   http://forum.java.sun.com/thread.jsp?forum=4&thread=245711

It is ugly but it does indeed work.  Until you run on a box that is not
using English.  And then you have the fun of boxes that have VPN software
installed.  And you have to watch out for disconnected media.  Etc.  Etc. 
Etc.

Anyway, I got it work and now I pluck the MAC address from the local box. 
It is ugly but I had to do it.

If anyone has a better way of getting the MAC address I would like to
know.


--Marty

--- "Frank W. Zammetti" <[EMAIL PROTECTED]> wrote:

> Why do you think it wouldn't work?  Does it sometimes return incorrect
> information in some setups?
> 
> I thought of doing some kind of mini-browser-type thing, but before I go
> down that road I wanted to explore some simpler solutions.  The Commons
> ID
> thing is very nice, but I'm not so sure I'm comfortable putting in
> something that isn't actually released yet.
> 
> That being said, what was on the site for it got me to thinking... I
> think
> if I do a combination of the sum of the MAC address digits + the current
> time + the hashCode of the IP address, that is probably as random as I
> need.  But, if you know something about InetAddress that would make this
> not work, I'm all ears :)
> 
> Of course, I'm not sure how to get the MAC address yet, but one problem
> at
> a time...
> 
> -- 
> Frank W. Zammetti
> Founder and Chief Software Architect
> Omnytex Technologies
> http://www.omnytex.com
> 
> On Fri, March 18, 2005 12:14 pm, Dakota Jack said:
> > InetAddress might not get the answer for you, Frank.  I don't know
> > what your setup is, but you can go to any ip address service outside
> > your system and get a unique return address for your machines with a
> > mini-browser.
> >
> > Jack
> >
> >
> > On Fri, 18 Mar 2005 11:36:10 -0500 (EST), Frank W. Zammetti
> > <[EMAIL PROTECTED]> wrote:
> >> Yes, I think InetAddress just might do the trick.  Thank you Kris!
> >>
> >> --
> >> Frank W. Zammetti
> >> Founder and Chief Software Architect
> >> Omnytex Technologies
> >> http://www.omnytex.com
> >>
> >> On Fri, March 18, 2005 11:24 am, Kris Schneider said:
> >> > Will InetAddress.getLocalHost() work for you?
> >> > NetworkInterface.getNetworkInterfaces() might also be of interest.
> Or,
> >> you
> >> > might want to create yourself an instance of java.rmi.dgc.VMID...
> >> >
> >> > Quoting "Frank W. Zammetti" <[EMAIL PROTECTED]>:
> >> >
> >> >> Oh boy, I got a good one!  It's only related to Struts in that the
> >> >> application in question is Struts-based, so I hope no one minds a
> >> >> semi-OT
> >> >> question...
> >> >>
> >> >> Here's the situation... An app I wrote has a daemon thread that is
> >> >> spawned
> >> >> at startup (from a Struts plugin) that does periodic background
> >> >> processing
> >> >> tasks.  This works great, never had a bit of trouble.
> >> >>
> >> >> Now though, the app is moving from a single server to a clusted
> >> >> environment.
> >> >>
> >> >> So, what's going to happen is that each server in the cluster will
> >> have
> >> >> its own instance of the thread running on it.  Not a huge problem
> >> except
> >> >> that I have to be sure only one instance of the thread (i.e., one
> >> server
> >> >> in the cluster) is executing concurrently.
> >> >>
> >> >> The easy solution is just a database table that is checked when
> the
> >> >> thread
> >> >> wakes up.  If there is no entry in it, then there is no other
> >> instance
> >> >> running, so it can write an entry to the table and go off and do
> its
> >> >> thing.
> >> >>
> >> >> I want to be extremely certain that no issues arise in terms of
> one
> >> >> instance of the thread reading from the database while another
> >> instance
> >> >> is
> >> >> writing, etc.  So, aside from transactional database calls and
> >> row-level
> >> >> locking, I want to do one more thing: I want the thread to sleep a
> >> >> random
> >> >> number of seconds (1-300) at startup.  This will ensure that, all
> the
> >> >> database locking and such aside, the threads should all be offset
> >> from
> >> >> one
> >> >> another in terms of when they run.
> >> >>
> >> >> So, I need a random number generated when the thread starts up. 
> As
> >> we
> >> >> all
> >> >> know though, random number generation on most computers that don't
> >> have
> >> >> something like a Brownian motion sensor attached stuck in a cup of
> >> >> boiling
> >> >> coffee can't generate truly random numbers.  So, in theory, what
> >> could
> >> >> happen is that if all the servers in the cluster come up at the
> same
> >> >> time,
> >> >> the threads could wind up running at 

Re: Interesting problem...

2005-03-18 Thread Frank W. Zammetti
In the interest of giving back, here's what I wound up doing:

import java.net.InetAddress;
import java.rmi.dgc.VMID;
import java.util.GregorianCalendar;
int vmidHash = new VMID().hashCode();
long currentTime = new GregorianCalendar().getTimeInMillis();
int ipHash = InetAddress.getLocalHost().hashCode();
long seed = vmidHash + currentTime + ipHash;
Random randomGenerator = new Random(seed);
int seconds = randomGenerator.nextInt(200) + 100;

It's a combination of the VMID (which is supposed ot be unique for each
VM, but in actuality even on the SAME machine I'm getting a different
value each time, which is better for my use case) plus the current time
plus the machine's IP address.  Even on the same machine this is
generating unique values for each of three threads I am spawning (I've
done it about 30 times now and have never seen a duplicate value).  Does
the trick, I am happy.  Thanks for all the insight everyone!

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com

On Fri, March 18, 2005 12:14 pm, Dakota Jack said:
> InetAddress might not get the answer for you, Frank.  I don't know
> what your setup is, but you can go to any ip address service outside
> your system and get a unique return address for your machines with a
> mini-browser.
>
> Jack
>
>
> On Fri, 18 Mar 2005 11:36:10 -0500 (EST), Frank W. Zammetti
> <[EMAIL PROTECTED]> wrote:
>> Yes, I think InetAddress just might do the trick.  Thank you Kris!
>>
>> --
>> Frank W. Zammetti
>> Founder and Chief Software Architect
>> Omnytex Technologies
>> http://www.omnytex.com
>>
>> On Fri, March 18, 2005 11:24 am, Kris Schneider said:
>> > Will InetAddress.getLocalHost() work for you?
>> > NetworkInterface.getNetworkInterfaces() might also be of interest. Or,
>> you
>> > might want to create yourself an instance of java.rmi.dgc.VMID...
>> >
>> > Quoting "Frank W. Zammetti" <[EMAIL PROTECTED]>:
>> >
>> >> Oh boy, I got a good one!  It's only related to Struts in that the
>> >> application in question is Struts-based, so I hope no one minds a
>> >> semi-OT
>> >> question...
>> >>
>> >> Here's the situation... An app I wrote has a daemon thread that is
>> >> spawned
>> >> at startup (from a Struts plugin) that does periodic background
>> >> processing
>> >> tasks.  This works great, never had a bit of trouble.
>> >>
>> >> Now though, the app is moving from a single server to a clusted
>> >> environment.
>> >>
>> >> So, what's going to happen is that each server in the cluster will
>> have
>> >> its own instance of the thread running on it.  Not a huge problem
>> except
>> >> that I have to be sure only one instance of the thread (i.e., one
>> server
>> >> in the cluster) is executing concurrently.
>> >>
>> >> The easy solution is just a database table that is checked when the
>> >> thread
>> >> wakes up.  If there is no entry in it, then there is no other
>> instance
>> >> running, so it can write an entry to the table and go off and do its
>> >> thing.
>> >>
>> >> I want to be extremely certain that no issues arise in terms of one
>> >> instance of the thread reading from the database while another
>> instance
>> >> is
>> >> writing, etc.  So, aside from transactional database calls and
>> row-level
>> >> locking, I want to do one more thing: I want the thread to sleep a
>> >> random
>> >> number of seconds (1-300) at startup.  This will ensure that, all the
>> >> database locking and such aside, the threads should all be offset
>> from
>> >> one
>> >> another in terms of when they run.
>> >>
>> >> So, I need a random number generated when the thread starts up.  As
>> we
>> >> all
>> >> know though, random number generation on most computers that don't
>> have
>> >> something like a Brownian motion sensor attached stuck in a cup of
>> >> boiling
>> >> coffee can't generate truly random numbers.  So, in theory, what
>> could
>> >> happen is that if all the servers in the cluster come up at the same
>> >> time,
>> >> the threads could wind up running at the same time regardless of the
>> >> random sleep at the start!  It might never happen in reality, small
>> >> fluctuations would probably offset them anyway, but I want to be more
>> >> certain than that.
>> >>
>> >> So now we're at the crux of the problem...
>> >>
>> >> I can't just seed the random number generator with the current time
>> >> because it concievably might not be random enough.  So, I thought I
>> >> could
>> >> just tally up the octets of the server's IP address and add that to
>> the
>> >> current time.  Then the seed on each server should be different
>> enough.
>> >>
>> >> But, there doesn't appear to be any way to get the server IP address
>> >> independant of a request, so I can't get at it in my plugin.  Anyone
>> >> know
>> >> differently?
>> >>
>> >> Assuming that is the case, can anyone think of any other way to seed
>> the
>> >> generator that would ensure a different value on different machines
>> in
>> >> the
>> >> cluster?  Th

RE: Wouldn't validation be better performed by Actions rather tha n ActionForms?

2005-03-18 Thread "Treviño De la Garza, Isidoro"
Another aproach is to generate your ActionForms using Xdoclet so you don't
waste time generating them.

Also, I think it is a great idea to do sintactic validation using the
Commons Validator and then have some business/semantic validation in another
layer, the commons validator (combined with xdoclet) is really a big help to
validate simple stuff (like required fields).

-Original Message-
From: Hubert Rabago [mailto:[EMAIL PROTECTED]
Sent: Friday, March 18, 2005 11:40 AM
To: Struts Users Mailing List
Subject: Re: Wouldn't validation be better performed by Actions rather
than ActionForms?


Inline.

On Fri, 18 Mar 2005 17:17:39 +, Lawrie Gallardo
<[EMAIL PROTECTED]> wrote:
> I'm still relatively new to Struts, but I can't help but feel that
> validation would be better performed by Action classes rather than
> ActionForm classes.
> 
> It seems to me that, ideally, you want
> 1. Validation,
> 2. Transformations (ie convert separate day, month and year HTML fields to
> Java Date object), and
> 3. Mapping of ActionForm fields (/HTML parameters) to Domain POJOs / DTOs
> to all be configured in the same config file (to minimise duplication) and
> to be implemented in the same class rather than scattered between multiple
> config files and classes.
> 

Hmm, you just described one use case for FormDef when coupled with its
Validator integration.  :)
https://formdef.dev.java.net
http://www.rabago.net/struts/formdef/manual.htm#combinedconfig


> Now, if my understanding is correct:
> 1. There is always a one-to-one mapping between an ActionForm and an
> ActionMapping,

An action form holds the request parameters that accompany a request. 
The most common use case is a form being submitted.  You submit each
 to one URL - that's why there's a one-to-one mapping.


> 2. Struts best practice is to have each Action class handle all possible
> operations for the HTML request it deals with using DispatchLookupAction
or
> something similar,

That certainly is one practice.  Personally I don't use that.  I
mostly use my own Action subclasses, or if I want dispatch
functionality, I used to use MappingDispatchAction.  Now I use the
ActionDispatcher class in
http://issues.apache.org/bugzilla/show_bug.cgi?id=31270 .


> 3. Almost noone creates ActionForms manually any more - they use
> DynaActionForm (or validating variations of this). And for those who do
> still create ActionForms manually, they don't offer anything in the way of
> reuse, and are basically throw-away classes.

My own rule has been, if the requirements can be fulfilled by a dyna
form, then that's what I use.  Otherwise, I use a manually created
ActionForm.  Whenever I have a manually created ActionForm, believe
me, they're certainly not throw-away.


Hubert

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


Re: Wouldn't validation be better performed by Actions rather than ActionForms?

2005-03-18 Thread Hubert Rabago
Inline.

On Fri, 18 Mar 2005 17:17:39 +, Lawrie Gallardo
<[EMAIL PROTECTED]> wrote:
> I'm still relatively new to Struts, but I can't help but feel that
> validation would be better performed by Action classes rather than
> ActionForm classes.
> 
> It seems to me that, ideally, you want
> 1. Validation,
> 2. Transformations (ie convert separate day, month and year HTML fields to
> Java Date object), and
> 3. Mapping of ActionForm fields (/HTML parameters) to Domain POJOs / DTOs
> to all be configured in the same config file (to minimise duplication) and
> to be implemented in the same class rather than scattered between multiple
> config files and classes.
> 

Hmm, you just described one use case for FormDef when coupled with its
Validator integration.  :)
https://formdef.dev.java.net
http://www.rabago.net/struts/formdef/manual.htm#combinedconfig


> Now, if my understanding is correct:
> 1. There is always a one-to-one mapping between an ActionForm and an
> ActionMapping,

An action form holds the request parameters that accompany a request. 
The most common use case is a form being submitted.  You submit each
 to one URL - that's why there's a one-to-one mapping.


> 2. Struts best practice is to have each Action class handle all possible
> operations for the HTML request it deals with using DispatchLookupAction or
> something similar,

That certainly is one practice.  Personally I don't use that.  I
mostly use my own Action subclasses, or if I want dispatch
functionality, I used to use MappingDispatchAction.  Now I use the
ActionDispatcher class in
http://issues.apache.org/bugzilla/show_bug.cgi?id=31270 .


> 3. Almost noone creates ActionForms manually any more - they use
> DynaActionForm (or validating variations of this). And for those who do
> still create ActionForms manually, they don't offer anything in the way of
> reuse, and are basically throw-away classes.

My own rule has been, if the requirements can be fulfilled by a dyna
form, then that's what I use.  Otherwise, I use a manually created
ActionForm.  Whenever I have a manually created ActionForm, believe
me, they're certainly not throw-away.


Hubert

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



Re: Multiple ActionForms per ActionMapping

2005-03-18 Thread Joe Germuska
Hijack alert!
At 11:09 AM -0500 3/18/05, Rick Reumann wrote:
Well, actually I like to have my own validate() method in each of my 
Dispatch Actions. I don't like having the framework call validate 
for me. One of the main reason is that if I'm in my action and I 
manually call my own action's validate() method then, if validation 
fails, I can make sure my prep method is always called. I wrote 
about this here http://reumann.net/struts/articles/request_lists.jsp 
and at the end I give an example of what I like to do. (I'm curious, 
in that approach you came up with, if validation were to fail, would 
the extra 'setup' that you added to the action mapping be called? If 
so, that would be very nice! if not then I'd still end up having to 
use my prep/set up method).
This is one of the reasons I like a design which associates prep 
logic with the destination (forward) instead of the action/request.

If that's the only reason you validate in your actions instead of in 
the framework, maybe you'd like it too...

Joe
--
Joe Germuska
[EMAIL PROTECTED]  
http://blog.germuska.com
"Narrow minds are weapons made for mass destruction"  -The Ex

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


Re: Wouldn't validation be better performed by Actions rather than ActionForms?

2005-03-18 Thread Lawrie Gallardo
I'm not sure that I follow you...
What I meant was that automatic declarative validation using Struts 
Validator should be invoked by a "ValidatingAction" baseclass validate() 
method, rather than DynaValidatorForm (or similar) baseclass validate() 
method. And that you could put any validation that is too complex to be 
described declaratively in your overriden Action validate() method.

Where are you suggesting would be a good place for validation to be 
performed?

From: Dakota Jack <[EMAIL PROTECTED]>
Reply-To: Dakota Jack <[EMAIL PROTECTED]>
To: Struts Users Mailing List 
Subject: Re: Wouldn't validation be better performed by Actions rather than 
ActionForms?
Date: Fri, 18 Mar 2005 09:19:10 -0800

I don't think you want an Action doing the validation, but I am with
you that validation does not belong to ActionForm.  You don't have to
do it there, by the way.
Jack
On Fri, 18 Mar 2005 17:17:39 +, Lawrie Gallardo
<[EMAIL PROTECTED]> wrote:
> I'm still relatively new to Struts, but I can't help but feel that
> validation would be better performed by Action classes rather than
> ActionForm classes.
>
> It seems to me that, ideally, you want
> 1. Validation,
> 2. Transformations (ie convert separate day, month and year HTML fields 
to
> Java Date object), and
> 3. Mapping of ActionForm fields (/HTML parameters) to Domain POJOs / 
DTOs
> to all be configured in the same config file (to minimise duplication) 
and
> to be implemented in the same class rather than scattered between 
multiple
> config files and classes.
>
> Now, if my understanding is correct:
> 1. There is always a one-to-one mapping between an ActionForm and an
> ActionMapping,
> 2. Struts best practice is to have each Action class handle all possible
> operations for the HTML request it deals with using DispatchLookupAction 
or
> something similar,
> 3. Almost noone creates ActionForms manually any more - they use
> DynaActionForm (or validating variations of this). And for those who do
> still create ActionForms manually, they don't offer anything in the way 
of
> reuse, and are basically throw-away classes.
>
> Now if this is the case, would it not be better to have the ActionForm 
as
> basically a dum data holder and have the validation method in the Action
> classes instead? The strus-config.xml file could contain all the 
required
> declarative validation, transformation and mapping info, and the Action
> class could contain any validation, transformation, and mapping 
operations
> that were too complicated to be set up declaratively.
>
> Is it just down to design decisions made in early versions of Struts and
> backward compatibility that things are the way they are? Or are there 
good
> arguments for having the validation method in ActionForm? Am I missing
> something here?
>
> _
> Stay in touch with absent friends - get MSN Messenger
> http://www.msn.co.uk/messenger
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

--
"You can lead a horse to water but you cannot make it float on its back."
~Dakota Jack~
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
_
It's fast, it's easy and it's free. Get MSN Messenger today! 
http://www.msn.co.uk/messenger

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


Re: Wouldn't validation be better performed by Actions rather than ActionForms?

2005-03-18 Thread Hubert Rabago
You raise a lot of points, and I admit I won't be able to respond to
all of them in one email (due mostly to time constraints).  Besides,
there are others who could respond, so I'll leave some out for them.
:)

There are/can be different levels of validation.  Some validation you
perform before others.  For example, an HR entry screen might contain
a field for salary.  You would validate that the field contains a
valid String that can be converted into a double, and you'd also make
sure it doesn't exceed certain bounds (like, say, USD 10,000,000 for a
junior programmer).  If the field doesn't contain a valid double,
there's no sense checking its value boundaries.  The field itself is
not syntactically valid.  This level of validation is what's most
often assigned to the ActionForm.  Much of these can be
automated/declared and oftentimes the Action doesn't even need to
participate.  Hence, we let the ActionForm carry out this part, and if
it fails at this level, we don't even bother calling the Action.

Hubert

On Fri, 18 Mar 2005 17:17:39 +, Lawrie Gallardo
<[EMAIL PROTECTED]> wrote:
> I'm still relatively new to Struts, but I can't help but feel that
> validation would be better performed by Action classes rather than
> ActionForm classes.
> 
> It seems to me that, ideally, you want
> 1. Validation,
> 2. Transformations (ie convert separate day, month and year HTML fields to
> Java Date object), and
> 3. Mapping of ActionForm fields (/HTML parameters) to Domain POJOs / DTOs
> to all be configured in the same config file (to minimise duplication) and
> to be implemented in the same class rather than scattered between multiple
> config files and classes.
> 
> Now, if my understanding is correct:
> 1. There is always a one-to-one mapping between an ActionForm and an
> ActionMapping,
> 2. Struts best practice is to have each Action class handle all possible
> operations for the HTML request it deals with using DispatchLookupAction or
> something similar,
> 3. Almost noone creates ActionForms manually any more - they use
> DynaActionForm (or validating variations of this). And for those who do
> still create ActionForms manually, they don't offer anything in the way of
> reuse, and are basically throw-away classes.
> 
> Now if this is the case, would it not be better to have the ActionForm as
> basically a dum data holder and have the validation method in the Action
> classes instead? The strus-config.xml file could contain all the required
> declarative validation, transformation and mapping info, and the Action
> class could contain any validation, transformation, and mapping operations
> that were too complicated to be set up declaratively.
> 
> Is it just down to design decisions made in early versions of Struts and
> backward compatibility that things are the way they are? Or are there good
> arguments for having the validation method in ActionForm? Am I missing
> something here?
>

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



Re: Wouldn't validation be better performed by Actions rather than ActionForms?

2005-03-18 Thread Frank W. Zammetti
Is it really true that DispatchAction is now the accepted "best practice"?
 If so I have to say I disagree with that standard (if not, ignore me!)

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com

On Fri, March 18, 2005 12:17 pm, Lawrie Gallardo said:
> I'm still relatively new to Struts, but I can't help but feel that
> validation would be better performed by Action classes rather than
> ActionForm classes.
>
> It seems to me that, ideally, you want
> 1. Validation,
> 2. Transformations (ie convert separate day, month and year HTML fields to
> Java Date object), and
> 3. Mapping of ActionForm fields (/HTML parameters) to Domain POJOs / DTOs
> to all be configured in the same config file (to minimise duplication) and
> to be implemented in the same class rather than scattered between multiple
> config files and classes.
>
> Now, if my understanding is correct:
> 1. There is always a one-to-one mapping between an ActionForm and an
> ActionMapping,
> 2. Struts best practice is to have each Action class handle all possible
> operations for the HTML request it deals with using DispatchLookupAction
> or
> something similar,
> 3. Almost noone creates ActionForms manually any more - they use
> DynaActionForm (or validating variations of this). And for those who do
> still create ActionForms manually, they don't offer anything in the way of
> reuse, and are basically throw-away classes.
>
> Now if this is the case, would it not be better to have the ActionForm as
> basically a dum data holder and have the validation method in the Action
> classes instead? The strus-config.xml file could contain all the required
> declarative validation, transformation and mapping info, and the Action
> class could contain any validation, transformation, and mapping operations
> that were too complicated to be set up declaratively.
>
> Is it just down to design decisions made in early versions of Struts and
> backward compatibility that things are the way they are? Or are there good
> arguments for having the validation method in ActionForm? Am I missing
> something here?
>
> _
> Stay in touch with absent friends - get MSN Messenger
> http://www.msn.co.uk/messenger
>
>
> -
> 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: [Shale] Resource initialisation best practice

2005-03-18 Thread Craig McClanahan
A technique I like (and is actually used in the Use Cases example) is
to make your reference data into an application-scoped managed bean
(for stuff common to all users; use session scope if it is user
specific).  Then, the first use of a value binding that needs to load
the reference data will cause it to happen (via the managed beans
facility).

For example, there is a "select many" component listing available
categories on (among others) the logon/profile3.jsp page:

  

  

The "domains" bean is an application scoped managed bean that (for the
simple lists) has a getter for each one.  The contents of the list can
be composed with literal Java statements (as was done here for
simplicity), loaded from a database or web service call, or whatever
you need.

For extra credit, you can hook up JSF-Spring and use Spring's
mechanisms to configure the managed bean for you.

Craig


On Fri, 18 Mar 2005 10:21:47 +, Duncan Mills
<[EMAIL PROTECTED]> wrote:
> Fellow Shale'ers,
> Given the scenario when you have reference data to set up, say on the
> application, which is not dependent on a particular view, but which must
> be put in place before the first view is displayed, and given that there
> is no single entry point for the app, what approach would you take?
> 
> What I'm currently doing is inserting a custom command into the Shale
> preprocess chain . This works OK, however, I'm "distressed" by the fact
> that I can't save the relevant state using a valueBinding because at the
> point in time the Chain command is first executed there is no
> FacesContext.  So instead I have to set the application attributes
> directly.
> Plan B would be to do the same setup in a common superclass of
> viewController which will have access to a valid FacesContext, however,
> I'd rather keep this general setup logically away from the per page
> setup. Does anyone have any other ideas?
> 
> Duncan Mills
> http://www.groundside.com/blog
> 
> -
> 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: Interesting problem...

2005-03-18 Thread Frank W. Zammetti
Why do you think it wouldn't work?  Does it sometimes return incorrect
information in some setups?

I thought of doing some kind of mini-browser-type thing, but before I go
down that road I wanted to explore some simpler solutions.  The Commons ID
thing is very nice, but I'm not so sure I'm comfortable putting in
something that isn't actually released yet.

That being said, what was on the site for it got me to thinking... I think
if I do a combination of the sum of the MAC address digits + the current
time + the hashCode of the IP address, that is probably as random as I
need.  But, if you know something about InetAddress that would make this
not work, I'm all ears :)

Of course, I'm not sure how to get the MAC address yet, but one problem at
a time...

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com

On Fri, March 18, 2005 12:14 pm, Dakota Jack said:
> InetAddress might not get the answer for you, Frank.  I don't know
> what your setup is, but you can go to any ip address service outside
> your system and get a unique return address for your machines with a
> mini-browser.
>
> Jack
>
>
> On Fri, 18 Mar 2005 11:36:10 -0500 (EST), Frank W. Zammetti
> <[EMAIL PROTECTED]> wrote:
>> Yes, I think InetAddress just might do the trick.  Thank you Kris!
>>
>> --
>> Frank W. Zammetti
>> Founder and Chief Software Architect
>> Omnytex Technologies
>> http://www.omnytex.com
>>
>> On Fri, March 18, 2005 11:24 am, Kris Schneider said:
>> > Will InetAddress.getLocalHost() work for you?
>> > NetworkInterface.getNetworkInterfaces() might also be of interest. Or,
>> you
>> > might want to create yourself an instance of java.rmi.dgc.VMID...
>> >
>> > Quoting "Frank W. Zammetti" <[EMAIL PROTECTED]>:
>> >
>> >> Oh boy, I got a good one!  It's only related to Struts in that the
>> >> application in question is Struts-based, so I hope no one minds a
>> >> semi-OT
>> >> question...
>> >>
>> >> Here's the situation... An app I wrote has a daemon thread that is
>> >> spawned
>> >> at startup (from a Struts plugin) that does periodic background
>> >> processing
>> >> tasks.  This works great, never had a bit of trouble.
>> >>
>> >> Now though, the app is moving from a single server to a clusted
>> >> environment.
>> >>
>> >> So, what's going to happen is that each server in the cluster will
>> have
>> >> its own instance of the thread running on it.  Not a huge problem
>> except
>> >> that I have to be sure only one instance of the thread (i.e., one
>> server
>> >> in the cluster) is executing concurrently.
>> >>
>> >> The easy solution is just a database table that is checked when the
>> >> thread
>> >> wakes up.  If there is no entry in it, then there is no other
>> instance
>> >> running, so it can write an entry to the table and go off and do its
>> >> thing.
>> >>
>> >> I want to be extremely certain that no issues arise in terms of one
>> >> instance of the thread reading from the database while another
>> instance
>> >> is
>> >> writing, etc.  So, aside from transactional database calls and
>> row-level
>> >> locking, I want to do one more thing: I want the thread to sleep a
>> >> random
>> >> number of seconds (1-300) at startup.  This will ensure that, all the
>> >> database locking and such aside, the threads should all be offset
>> from
>> >> one
>> >> another in terms of when they run.
>> >>
>> >> So, I need a random number generated when the thread starts up.  As
>> we
>> >> all
>> >> know though, random number generation on most computers that don't
>> have
>> >> something like a Brownian motion sensor attached stuck in a cup of
>> >> boiling
>> >> coffee can't generate truly random numbers.  So, in theory, what
>> could
>> >> happen is that if all the servers in the cluster come up at the same
>> >> time,
>> >> the threads could wind up running at the same time regardless of the
>> >> random sleep at the start!  It might never happen in reality, small
>> >> fluctuations would probably offset them anyway, but I want to be more
>> >> certain than that.
>> >>
>> >> So now we're at the crux of the problem...
>> >>
>> >> I can't just seed the random number generator with the current time
>> >> because it concievably might not be random enough.  So, I thought I
>> >> could
>> >> just tally up the octets of the server's IP address and add that to
>> the
>> >> current time.  Then the seed on each server should be different
>> enough.
>> >>
>> >> But, there doesn't appear to be any way to get the server IP address
>> >> independant of a request, so I can't get at it in my plugin.  Anyone
>> >> know
>> >> differently?
>> >>
>> >> Assuming that is the case, can anyone think of any other way to seed
>> the
>> >> generator that would ensure a different value on different machines
>> in
>> >> the
>> >> cluster?  There are some options like encoding the individual server
>> >> names
>> >> in my app's config file with a different seed value for each, but
>> that
>> >> makes main

Re: Wouldn't validation be better performed by Actions rather than ActionForms?

2005-03-18 Thread Dakota Jack
I don't think you want an Action doing the validation, but I am with
you that validation does not belong to ActionForm.  You don't have to
do it there, by the way.

Jack


On Fri, 18 Mar 2005 17:17:39 +, Lawrie Gallardo
<[EMAIL PROTECTED]> wrote:
> I'm still relatively new to Struts, but I can't help but feel that
> validation would be better performed by Action classes rather than
> ActionForm classes.
> 
> It seems to me that, ideally, you want
> 1. Validation,
> 2. Transformations (ie convert separate day, month and year HTML fields to
> Java Date object), and
> 3. Mapping of ActionForm fields (/HTML parameters) to Domain POJOs / DTOs
> to all be configured in the same config file (to minimise duplication) and
> to be implemented in the same class rather than scattered between multiple
> config files and classes.
> 
> Now, if my understanding is correct:
> 1. There is always a one-to-one mapping between an ActionForm and an
> ActionMapping,
> 2. Struts best practice is to have each Action class handle all possible
> operations for the HTML request it deals with using DispatchLookupAction or
> something similar,
> 3. Almost noone creates ActionForms manually any more - they use
> DynaActionForm (or validating variations of this). And for those who do
> still create ActionForms manually, they don't offer anything in the way of
> reuse, and are basically throw-away classes.
> 
> Now if this is the case, would it not be better to have the ActionForm as
> basically a dum data holder and have the validation method in the Action
> classes instead? The strus-config.xml file could contain all the required
> declarative validation, transformation and mapping info, and the Action
> class could contain any validation, transformation, and mapping operations
> that were too complicated to be set up declaratively.
> 
> Is it just down to design decisions made in early versions of Struts and
> backward compatibility that things are the way they are? Or are there good
> arguments for having the validation method in ActionForm? Am I missing
> something here?
> 
> _
> Stay in touch with absent friends - get MSN Messenger
> http://www.msn.co.uk/messenger
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


-- 
"You can lead a horse to water but you cannot make it float on its back."
~Dakota Jack~

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



RE: ActionForm problem

2005-03-18 Thread Hyrum
Kudos to Jeff for the solution.  I had overlooked renaming the getter method
from isSsnOnFile() to getSsnOnFile().  Little details will kill you every
time.  Even though I'm leaving it as a boolean, I still appreciate knowing
why it bombed in the first place.

Thanks for the rest of the input, y'all.  It is all helpful to a guy who is
still pretty new at this stuff.

Hyrum

-Original Message-
From: Jeff Beal [mailto:[EMAIL PROTECTED] 
Sent: Friday, March 18, 2005 8:54 AM
To: Struts Users Mailing List
Subject: Re: ActionForm problem

Did you change the types on both the getter and the setter methods? 
Did you keep a setter with the boolean type?  I don't remember all of
the details, but I don't think that the following is a valid bean
property:

  public String getSsnOnFile() { return ssnOnFile ? "Y" : "N"; }
  public void setSsnOnFile(String ssnOnFileString) {
 ssnOnFile = "Y".equals(ssnOnFileString);
  }
  public void setSsnOnFile(boolean newSsnOnFile) {
 ssnOnFile = newSsnOnFile;
  }


On Fri, 18 Mar 2005 08:14:06 -0700, Hyrum <[EMAIL PROTECTED]> wrote:
> 
> I would still like to know what the root problem is here, the tag thing
> aside.  Why can't the ValidatorActionForm see my value "ssnOnFile" when I
> change the type from boolean to String??  Just for future reference,
anyone
> have any ideas??
> 


-- 
Jeff Beal
Webmedx, Inc.
Pittsburgh, PA USA


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



RE: ActionForm problem

2005-03-18 Thread Hyrum
Kudos to Jeff for the solution.  I had overlooked renaming the getter method
from isSsnOnFile() to getSsnOnFile().  Little details will kill you every
time.  Even though I'm leaving it as a boolean, I still appreciate knowing
why it bombed in the first place.

Thanks for the rest of the input, y'all.  It is all helpful to a guy who is
still pretty new at this stuff.

Hyrum

-Original Message-
From: Jeff Beal [mailto:[EMAIL PROTECTED] 
Sent: Friday, March 18, 2005 8:54 AM
To: Struts Users Mailing List
Subject: Re: ActionForm problem

Did you change the types on both the getter and the setter methods? 
Did you keep a setter with the boolean type?  I don't remember all of
the details, but I don't think that the following is a valid bean
property:

  public String getSsnOnFile() { return ssnOnFile ? "Y" : "N"; }
  public void setSsnOnFile(String ssnOnFileString) {
 ssnOnFile = "Y".equals(ssnOnFileString);
  }
  public void setSsnOnFile(boolean newSsnOnFile) {
 ssnOnFile = newSsnOnFile;
  }


On Fri, 18 Mar 2005 08:14:06 -0700, Hyrum <[EMAIL PROTECTED]> wrote:
> 
> I would still like to know what the root problem is here, the tag thing
> aside.  Why can't the ValidatorActionForm see my value "ssnOnFile" when I
> change the type from boolean to String??  Just for future reference,
anyone
> have any ideas??
> 


-- 
Jeff Beal
Webmedx, Inc.
Pittsburgh, PA USA


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



Wouldn't validation be better performed by Actions rather than ActionForms?

2005-03-18 Thread Lawrie Gallardo
I'm still relatively new to Struts, but I can't help but feel that 
validation would be better performed by Action classes rather than 
ActionForm classes.

It seems to me that, ideally, you want
1. Validation,
2. Transformations (ie convert separate day, month and year HTML fields to 
Java Date object), and
3. Mapping of ActionForm fields (/HTML parameters) to Domain POJOs / DTOs
to all be configured in the same config file (to minimise duplication) and 
to be implemented in the same class rather than scattered between multiple 
config files and classes.

Now, if my understanding is correct:
1. There is always a one-to-one mapping between an ActionForm and an 
ActionMapping,
2. Struts best practice is to have each Action class handle all possible 
operations for the HTML request it deals with using DispatchLookupAction or 
something similar,
3. Almost noone creates ActionForms manually any more - they use 
DynaActionForm (or validating variations of this). And for those who do 
still create ActionForms manually, they don't offer anything in the way of 
reuse, and are basically throw-away classes.

Now if this is the case, would it not be better to have the ActionForm as 
basically a dum data holder and have the validation method in the Action 
classes instead? The strus-config.xml file could contain all the required 
declarative validation, transformation and mapping info, and the Action 
class could contain any validation, transformation, and mapping operations 
that were too complicated to be set up declaratively.

Is it just down to design decisions made in early versions of Struts and 
backward compatibility that things are the way they are? Or are there good 
arguments for having the validation method in ActionForm? Am I missing 
something here?

_
Stay in touch with absent friends - get MSN Messenger 
http://www.msn.co.uk/messenger

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


Re: Interesting problem...

2005-03-18 Thread Dakota Jack
InetAddress might not get the answer for you, Frank.  I don't know
what your setup is, but you can go to any ip address service outside
your system and get a unique return address for your machines with a
mini-browser.

Jack


On Fri, 18 Mar 2005 11:36:10 -0500 (EST), Frank W. Zammetti
<[EMAIL PROTECTED]> wrote:
> Yes, I think InetAddress just might do the trick.  Thank you Kris!
> 
> --
> Frank W. Zammetti
> Founder and Chief Software Architect
> Omnytex Technologies
> http://www.omnytex.com
> 
> On Fri, March 18, 2005 11:24 am, Kris Schneider said:
> > Will InetAddress.getLocalHost() work for you?
> > NetworkInterface.getNetworkInterfaces() might also be of interest. Or, you
> > might want to create yourself an instance of java.rmi.dgc.VMID...
> >
> > Quoting "Frank W. Zammetti" <[EMAIL PROTECTED]>:
> >
> >> Oh boy, I got a good one!  It's only related to Struts in that the
> >> application in question is Struts-based, so I hope no one minds a
> >> semi-OT
> >> question...
> >>
> >> Here's the situation... An app I wrote has a daemon thread that is
> >> spawned
> >> at startup (from a Struts plugin) that does periodic background
> >> processing
> >> tasks.  This works great, never had a bit of trouble.
> >>
> >> Now though, the app is moving from a single server to a clusted
> >> environment.
> >>
> >> So, what's going to happen is that each server in the cluster will have
> >> its own instance of the thread running on it.  Not a huge problem except
> >> that I have to be sure only one instance of the thread (i.e., one server
> >> in the cluster) is executing concurrently.
> >>
> >> The easy solution is just a database table that is checked when the
> >> thread
> >> wakes up.  If there is no entry in it, then there is no other instance
> >> running, so it can write an entry to the table and go off and do its
> >> thing.
> >>
> >> I want to be extremely certain that no issues arise in terms of one
> >> instance of the thread reading from the database while another instance
> >> is
> >> writing, etc.  So, aside from transactional database calls and row-level
> >> locking, I want to do one more thing: I want the thread to sleep a
> >> random
> >> number of seconds (1-300) at startup.  This will ensure that, all the
> >> database locking and such aside, the threads should all be offset from
> >> one
> >> another in terms of when they run.
> >>
> >> So, I need a random number generated when the thread starts up.  As we
> >> all
> >> know though, random number generation on most computers that don't have
> >> something like a Brownian motion sensor attached stuck in a cup of
> >> boiling
> >> coffee can't generate truly random numbers.  So, in theory, what could
> >> happen is that if all the servers in the cluster come up at the same
> >> time,
> >> the threads could wind up running at the same time regardless of the
> >> random sleep at the start!  It might never happen in reality, small
> >> fluctuations would probably offset them anyway, but I want to be more
> >> certain than that.
> >>
> >> So now we're at the crux of the problem...
> >>
> >> I can't just seed the random number generator with the current time
> >> because it concievably might not be random enough.  So, I thought I
> >> could
> >> just tally up the octets of the server's IP address and add that to the
> >> current time.  Then the seed on each server should be different enough.
> >>
> >> But, there doesn't appear to be any way to get the server IP address
> >> independant of a request, so I can't get at it in my plugin.  Anyone
> >> know
> >> differently?
> >>
> >> Assuming that is the case, can anyone think of any other way to seed the
> >> generator that would ensure a different value on different machines in
> >> the
> >> cluster?  There are some options like encoding the individual server
> >> names
> >> in my app's config file with a different seed value for each, but that
> >> makes maintenance a pain if a new server is added or one removed or
> >> addresses simply changed.
> >>
> >> Any ideas?  Thanks!
> >>
> >> --
> >> Frank W. Zammetti
> >> Founder and Chief Software Architect
> >> Omnytex Technologies
> >> http://www.omnytex.com
> >
> > --
> > Kris Schneider 
> > D.O.Tech   
> >
> > -
> > 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]
> 
> 


-- 
"You can lead a horse to water but you cannot make it float on its back."
~Dakota Jack~

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



Re: Tomcat 5.5.7 + Connection Pool

2005-03-18 Thread Alex Rodrigues da Silva
continue,
i see this error :
org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of 
class '' for connect URL 'null'.

-- 
Alex Rodrigues da Silva
Irigon Imóveis
Analista de Sistemas
tel.: 55 21 2522-0042
[EMAIL PROTECTED]

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



Re: Multiple ActionForms per ActionMapping

2005-03-18 Thread Dakota Jack
There are a "jillion" solutions, of course.  I still think, and maybe
I am stating it too much, that the solution should be framework and
definitely should not be in a session object.  I do think that
application data should be handled and have suggested a StrutsState
application in application scope.  But, the screen data should be
handled, I think, by a screen application of ActionForm or like VOs. 
I would separate validation from ActionForm, etc.


On Fri, 18 Mar 2005 10:32:35 -0500, Rick Reumann <[EMAIL PROTECTED]> wrote:
> Frank W. Zammetti wrote the following on 3/17/2005 10:23 PM:
> 
> > Certainly I can see the reasoning behind that, but I would have to
> > disagree.  What if down the road I need to use one of those screens
> > independant of that original flow?  Isn't it just added complexity to
> > have all the extra stuff in the ActionForm then?
> 
> Ok, then how about using separate ActionForms and after each submits
> copy the properties (BeanUtils) to a POJO that you are using in Session
> scope to hold the values you finally need. This way you have the
> flexible separate ActionForms but still have a Master record holding
> what you need along each step. (Heck, you could even take the lazy way
> out and make the master session object a Map so you wouldn't even have
> to care about creating the pojo ahead of time.. although I still prefer
> a nice POJO over a Map for stuff like this.)
> 
> > A good example is the application I was talking about itself... The six
> > screens are not simple in and of themselves, there is quite a bit of
> > complexity to the ActionForms for each, in terms of how many fields
> > there certainy.  If I combined them all it would be a very unwieldly
> > beast to maintain (I'd have to look, but I can imagine it being close to
> > 2,000 line of code without much trouble, perhaps more).
> 
> Well, remember those 2000 lines of code are simply getters and setters
> which are easily auto-generated. It's not really complex lines of code.
> Really you are only maintaining field names. I do see  your point though
> about how it's nice having the ActionForms separate for a more resuable
> approach. I'd opt for the option I mentioned above first, if you want to
> keep the forms all separate.
> 
> > In addition, how would you handle validation then?  The validate()
> > method is meant to apply to a single page (as is an ActionForm),
> 
> Actually you can validate on an action mapping basis and not on the form
> name, so only the fields you are interested in for the action mapping
> get checked.
> 
> --
> Rick
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


-- 
"You can lead a horse to water but you cannot make it float on its back."
~Dakota Jack~

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



Re: Interesting problem...

2005-03-18 Thread Frank W. Zammetti
Oh, that is sweet!  I was totally unaware of that.  Thanks Martin!

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com

On Fri, March 18, 2005 11:52 am, Martin Wegner said:
>
> You can also use the Jakarta Commons ID packageto generate a GUID which is
> guaranteed to be unique in the universe.  You could then convert the GUID
> to your seed.
>
>
>
> --- Kris Schneider <[EMAIL PROTECTED]> wrote:
>> Will InetAddress.getLocalHost() work for you?
>> NetworkInterface.getNetworkInterfaces() might also be of interest. Or,
>> you
>> might want to create yourself an instance of java.rmi.dgc.VMID...
>>
>> Quoting "Frank W. Zammetti" <[EMAIL PROTECTED]>:
>>
>> > Oh boy, I got a good one!  It's only related to Struts in that the
>> > application in question is Struts-based, so I hope no one minds a
>> semi-OT
>> > question...
>> >
>> > Here's the situation... An app I wrote has a daemon thread that is
>> spawned
>> > at startup (from a Struts plugin) that does periodic background
>> processing
>> > tasks.  This works great, never had a bit of trouble.
>> >
>> > Now though, the app is moving from a single server to a clusted
>> environment.
>> >
>> > So, what's going to happen is that each server in the cluster will
>> have
>> > its own instance of the thread running on it.  Not a huge problem
>> except
>> > that I have to be sure only one instance of the thread (i.e., one
>> server
>> > in the cluster) is executing concurrently.
>> >
>> > The easy solution is just a database table that is checked when the
>> thread
>> > wakes up.  If there is no entry in it, then there is no other instance
>> > running, so it can write an entry to the table and go off and do its
>> > thing.
>> >
>> > I want to be extremely certain that no issues arise in terms of one
>> > instance of the thread reading from the database while another
>> instance is
>> > writing, etc.  So, aside from transactional database calls and
>> row-level
>> > locking, I want to do one more thing: I want the thread to sleep a
>> random
>> > number of seconds (1-300) at startup.  This will ensure that, all the
>> > database locking and such aside, the threads should all be offset from
>> one
>> > another in terms of when they run.
>> >
>> > So, I need a random number generated when the thread starts up.  As we
>> all
>> > know though, random number generation on most computers that don't
>> have
>> > something like a Brownian motion sensor attached stuck in a cup of
>> boiling
>> > coffee can't generate truly random numbers.  So, in theory, what could
>> > happen is that if all the servers in the cluster come up at the same
>> time,
>> > the threads could wind up running at the same time regardless of the
>> > random sleep at the start!  It might never happen in reality, small
>> > fluctuations would probably offset them anyway, but I want to be more
>> > certain than that.
>> >
>> > So now we're at the crux of the problem...
>> >
>> > I can't just seed the random number generator with the current time
>> > because it concievably might not be random enough.  So, I thought I
>> could
>> > just tally up the octets of the server's IP address and add that to
>> the
>> > current time.  Then the seed on each server should be different
>> enough.
>> >
>> > But, there doesn't appear to be any way to get the server IP address
>> > independant of a request, so I can't get at it in my plugin.  Anyone
>> know
>> > differently?
>> >
>> > Assuming that is the case, can anyone think of any other way to seed
>> the
>> > generator that would ensure a different value on different machines in
>> the
>> > cluster?  There are some options like encoding the individual server
>> names
>> > in my app's config file with a different seed value for each, but that
>> > makes maintenance a pain if a new server is added or one removed or
>> > addresses simply changed.
>> >
>> > Any ideas?  Thanks!
>> >
>> > --
>> > Frank W. Zammetti
>> > Founder and Chief Software Architect
>> > Omnytex Technologies
>> > http://www.omnytex.com
>>
>> --
>> Kris Schneider 
>> D.O.Tech   
>>
>> -
>> 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: [OT] Re: Multiple ActionForms per ActionMapping

2005-03-18 Thread Frank W. Zammetti
On Fri, March 18, 2005 11:46 am, Rick Reumann said:
> Frank W. Zammetti wrote the following on 3/18/2005 11:34 AM:
>
>> At one point in time, and it might still stand, I don't
>> know, I had the record in the Army for typing speed.  I'm pretty quick
>> :)
>
> I'll have to start calling you Radar:) Although I think he was probably
> a pretty slow typist (faster than Klinger though I'm sure).

I like the teddy bear :)  Especially now that you can get those ones with
the micro-bead thingies that are soft as hell.  They rule!

It's actually a funny story the day I set the record (76 WPM by the way...
may not sound that high, but consider it was on an old teletype machine...
I've broken 100 on numerous typing test programs throughout the years on a
regular PC keyboard, some ridiculously high to the point where I believe
the program had to be flawed!)...

Being the Army, the seargents there were always busting our chops for
random, senseless reasons.  WHILE I WAS TYPING trying to set that record
(and I don't know that this was any kind of official thing by the way, but
the seargents seemed to keep track of it over the years) they were
absolutely KILLING me because even to this day, I do not type with
anything approaching a proper technique.  They couldn't believe I could
type AT ALL let alone as fast as I was.  It's just years of typing (since
I was about 7 as I recall) and just making up my own style.  I don't think
I should repeat most of the taunts they were using that day, but suffice
it to say it's amazing I got THAT high :)

What's more enjoyable now though than typing fast is the fact that, while
I don't have remotely proper technique, I can in fact touch-type rather
well.  This annoys my wife to no end... she comes in to my home office,
I'm hacking away at some code and she'll start talking to me... rather
than stop what I'm doing I'll just continue typing, looking off to the
side at her because of course I'd get yelled at if I didn't look at her
while she was talking, but then she yells at me anyway because I'm "being
a wise-ass" and coding while she's talking to me and not even looking at
the keyboard! (she's not a bad typist herself, probably in the 30-40 WPM
range, but she can't touch-type at all).

(perhaps at this point this thread should be marked with a double OT!)

> Rick

Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com


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



Re: Multiple ActionForms per ActionMapping

2005-03-18 Thread Niall Pemberton
- Original Message - 
From: "Frank W. Zammetti" <[EMAIL PROTECTED]>
Sent: Friday, March 18, 2005 4:34 PM

> Good question about what happens with setupItems when validation fails...
> I didn't think of that situation when I did it... Looking at the code,
> NONE of the setupItems would be executed when a validation failure occurs.
>  I could move the code that does the mapping-level items up before the
> validation is called and that would allow those to fire regardless.  In
> fact, I think that would be the only real answer because obviously the
> forward-level items wouldn't come in to play when a validation failure
> occurs. Good point for sure though. :)

If you changed your RequestProcessor to call processSetupsPerform(request,
forward) from the processForwardConfig() method rather than from the process
method() - then Struts could be configured to use an "input forward" for
error processing and the setupitems would get done.

So in the struts-config you would have













Niall



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



Re: Best way to cancel

2005-03-18 Thread Rick Reumann
Abdullah Jibaly wrote the following on 3/17/2005 5:55 PM:
Is there a way to press cancel on a display page and not have Struts
populate the ActionForm with the values that were entered? If not what
are some common workarounds to this? I basically want to be able to
retrieve the old values in that case.
I'd just go back to the server and get them again. "Cancel" would 
basically call whatever action or dispatch method you used to initially 
get the page. I don't think the DB hit to repopulate your form to the 
intial values would be that bad. Of course if it's not business specific 
data (no DB call) it would be even faster.

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


RE: Tomcat 5.5.7 + Connection Pool

2005-03-18 Thread Abdullah Jibaly
Alex,

Try using only the Resource element like this:



Regards,
Abdullah

-Original Message-
From: Alex Rodrigues da Silva [mailto:[EMAIL PROTECTED]
Sent: Friday, March 18, 2005 6:58 AM
To: user@struts.apache.org
Subject: Tomcat 5.5.7 + Connection Pool


Hi,
i'm trying to use a datasource, to connect to postgresql,
but i didn't do it.
my server.xml have this lines then i added above 
   :


  
  

factoryorg.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory
maxActive20
maxIdle10
maxWait-1
usernamepostgres

passwordirigon2004

driverClassNameorg.postgresql.Driver

urljdbc:postgresql:strutsdemo
  

and my postgresql.jar i added at /common/lib at tomcat.
but i get an exception no suitable driver.

can you help me ?

thanks 
-- 
Alex Rodrigues da Silva
Analista de Sistemas
tel.: 55 21 8825-1967
[EMAIL PROTECTED]
Linux User #378866

-
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: Interesting problem...

2005-03-18 Thread Martin Wegner

You can also use the Jakarta Commons ID packageto generate a GUID which is
guaranteed to be unique in the universe.  You could then convert the GUID
to your seed.



--- Kris Schneider <[EMAIL PROTECTED]> wrote:
> Will InetAddress.getLocalHost() work for you?
> NetworkInterface.getNetworkInterfaces() might also be of interest. Or,
> you
> might want to create yourself an instance of java.rmi.dgc.VMID...
> 
> Quoting "Frank W. Zammetti" <[EMAIL PROTECTED]>:
> 
> > Oh boy, I got a good one!  It's only related to Struts in that the
> > application in question is Struts-based, so I hope no one minds a
> semi-OT
> > question...
> > 
> > Here's the situation... An app I wrote has a daemon thread that is
> spawned
> > at startup (from a Struts plugin) that does periodic background
> processing
> > tasks.  This works great, never had a bit of trouble.
> > 
> > Now though, the app is moving from a single server to a clusted
> environment.
> > 
> > So, what's going to happen is that each server in the cluster will
> have
> > its own instance of the thread running on it.  Not a huge problem
> except
> > that I have to be sure only one instance of the thread (i.e., one
> server
> > in the cluster) is executing concurrently.
> > 
> > The easy solution is just a database table that is checked when the
> thread
> > wakes up.  If there is no entry in it, then there is no other instance
> > running, so it can write an entry to the table and go off and do its
> > thing.
> > 
> > I want to be extremely certain that no issues arise in terms of one
> > instance of the thread reading from the database while another
> instance is
> > writing, etc.  So, aside from transactional database calls and
> row-level
> > locking, I want to do one more thing: I want the thread to sleep a
> random
> > number of seconds (1-300) at startup.  This will ensure that, all the
> > database locking and such aside, the threads should all be offset from
> one
> > another in terms of when they run.
> > 
> > So, I need a random number generated when the thread starts up.  As we
> all
> > know though, random number generation on most computers that don't
> have
> > something like a Brownian motion sensor attached stuck in a cup of
> boiling
> > coffee can't generate truly random numbers.  So, in theory, what could
> > happen is that if all the servers in the cluster come up at the same
> time,
> > the threads could wind up running at the same time regardless of the
> > random sleep at the start!  It might never happen in reality, small
> > fluctuations would probably offset them anyway, but I want to be more
> > certain than that.
> > 
> > So now we're at the crux of the problem...
> > 
> > I can't just seed the random number generator with the current time
> > because it concievably might not be random enough.  So, I thought I
> could
> > just tally up the octets of the server's IP address and add that to
> the
> > current time.  Then the seed on each server should be different
> enough.
> > 
> > But, there doesn't appear to be any way to get the server IP address
> > independant of a request, so I can't get at it in my plugin.  Anyone
> know
> > differently?
> > 
> > Assuming that is the case, can anyone think of any other way to seed
> the
> > generator that would ensure a different value on different machines in
> the
> > cluster?  There are some options like encoding the individual server
> names
> > in my app's config file with a different seed value for each, but that
> > makes maintenance a pain if a new server is added or one removed or
> > addresses simply changed.
> > 
> > Any ideas?  Thanks!
> > 
> > -- 
> > Frank W. Zammetti
> > Founder and Chief Software Architect
> > Omnytex Technologies
> > http://www.omnytex.com
> 
> -- 
> Kris Schneider 
> D.O.Tech   
> 
> -
> 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]



[OT] Re: Multiple ActionForms per ActionMapping

2005-03-18 Thread Rick Reumann
Frank W. Zammetti wrote the following on 3/18/2005 11:34 AM:
At one point in time, and it might still stand, I don't
know, I had the record in the Army for typing speed.  I'm pretty quick :)
I'll have to start calling you Radar:) Although I think he was probably 
a pretty slow typist (faster than Klinger though I'm sure).

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


Re: ActionForm problem

2005-03-18 Thread Rick Reumann
Just curious, is your boolean getter autogenerated? It might be set up as
isSsnOnFile
which will work fine for booleans, but when you change to String it 
needs to find getSsnOnFile. My guess is maybe you changed the type but 
didn't change the syntax of the getter?

Hyrum wrote the following on 3/18/2005 10:14 AM:
I would still like to know what the root problem is here, the tag thing
aside.  Why can't the ValidatorActionForm see my value "ssnOnFile" when I
change the type from boolean to String??  Just for future reference, anyone
have any ideas??
-Original Message-
From: Hyrum [mailto:[EMAIL PROTECTED] 
Sent: Thursday, March 17, 2005 12:56 PM
To: user@struts.apache.org
Subject: ActionForm problem

I have successfully populated a jsp with items from a ValidatorActionForm.
One of the properties is a boolean, and it is printing the word "true" on my
page, where I want a 'Y' or 'N'.  So I changed the ValidatorForm so that the
property is a string.  Now I am getting this error:
 

An error occurred while evaluating custom action attribute "value" with
value "${manageFilerForm.ssnOnFile}": Unable to find a value for "ssnOnFile"
in object of class "com.trmarket.tax.forms.ManageFilerForm" using operator
"." (null)
 

I haven't changed the name of the property, just the type.  Does anyone know
what is causing this error?  Any help would be much appreciated.  Thanx.
 

Hyrum Ward
Software Developer
T&R Tax Services
 


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

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


Re: Interesting problem...

2005-03-18 Thread Frank W. Zammetti
Yes, I think InetAddress just might do the trick.  Thank you Kris!

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com

On Fri, March 18, 2005 11:24 am, Kris Schneider said:
> Will InetAddress.getLocalHost() work for you?
> NetworkInterface.getNetworkInterfaces() might also be of interest. Or, you
> might want to create yourself an instance of java.rmi.dgc.VMID...
>
> Quoting "Frank W. Zammetti" <[EMAIL PROTECTED]>:
>
>> Oh boy, I got a good one!  It's only related to Struts in that the
>> application in question is Struts-based, so I hope no one minds a
>> semi-OT
>> question...
>>
>> Here's the situation... An app I wrote has a daemon thread that is
>> spawned
>> at startup (from a Struts plugin) that does periodic background
>> processing
>> tasks.  This works great, never had a bit of trouble.
>>
>> Now though, the app is moving from a single server to a clusted
>> environment.
>>
>> So, what's going to happen is that each server in the cluster will have
>> its own instance of the thread running on it.  Not a huge problem except
>> that I have to be sure only one instance of the thread (i.e., one server
>> in the cluster) is executing concurrently.
>>
>> The easy solution is just a database table that is checked when the
>> thread
>> wakes up.  If there is no entry in it, then there is no other instance
>> running, so it can write an entry to the table and go off and do its
>> thing.
>>
>> I want to be extremely certain that no issues arise in terms of one
>> instance of the thread reading from the database while another instance
>> is
>> writing, etc.  So, aside from transactional database calls and row-level
>> locking, I want to do one more thing: I want the thread to sleep a
>> random
>> number of seconds (1-300) at startup.  This will ensure that, all the
>> database locking and such aside, the threads should all be offset from
>> one
>> another in terms of when they run.
>>
>> So, I need a random number generated when the thread starts up.  As we
>> all
>> know though, random number generation on most computers that don't have
>> something like a Brownian motion sensor attached stuck in a cup of
>> boiling
>> coffee can't generate truly random numbers.  So, in theory, what could
>> happen is that if all the servers in the cluster come up at the same
>> time,
>> the threads could wind up running at the same time regardless of the
>> random sleep at the start!  It might never happen in reality, small
>> fluctuations would probably offset them anyway, but I want to be more
>> certain than that.
>>
>> So now we're at the crux of the problem...
>>
>> I can't just seed the random number generator with the current time
>> because it concievably might not be random enough.  So, I thought I
>> could
>> just tally up the octets of the server's IP address and add that to the
>> current time.  Then the seed on each server should be different enough.
>>
>> But, there doesn't appear to be any way to get the server IP address
>> independant of a request, so I can't get at it in my plugin.  Anyone
>> know
>> differently?
>>
>> Assuming that is the case, can anyone think of any other way to seed the
>> generator that would ensure a different value on different machines in
>> the
>> cluster?  There are some options like encoding the individual server
>> names
>> in my app's config file with a different seed value for each, but that
>> makes maintenance a pain if a new server is added or one removed or
>> addresses simply changed.
>>
>> Any ideas?  Thanks!
>>
>> --
>> Frank W. Zammetti
>> Founder and Chief Software Architect
>> Omnytex Technologies
>> http://www.omnytex.com
>
> --
> Kris Schneider 
> D.O.Tech   
>
> -
> 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: Multiple ActionForms per ActionMapping

2005-03-18 Thread Frank W. Zammetti
On Fri, March 18, 2005 11:09 am, Rick Reumann said:
> Ok, not going down that road..wacko:)



> But seriously
> though, you said you had about 2000 lines of code between your
> ActionForms. How much time do you think it takes you type out all those
> getters and setters for all those properties?

Me persnoally?  At one point in time, and it might still stand, I don't
know, I had the record in the Army for typing speed.  I'm pretty quick :)

> No way, you can tell me
> that autogeneration of those set/get methods wouldn't save you time and
> we all know time==money.

Granted.  But I'm an old-school guys... I like knowing precisely where
every piece of code in my application came from, how it works, and so
forth.  This means I like to write it all.  I already have to give up a
lot just by using Java, an app server, a framework, heck, even an
operating system and BIOS and CPU microcode I suppose! :)  Ok, NOW you can
call me a wacko! :)

More importantly though, I'd have to leave UltraEdit to get that
capability, and that move I have found costs me more productivity than any
I might be able to gain in another environment.  My experience has been
that IDEs (where auto-generation tends to be done) slows me down more than
any gains it gives me.  Clearly this is not typical, but it is true for
me.

(I should point out though that a class with pretty much nothing but
getters and setters is NOT the case I would choose to argue against code
generation in general :)  This is a case I actually could live with it)

> But I know, there won't be any convincing you
> otherwise:)

Hey, it wouldn't be me if I wasn't stubborn! :)  Seriously though, when I
feel passionately about something, I will argue until I'm blue in the
face, but rest assured I will always listen, consider what others say and
allow myself to be convinced when I believe warranted.  I'm not
closed-minded, but I am stubborn and perhaps slow to change sometimes :)

> "An alternative approach is to use the action mapping path attribute. In
> this case, you extend the ValidatorActionForm instead of the
> ValidatorForm. The ValidatorActionForm uses the action element's path
> attribute from the Struts configuration which should match the form
> element's name attribute in the Validator configuration.
>
> Then a separate action mapping can be defined for each page in a
> multi-page form, and the validation form can be associated with the
> action rather than a page number (as shown in the example of a
> multi-page form in the validator example)."

Well, thank you for that.  I have to admit this is new to me.  I'll have
to go do some reading.

> Well, actually I like to have my own validate() method in each of my
> Dispatch Actions. I don't like having the framework call validate for
> me. One of the main reason is that if I'm in my action and I manually
> call my own action's validate() method then, if validation fails, I can
> make sure my prep method is always called. I wrote about this here
> http://reumann.net/struts/articles/request_lists.jsp and at the end I
> give an example of what I like to do. (I'm curious, in that approach you
> came up with, if validation were to fail, would the extra 'setup' that
> you added to the action mapping be called? If so, that would be very
> nice! if not then I'd still end up having to use my prep/set up method).

I was doing that same thing for a while too.  It does make sense.  The
arguments against it of course get in to what is proper separation of the
layers and all that jazz.

Good question about what happens with setupItems when validation fails...
I didn't think of that situation when I did it... Looking at the code,
NONE of the setupItems would be executed when a validation failure occurs.
 I could move the code that does the mapping-level items up before the
validation is called and that would allow those to fire regardless.  In
fact, I think that would be the only real answer because obviously the
forward-level items wouldn't come in to play when a validation failure
occurs. Good point for sure though. :)

> Rick

Frank


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



Re: Interesting problem...

2005-03-18 Thread Kris Schneider
Will InetAddress.getLocalHost() work for you?
NetworkInterface.getNetworkInterfaces() might also be of interest. Or, you
might want to create yourself an instance of java.rmi.dgc.VMID...

Quoting "Frank W. Zammetti" <[EMAIL PROTECTED]>:

> Oh boy, I got a good one!  It's only related to Struts in that the
> application in question is Struts-based, so I hope no one minds a semi-OT
> question...
> 
> Here's the situation... An app I wrote has a daemon thread that is spawned
> at startup (from a Struts plugin) that does periodic background processing
> tasks.  This works great, never had a bit of trouble.
> 
> Now though, the app is moving from a single server to a clusted environment.
> 
> So, what's going to happen is that each server in the cluster will have
> its own instance of the thread running on it.  Not a huge problem except
> that I have to be sure only one instance of the thread (i.e., one server
> in the cluster) is executing concurrently.
> 
> The easy solution is just a database table that is checked when the thread
> wakes up.  If there is no entry in it, then there is no other instance
> running, so it can write an entry to the table and go off and do its
> thing.
> 
> I want to be extremely certain that no issues arise in terms of one
> instance of the thread reading from the database while another instance is
> writing, etc.  So, aside from transactional database calls and row-level
> locking, I want to do one more thing: I want the thread to sleep a random
> number of seconds (1-300) at startup.  This will ensure that, all the
> database locking and such aside, the threads should all be offset from one
> another in terms of when they run.
> 
> So, I need a random number generated when the thread starts up.  As we all
> know though, random number generation on most computers that don't have
> something like a Brownian motion sensor attached stuck in a cup of boiling
> coffee can't generate truly random numbers.  So, in theory, what could
> happen is that if all the servers in the cluster come up at the same time,
> the threads could wind up running at the same time regardless of the
> random sleep at the start!  It might never happen in reality, small
> fluctuations would probably offset them anyway, but I want to be more
> certain than that.
> 
> So now we're at the crux of the problem...
> 
> I can't just seed the random number generator with the current time
> because it concievably might not be random enough.  So, I thought I could
> just tally up the octets of the server's IP address and add that to the
> current time.  Then the seed on each server should be different enough.
> 
> But, there doesn't appear to be any way to get the server IP address
> independant of a request, so I can't get at it in my plugin.  Anyone know
> differently?
> 
> Assuming that is the case, can anyone think of any other way to seed the
> generator that would ensure a different value on different machines in the
> cluster?  There are some options like encoding the individual server names
> in my app's config file with a different seed value for each, but that
> makes maintenance a pain if a new server is added or one removed or
> addresses simply changed.
> 
> Any ideas?  Thanks!
> 
> -- 
> Frank W. Zammetti
> Founder and Chief Software Architect
> Omnytex Technologies
> http://www.omnytex.com

-- 
Kris Schneider 
D.O.Tech   

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



Re: Multiple ActionForms per ActionMapping

2005-03-18 Thread Rick Reumann
Frank W. Zammetti wrote the following on 3/18/2005 10:42 AM:
I'm not a believer in auto-generated code under any circumstance, even
something as clearly mundane as getters and setters. 
Ok, not going down that road..wacko:) But seriously 
though, you said you had about 2000 lines of code between your 
ActionForms. How much time do you think it takes you type out all those 
getters and setters for all those properties? No way, you can tell me 
that autogeneration of those set/get methods wouldn't save you time and 
we all know time==money. But I know, there won't be any convincing you 
otherwise:)

Actually you can validate on an action mapping basis and not on the form
name, so only the fields you are interested in for the action mapping
get checked.

Can you explain that?  Are you talking about using declarative validation?
That is something I haven't used yet, but yes, I can see where that would
remove the point I made.
"An alternative approach is to use the action mapping path attribute. In 
this case, you extend the ValidatorActionForm instead of the 
ValidatorForm. The ValidatorActionForm uses the action element's path 
attribute from the Struts configuration which should match the form 
element's name attribute in the Validator configuration.

Then a separate action mapping can be defined for each page in a 
multi-page form, and the validation form can be associated with the 
action rather than a page number (as shown in the example of a 
multi-page form in the validator example)."

Certainly you would agree that if you choose to do validations in
validate(), you would have the problem I mentioned, right?  Or is there
something here for me to learn? :)

Well, actually I like to have my own validate() method in each of my 
Dispatch Actions. I don't like having the framework call validate for 
me. One of the main reason is that if I'm in my action and I manually 
call my own action's validate() method then, if validation fails, I can 
make sure my prep method is always called. I wrote about this here 
http://reumann.net/struts/articles/request_lists.jsp and at the end I 
give an example of what I like to do. (I'm curious, in that approach you 
came up with, if validation were to fail, would the extra 'setup' that 
you added to the action mapping be called? If so, that would be very 
nice! if not then I'd still end up having to use my prep/set up method).

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


Tomcat 5.5.7 + Connection Pool

2005-03-18 Thread Alex Rodrigues da Silva
Hi,
i'm trying to use a datasource, to connect to postgresql,
but i didn't do it.
my server.xml have this lines then i added above 
   :


  
  

factoryorg.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory
maxActive20
maxIdle10
maxWait-1
usernamepostgres

passwordirigon2004

driverClassNameorg.postgresql.Driver

urljdbc:postgresql:strutsdemo
  

and my postgresql.jar i added at /common/lib at tomcat.
but i get an exception no suitable driver.

can you help me ?

thanks 
-- 
Alex Rodrigues da Silva
Analista de Sistemas
tel.: 55 21 8825-1967
[EMAIL PROTECTED]
Linux User #378866

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



Re: ActionForm problem

2005-03-18 Thread Jeff Beal
Did you change the types on both the getter and the setter methods? 
Did you keep a setter with the boolean type?  I don't remember all of
the details, but I don't think that the following is a valid bean
property:

  public String getSsnOnFile() { return ssnOnFile ? "Y" : "N"; }
  public void setSsnOnFile(String ssnOnFileString) {
 ssnOnFile = "Y".equals(ssnOnFileString);
  }
  public void setSsnOnFile(boolean newSsnOnFile) {
 ssnOnFile = newSsnOnFile;
  }


On Fri, 18 Mar 2005 08:14:06 -0700, Hyrum <[EMAIL PROTECTED]> wrote:
> 
> I would still like to know what the root problem is here, the tag thing
> aside.  Why can't the ValidatorActionForm see my value "ssnOnFile" when I
> change the type from boolean to String??  Just for future reference, anyone
> have any ideas??
> 


-- 
Jeff Beal
Webmedx, Inc.
Pittsburgh, PA USA

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



Re: html:XXXXXX question

2005-03-18 Thread Rick Reumann
Scott Purcell wrote the following on 3/18/2005 10:27 AM:
I need to show an image (used to use ) This image does not need to be a url or anything. 
Use html:img for this and not html:image. Then you get set the height 
and width as above.

html:image is for when you want the img to become 
(If you did need an input type image I guess you'd have to use css to 
set height and width, but bottom line is you want html:img so just use 
that and you're all set)

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


Re: Multiple ActionForms per ActionMapping

2005-03-18 Thread Frank W. Zammetti
On Fri, March 18, 2005 10:42 am, Rick Reumann said:
> No, you are correct and sorry for the confusion.

No worries mate! :)

> Yes there is some over head if you have to forward to the setup of
> another action (vs going right to the JSP), but to me that's a small
> price to pay for having a clean consistent way of doing things - (All
> entries to X page go through X DispatchAction or even X SetUpAction if
> you hate the Dispatch).

I tend to agree the overhead isn't a huge concern in a great many
instances.  It's when you start talking about very high availability and
scalability requirements that every little bit counts.  Obviously you can
always throw hardware at things like this and render moot any debate about
whether an extra request here or there matters.  And while I agree with
you that what you suggest really isn't all that ugly, if there is a
solution that is even a little cleaner (a subjective debate to be sure)
*as well as* avoids that overhead, it's worth discussing. :)

> Rick

Frank

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



  1   2   >