Model 2 based framework for .NET released - Totally OFF TOPIC

2005-02-20 Thread Leandro Melo
Hi.
Sorry for this, hope nobody gets mad at met. But I'm
pretty sure there are people here that also work with
.NET. So...
I've worked in a MVC (Model-View-Controller) framework
for Microsoft .NET Web applications. The framework has
now been released and is in Beta version.
The framework is based on Model 2 from Sun
Microsystems, hence very similar to Struts (actually
it's inspired on Struts), though it's a lot
simpler.
Microsoft .NET provides a nice object model and a
event based system, so the final result of using this
new framework 
is close to what JSF (Java Server Faces) proposes.
I'm looking for some comments, opinions, ideas, bugs,
sugestions and critics. The project is supported by
SourceForge and is
available at http://sourceforge.net/projects/lattis/
or at http://lattis.sourceforge.net/.
Thank for attention and sorry for the inconvenience.

-- Leandro




__ 
Do you Yahoo!? 
Yahoo! Mail - 250MB free storage. Do more. Manage less. 
http://info.mail.yahoo.com/mail_250

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



RequestProcessor instantiation doubt ( in .NET)

2005-02-13 Thread Leandro Melo
Hi all.
The last days I've been working in a Struts like
framework for .NET. I guess most people that work for
companies that develop both in Java and in .NET whish
they had something like Struts for .NET projects.
The framework is almost ready (when I finish and
publish it, in few days, I'll send an e-mail to the
list).
My framework is a lot simpler than Struts. Although I
got a lot of ideas from Struts, it's not that similar
when we talk about coding. And here's comes my
question.
In Struts, when a http request hits the ActionServlet,
it delegates to a single RequestProcessor instance to
handle the request. There's only one RequestProcessor
instance per module in a Struts application because
this instance keeps a lot of information about
actions, module config, etc...
In my framework, when a http requests hits my Front
controller it delegates, in the same way as Struts, to
the RequestProcessor. However the RequestProcessor is
not responsible for keeping application configuration
information. Basically, I get a singleton class wich
keeps all this data. 
So, is it necessary for me to have only one instance
of the RequestProcessor??? Or should I just
instantiante one RequestProcessor for each http
request that hits my front controller What would
be the impact on performance for both approaches???
Well, that's it. I'm looking to hear some opinions on
that.
Thanks all and sorry for using Struts list for this,
but I really think it's here i can get the best
information.
Leandro




__ 
Do you Yahoo!? 
Yahoo! Mail - now with 250MB free storage. Learn more.
http://info.mail.yahoo.com/mail_250

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



RequestProcessor never assigned in ActionServlet.

2005-02-07 Thread Leandro Melo
Hi.
Why does the ActionServlet has a RequestProcessor
instance member that never gets assigned?
The point is that the ActionServlet uses the
RequestProcessor created by RequestUtils and never
assigns it to it's instance member.
I check this out in 1.1 and 1.2.4 source.
Any comments?





___ 
Yahoo! Acesso Grátis - Instale o discador do Yahoo! agora. 
http://br.acesso.yahoo.com/ - Internet rápida e grátis

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



Re: Synchronization in request processor may cause performance impacts????

2005-02-06 Thread Leandro Melo
Huummm... Got it now.
I'm using 1.1 source, that's why. I'll get the latest
version!

 --- Niall Pemberton
<[EMAIL PROTECTED]> escreveu: 
> I'm not sure which version of the source code you're
> looking at but this
> issue was raised in Bug 30707 and resolved in
> version 1.2.4 of Struts.
> 
>
http://issues.apache.org/bugzilla/show_bug.cgi?id=30707
> 
> While the getRequestProcessor() method is still
> synchronized, it only gets
> called if the getProcessorForModule() method returns
> null - that should
> happen only the first time a request is received for
> a module.
> 
> Niall
> 
> - Original Message - 
> From: "Leandro Melo" <[EMAIL PROTECTED]>
> Sent: Sunday, February 06, 2005 7:31 PM
> 
> 
> > Hi.
> > I was taking a look at struts source and found out
> > something new (to me, of course).
> > I knew that the RequestProcessor is the one that
> > acutally handles the request. Although it makes
> sense,
> > I didn't know that the method
> getRequestProcessor() in
> > the ActionServlet was synchronized.
> > Has anyone "measured" any performance impact that
> may
> > be cause by that?
> > Thanks.
> 
> 
> 
>
-
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
>  





___ 
Yahoo! Acesso Grátis - Instale o discador do Yahoo! agora. 
http://br.acesso.yahoo.com/ - Internet rápida e grátis

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



Re: Synchronization in request processor may cause performance impacts????

2005-02-06 Thread Leandro Melo
Huummm... Got it now.
I'm using 1.1 source, that's why. I'll get the latest
version!

 --- Niall Pemberton
<[EMAIL PROTECTED]> escreveu: 
> I'm not sure which version of the source code you're
> looking at but this
> issue was raised in Bug 30707 and resolved in
> version 1.2.4 of Struts.
> 
>
http://issues.apache.org/bugzilla/show_bug.cgi?id=30707
> 
> While the getRequestProcessor() method is still
> synchronized, it only gets
> called if the getProcessorForModule() method returns
> null - that should
> happen only the first time a request is received for
> a module.
> 
> Niall
> 
> - Original Message - 
> From: "Leandro Melo" <[EMAIL PROTECTED]>
> Sent: Sunday, February 06, 2005 7:31 PM
> 
> 
> > Hi.
> > I was taking a look at struts source and found out
> > something new (to me, of course).
> > I knew that the RequestProcessor is the one that
> > acutally handles the request. Although it makes
> sense,
> > I didn't know that the method
> getRequestProcessor() in
> > the ActionServlet was synchronized.
> > Has anyone "measured" any performance impact that
> may
> > be cause by that?
> > Thanks.
> 
> 
> 
>
-
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
>  





___ 
Yahoo! Acesso Grátis - Instale o discador do Yahoo! agora. 
http://br.acesso.yahoo.com/ - Internet rápida e grátis

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



Synchronization in request processor may cause performance impacts????

2005-02-06 Thread Leandro Melo
Hi.
I was taking a look at struts source and found out
something new (to me, of course).
I knew that the RequestProcessor is the one that
acutally handles the request. Although it makes sense,
I didn't know that the method getRequestProcessor() in
the ActionServlet was synchronized.
Has anyone "measured" any performance impact that may
be cause by that?
Thanks.





___ 
Yahoo! Acesso Grátis - Instale o discador do Yahoo! agora. 
http://br.acesso.yahoo.com/ - Internet rápida e grátis

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



RE: Initialization sequence diagram

2005-02-06 Thread Leandro Melo
Hi Martin.
I've already got Struts in Action and also have seen
http://rollerjm.free.fr. However, the diagrams
avalable overthere don't have the necessary details I
need. 
Anyway, until this moment I could get everything I
need from the Struts source. Sometimes it takes a
little more time, but it's also interesting.
I think that in a couple weeks I'll have something
useful and let you know.
My ideia is not to make a port os Struts for .NET. In
simple words, I'd just like to get the MVC 2 working
fine (I've already got this, but it's a mess at the
moment), what I think is the most important in .NET
(having in mind that it already has a nice tag an
object model).
Thanks.


 --- Martin Gainty <[EMAIL PROTECTED]> escreveu: 
> Leandro
> 
> Go to your local bookstore and purchase Struts in
> Action by Ted Husted
> and reference Page 48 Chapter 2 Exploring the Struts
> Structure
> The sequence diagram was created by Jean-Michael
> Carnier
> His website is located at
> http://rollerjm.free.fr
> 
> I have often wondered what MVC in .NET might  and am
> intensely curious if 
> anyone is implementing MVC within .NET
> environment..Please keep me apprised.
> 
> Bon Chance,
> Martin Gainty
> 
> __
> (mobile) 617-852-7822
> 
> 
> 
> >From: Leandro Melo <[EMAIL PROTECTED]>
> >Reply-To: "Struts Users Mailing List"
> 
> >To: struts jakarta 
> >Subject: Initialization sequence diagram
> >Date: Sun, 6 Feb 2005 15:20:57 -0300 (ART)
> >MIME-Version: 1.0
> >Received: from mail.apache.org ([209.237.227.199])
> by mc5-f9.hotmail.com 
> >with Microsoft SMTPSVC(6.0.3790.211); Sun, 6 Feb
> 2005 10:22:20 -0800
> >Received: (qmail 84669 invoked by uid 500); 6 Feb
> 2005 18:21:02 -
> >Received: (qmail 84656 invoked by uid 99); 6 Feb
> 2005 18:21:02 -
> >Received: neutral (hermes.apache.org: local policy)
> >Received: from web50908.mail.yahoo.com (HELO
> web50908.mail.yahoo.com) 
> >(206.190.38.128)  by apache.org (qpsmtpd/0.28) with
> SMTP; Sun, 06 Feb 2005 
> >10:21:00 -0800
> >Received: (qmail 34951 invoked by uid 60001); 6 Feb
> 2005 18:20:57 -
> >Received: from [201.8.168.50] by
> web50908.mail.yahoo.com via HTTP; Sun, 06 
> >Feb 2005 15:20:57 ART
> >X-Message-Info:
> JGTYoYF78jGwg8HimscAMO3rdJm6Iapc/ueMGEy9UT4=
> >Mailing-List: contact [EMAIL PROTECTED];
> run by ezmlm
> >Precedence: bulk
> >List-Unsubscribe:
> <mailto:[EMAIL PROTECTED]>
> >List-Subscribe:
> <mailto:[EMAIL PROTECTED]>
> >List-Help: <mailto:[EMAIL PROTECTED]>
> >List-Post: <mailto:user@struts.apache.org>
> >List-Id: "Struts Users Mailing List"
> 
> >Delivered-To: mailing list user@struts.apache.org
> >X-ASF-Spam-Status: No, hits=0.4
> required=10.0tests=DNS_FROM_RFC_ABUSE
> >X-Spam-Check-By: apache.org
> >X-Virus-Checked: Checked
> >Return-Path:
>
[EMAIL PROTECTED]
> >X-OriginalArrivalTime: 06 Feb 2005 18:22:20.0441
> (UTC) 
> >FILETIME=[CBC7E090:01C50C78]
> >
> >Hi all.
> >I'm working on something like struts for .net for a
> >project. If i get something actually usefull, i'll
> >post it somewhere.
> >I'm looking for a sequence diagram of struts
> >initialization, does anyone know where i can find
> one?
> >I don't want sequence diagrams for the request
> >process, but just of the framework initialization
> >itself. I mean, loading the config stuff...
> >Thanks.
> >
> >__
> >Converse com seus amigos em tempo real com o Yahoo!
> Messenger
> >http://br.download.yahoo.com/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]
> 
>  





___ 
Yahoo! Acesso Grátis - Instale o discador do Yahoo! agora. 
http://br.acesso.yahoo.com/ - Internet rápida e grátis

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



Initialization sequence diagram

2005-02-06 Thread Leandro Melo
Hi all.
I'm working on something like struts for .net for a
project. If i get something actually usefull, i'll
post it somewhere.
I'm looking for a sequence diagram of struts
initialization, does anyone know where i can find one?
I don't want sequence diagrams for the request
process, but just of the framework initialization
itself. I mean, loading the config stuff...
Thanks.

__
Converse com seus amigos em tempo real com o Yahoo! Messenger 
http://br.download.yahoo.com/messenger/ 

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



Re: Coupling between view and domain model (off topic)

2005-01-31 Thread Leandro Melo
Vic, the separation of view and model is clear on your
approach, liked it.
However, there`s still one of the coupling i
mentioned.
Suppose that one year later your client decided to
change the information contained in one of the pages.
He now wants the all the stuff from 2 pages in only 1
page. You`d probably have to make some changes in your
action. As you said, you created form beans based on
the html fields. Naturally, the way that the actions
manipulate these form beans will change (maybe just a
little if well disigned). 
THis is the other coupling i`m talking about.
I`m not saying this is wrong or this is bad modelling,
whatever. I`m just asking if there`s a very abstract
model where we don`t have the coupling. Maybe i`m
looking a little for mda...



--- Vic <[EMAIL PROTECTED]> wrote:

> 
> See if this methodology helps you separate the 2.
> When I start a project I do not care about DB or
> model; I only care 
> what the client wants, like what fields, where, etc.
> 
> I work w/ them to create html mock ups as
> requirments.
> Is this what they want?
> Once that's done, it's easy.
> I rename HTML to jsp and write Struact actions to
> get to each of the 
> said JSPs
> Then I write formbeans (since I know html fileds, I
> know get/set :-) ; 
> nothing w/ model).
> Now I have a prototype where I validate... is this
> what you want?
> ( See, no model. )
> 
> If yes... I design CURD of DAO and model (sometimes
> E/R, sometimes I 
> have to get data from various existing dbs)  in a
> way to populate or 
> save my form beans fields..
> I unit test the DAO's CRUD outside of container and
> outside of Struts. 
> If it does not CRUD here ... it won't start working
> once I put it in Struts.
> The 2 are as separate as possible. The CRUD might be
> simple or complex; 
> I assume the client does not care, as long as they
> get what they want.
> Only then do I integrate the 2.
> 
> .V
> 
> Leandro Melo wrote:
> 
> >Hi all.
> >This might seem more a design question than a
> struts
> >specific question. Anyway, if anyone could help me
> out
> >a little here.
> >I`m going to explain what is my approach for an
> >specific situation, then you tell me what you think
> >about that, ok.
> >When i`m designinig the web interface for a
> software,
> >i go something like this.
> >Suppose i have a table USER in database and also
> have
> >2 other tables that have relationships to this one.
> >They`re table USER_PROFILE and USER_ADDRESS.
> >I`m very used to build CRUD pages, so i usually go
> >with a design like this.
> >I got, for example, a UserCRUDPage, where the user
> can
> >set attributes like name, age, e-mail, etc... that
> >belong to the USER table in db. I also use
> something
> >like a navigation bar that in this specific case
> would
> >have 2 links, one for User Profile and other for
> User
> >Email.
> >This way, if the user wants to set/update his/her
> >address, he would just click on the link and go to
> the
> >AddressCRUDPage. The same thing would happen to
> >profile.
> >This design seems to be very nice to me.
> >Unfortunatelly, i had an experience last week that
> >made me think about that.
> >I had some Actions associated whith the updates. In
> >this case i had ActionUserUpdate,
> >ActionUserAddressUpdate and
> ActionUserProfileUpdate.
> >Naturally, this classes performed all the control
> >layer associated with those operations. It doesn`t
> >matter right now if the Actions are in diferent
> >classes or in the same one. If you want, you can
> think
> >that i actually had a DispatchActionUserCRUD for
> >example.
> >The "problem" started when my client decided that
> from
> >now on he would like to have the address operation
> >page in the same page of the user page. In this
> case i
> >had to mix the UserCRUDPage with the
> AddressCRUDPage
> >in only one page. My client also wanted that all
> the
> >data on the page could be updated with only one
> mouse
> >click (in other words, only one 'save' button).
> >Naturally, i was forced to make some small changes
> in
> >my pages (and it`s forms) and the associated
> Actions,
> >so now i need to a way of centralizing the
> operation
> >of both actions (User and Address). Briefly, i need
> to
> >make a few changes in my Action, that`s the point
> >here.
> >Although the changes were actually small, i started
> to
> >think that :
> >
> >My view is coupled to my control layer, wich is
> even
> >more coupled with my d

Coupling between view and domain model (off topic)

2005-01-31 Thread Leandro Melo
Hi all.
This might seem more a design question than a struts
specific question. Anyway, if anyone could help me out
a little here.
I`m going to explain what is my approach for an
specific situation, then you tell me what you think
about that, ok.
When i`m designinig the web interface for a software,
i go something like this.
Suppose i have a table USER in database and also have
2 other tables that have relationships to this one.
They`re table USER_PROFILE and USER_ADDRESS.
I`m very used to build CRUD pages, so i usually go
with a design like this.
I got, for example, a UserCRUDPage, where the user can
set attributes like name, age, e-mail, etc... that
belong to the USER table in db. I also use something
like a navigation bar that in this specific case would
have 2 links, one for User Profile and other for User
Email.
This way, if the user wants to set/update his/her
address, he would just click on the link and go to the
AddressCRUDPage. The same thing would happen to
profile.
This design seems to be very nice to me.
Unfortunatelly, i had an experience last week that
made me think about that.
I had some Actions associated whith the updates. In
this case i had ActionUserUpdate,
ActionUserAddressUpdate and ActionUserProfileUpdate.
Naturally, this classes performed all the control
layer associated with those operations. It doesn`t
matter right now if the Actions are in diferent
classes or in the same one. If you want, you can think
that i actually had a DispatchActionUserCRUD for
example.
The "problem" started when my client decided that from
now on he would like to have the address operation
page in the same page of the user page. In this case i
had to mix the UserCRUDPage with the AddressCRUDPage
in only one page. My client also wanted that all the
data on the page could be updated with only one mouse
click (in other words, only one 'save' button).
Naturally, i was forced to make some small changes in
my pages (and it`s forms) and the associated Actions,
so now i need to a way of centralizing the operation
of both actions (User and Address). Briefly, i need to
make a few changes in my Action, that`s the point
here.
Although the changes were actually small, i started to
think that :

My view is coupled to my control layer, wich is even
more coupled with my domain model.

Well, i`m not talking about big coupling here, but it
exists. In other workds i`m saying that in more
abstract point of view, this is what happens.
I really would like to hear comments about this whole
thing...
Thanks for reading.




__ 
Do you Yahoo!? 
Yahoo! Mail - Easier than ever with enhanced search. Learn more.
http://info.mail.yahoo.com/mail_250

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



JSF and Struts (off topic)

2005-01-11 Thread Leandro Melo
Hi all,
I need to start up very quick with JSF for a project!
Actually, I'm just gonna check it out to see if it's
worth a change!
Does anyone know somekinda guide "From Struts to
JSF"??
It could be just a beginner one.
Thanks.
ltcmelo



__ 
Do you Yahoo!? 
The all-new My Yahoo! - What will yours do?
http://my.yahoo.com 

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



Re: Where is the html:label tag (another workaround)???

2004-10-17 Thread Leandro Melo
I realized there is another work around.
I will use the bean:write tag and also create one
hidden field for each bean:write with the specific
property.
This way, this fields are reset in case of validation
failure. And i don't update these other fields in ejb
layer, there's no worry about exposing them anyway.
 

--- Craig McClanahan <[EMAIL PROTECTED]> escreveu: 
> On Sun, 17 Oct 2004 13:14:16 -0300 (ART), Leandro
> Melo
> <[EMAIL PROTECTED]> wrote:
> > Hi Craig, that what i first thought, but if i try
> to
> > substitute this
> > 
> > 
> > 
> > for this
> > 
> >  property="partyName"/>
> > 
> > ***where myFormBean is the value of the attribute
> > "attribute" for this Action (the form bean for
> this
> > action).
> > 
> > I get stuck with validation. It doesn't seem to
> > recognize this field as one of the form bean
> fields. I
> > shows me the message the partyName cannot be null
> as
> > it would if the user left this field blank when
> > submitting it.
> 
> That's definitely going to be a problem if this
> thing is sometimes an
> input field and sometimes not -- you'd need to use
> different
> validation rules in that case.
> 
> When I run into a situation like this, I use an
> input field with
> readonly set, and then use CSS to make it visually
> obvious that this
> is read-only text (such as grey text instead of
> black, and/or a
> different background color).  That way, it's still
> part of the input
> parameters.
> 
> Craig
>  





___ 
Yahoo! Acesso Grátis - Internet rápida e grátis. Instale o discador agora! 
http://br.acesso.yahoo.com/

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



Where is the html:label tag???

2004-10-16 Thread Leandro Melo
Hi,
what is the reason for not having a html:label tag?

Leandro.





___ 
Yahoo! Acesso Grátis - Internet rápida e grátis. Instale o discador agora! 
http://br.acesso.yahoo.com/

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


RE: Exposing ActionForm and MVC fields

2004-10-16 Thread Leandro Melo
Well, i actually end up doing the update only on the
required fields on my ejb layer. This way, i don't
need to worry about the exposure of the ActionForm
fields.



 --- "Freddy Villalba A." <[EMAIL PROTECTED]>
escreveu: 
> Hi,
> 
> 
> I believe you shouldn't abuse neither from the MVC
> pattern or the Struts'
> framework. All the issues regarding buyer's actions
> as well as seller's are
> part of an specific area: workflow management.
> 
> Implement a basic WF Management subsystem (or
> integrate one into your
> application), define the roles (buyer / seller /
> whatever...), the actions
> (along with the corresponding pre- and post-), the
> nodes, etc... and yes,
> have your presentation layer (Struts) integrate with
> it. I know it's not
> simple or cheap... yet, I'm almost convinced that,
> at the end, it would've
> been a good investment for you and your project.
> 
> Save yourself from trying to convert Struts into an
> all-mighty-god-who-knows-and-solves-everything tool.
> 
> For me, that's the bottom-line for all these issues.
> 
> Again, just my oppinion. HTH.
> 
> Cheers,
> Freddy.
> 
> 
> -Mensaje original-
> De: David Suarez [mailto:[EMAIL PROTECTED]
> Enviado el: viernes, 15 de octubre de 2004 17:06
> Para: [EMAIL PROTECTED]; Struts Users Mailing List
> Asunto: RE: Exposing ActionForm and MVC fields
> 
> 
> How about creating a hash/digest when you send the
> page down with your
> read-only fields and save it to session/hidden (you
> know the +/-), then
> compare it on the re-submit to see if any of the
> values have changed.
> If so, throw SecurityException or something similar?
> 
> Would that work for you...djsuarez
> 
> -Original Message-
> From: Lee Harrington [mailto:[EMAIL PROTECTED]
> Sent: Friday, October 15, 2004 8:52 AM
> To: Struts Users Mailing List
> Subject: Re: Exposing ActionForm and MVC fields
> 
> >  In this case, i`m still suceptible to be
> > hacked by javascript, because of the ActionForm
> fields
> > exposure.
> > What about that???
> 
> Different actions.  I'd reccomend a dispatch action
> class...with
> different methods depending on whether the buyer or
> seller submitted.
> That way, in the seller method, even if they did
> hack the submit form
> you action would not be doing anything with those
> fields.
> 
> Lee
> 
> 
>
-
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
> 
>
-
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
>  

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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



RE: Exposing ActionForm and MVC fields

2004-10-15 Thread Leandro Melo
It's seems allright.


 --- David Suarez <[EMAIL PROTECTED]>
escreveu: 
> How about creating a hash/digest when you send the
> page down with your
> read-only fields and save it to session/hidden (you
> know the +/-), then
> compare it on the re-submit to see if any of the
> values have changed.
> If so, throw SecurityException or something similar?
> 
> Would that work for you...djsuarez
> 
> -Original Message-
> From: Lee Harrington [mailto:[EMAIL PROTECTED] 
> Sent: Friday, October 15, 2004 8:52 AM
> To: Struts Users Mailing List
> Subject: Re: Exposing ActionForm and MVC fields
> 
> >  In this case, i`m still suceptible to be
> > hacked by javascript, because of the ActionForm
> fields
> > exposure.
> > What about that???
> 
> Different actions.  I'd reccomend a dispatch action
> class...with
> different methods depending on whether the buyer or
> seller submitted. 
> That way, in the seller method, even if they did
> hack the submit form
> you action would not be doing anything with those
> fields.
> 
> Lee
> 
> 
>
-
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
>  

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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



RE: Exposing ActionForm and MVC fields

2004-10-15 Thread Leandro Melo
Hi Freddy, i agree with you in parts.
Actually, i don`t have a formal workflow graph, but i
do have it in some sketches.
I think the point here is more about workflow
implementations details, isn`t it???



 --- "Freddy Villalba A." <[EMAIL PROTECTED]>
escreveu: 
> Hi,
> 
> 
> I believe you shouldn't abuse neither from the MVC
> pattern or the Struts'
> framework. All the issues regarding buyer's actions
> as well as seller's are
> part of an specific area: workflow management.
> 
> Implement a basic WF Management subsystem (or
> integrate one into your
> application), define the roles (buyer / seller /
> whatever...), the actions
> (along with the corresponding pre- and post-), the
> nodes, etc... and yes,
> have your presentation layer (Struts) integrate with
> it. I know it's not
> simple or cheap... yet, I'm almost convinced that,
> at the end, it would've
> been a good investment for you and your project.
> 
> Save yourself from trying to convert Struts into an
> all-mighty-god-who-knows-and-solves-everything tool.
> 
> For me, that's the bottom-line for all these issues.
> 
> Again, just my oppinion. HTH.
> 
> Cheers,
> Freddy.
> 
> 
> -Mensaje original-
> De: David Suarez [mailto:[EMAIL PROTECTED]
> Enviado el: viernes, 15 de octubre de 2004 17:06
> Para: [EMAIL PROTECTED]; Struts Users Mailing List
> Asunto: RE: Exposing ActionForm and MVC fields
> 
> 
> How about creating a hash/digest when you send the
> page down with your
> read-only fields and save it to session/hidden (you
> know the +/-), then
> compare it on the re-submit to see if any of the
> values have changed.
> If so, throw SecurityException or something similar?
> 
> Would that work for you...djsuarez
> 
> -Original Message-
> From: Lee Harrington [mailto:[EMAIL PROTECTED]
> Sent: Friday, October 15, 2004 8:52 AM
> To: Struts Users Mailing List
> Subject: Re: Exposing ActionForm and MVC fields
> 
> >  In this case, i`m still suceptible to be
> > hacked by javascript, because of the ActionForm
> fields
> > exposure.
> > What about that???
> 
> Different actions.  I'd reccomend a dispatch action
> class...with
> different methods depending on whether the buyer or
> seller submitted.
> That way, in the seller method, even if they did
> hack the submit form
> you action would not be doing anything with those
> fields.
> 
> Lee
> 
> 
>
-
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
> 
>
-
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
>  

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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



Re: Exposing ActionForm and MVC fields

2004-10-15 Thread Leandro Melo
Lee, even if i use different Actions i wil be still
using BeanUtils and still suceptible to hacking.


 --- Lee Harrington <[EMAIL PROTECTED]> escreveu: 
> >  In this case, i`m still suceptible to be
> > hacked by javascript, because of the ActionForm
> fields
> > exposure.
> > What about that???
> 
> Different actions.  I'd reccomend a dispatch action
> class...with
> different methods depending on whether the buyer or
> seller submitted. 
> That way, in the seller method, even if they did
> hack the submit form
> you action would not be doing anything with those
> fields.
> 
> Lee
> 
>
-
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
>  





___ 
Yahoo! Acesso Grátis - Internet rápida e grátis. Instale o discador agora! 
http://br.acesso.yahoo.com/

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



Re: Exposing ActionForm and MVC fields

2004-10-15 Thread Leandro Melo
Do you other sugestion then Hubert?


 --- Hubert Rabago <[EMAIL PROTECTED]> escreveu: 
> Hmm... you'd have to check how BeanUtils works if
> you do this. 
> BeanUtils will just copy properties without checking
> for the declared
> type, and in fact it can't check for the declared
> type.  Even if you
> just pass an interface declaration, the instance
> itself will expose
> the properties and BeanUtils will still populate
> them.
> 
> > ***
> > This e-mail and its attachments are not
> confidential
> > and are intended for anyone who will believe what 
> > I've written without holding me liable. 
> > If this has come to you in error, please
> > don't notify me at any given time and just delete
> this
> > e-mail from your system.
> > You must take no action that you will blame me for
> > later, though if you want you can copy or disclose
> 
> > it or any part of its contents to any person or
> organisation.
> > Statements and opinions contained in this email
> may
> > not necessarily represent those people who 
> > pay me. Please note that e-mail 
> > communications may be monitored by those
> > who have nothing better to do than read other
> people's e-mail.
> > 
> 
> On Fri, 15 Oct 2004 15:24:21 +0100, McCormack, Chris
> <[EMAIL PROTECTED]> wrote:
> > Like this:
> > 
> > MainDataObj implements ISeller, IBuyer
> > 
> > Seller implements ISeller
> > 
> > Buyer implements IBuyer
> > 
> > Seller seller = (ISeller)mainDataObj;
> > 
> > then add seller to the request and populate your
> form from that for the Seller view and vice versa
> for the Buyer view.
> > 
> > Friday pub lunch may have tarred my brain but I
> think that will work :)
> > 
> > Chris
> > 
> > 
> > 
> > -Original Message-
> > From: Leandro Melo
> [mailto:[EMAIL PROTECTED]
> > Sent: 15 October 2004 14:49
> > To: Struts Users Mailing List
> > Subject: RE: Exposing ActionForm and MVC fields
> > 
> > Hi Chris, what do you mean by "interfaces to
> filter"
> > (sorry for the stupidness)???
> > Is it an ordinary Servlet filter??
> > If so, i remember once using a few filters but i
> > coulnd`t get a reference to the request it self,
> only
> > to the context as a whole. Could you give an
> example?
> > 
> > --- "McCormack, Chris"
> > <[EMAIL PROTECTED]> escreveu:
> > > Look at using interfaces to filter the sensitive
> > > data away from each user when putting the data
> > > object in the request.
> > >
> > > Chris McCormack
> > >
> > 
> > ***
> > This e-mail and its attachments are confidential
> > and are intended for the above named recipient
> > only. If this has come to you in error, please
> > notify the sender immediately and delete this
> > e-mail from your system.
> > You must take no action based on this, nor must
> > you copy or disclose it or any part of its
> contents
> > to any person or organisation.
> > Statements and opinions contained in this email
> may
> > not necessarily represent those of Littlewoods.
> > Please note that e-mail communications may be
> monitored.
> > The registered office of Littlewoods Limited and
> its
> > subsidiaries is 100 Old Hall Street, Liverpool,
> L70 1AB.
> > Registered number of Littlewoods Limited is
> 262152.
> > 
> >
> 
>
-
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
>  





___ 
Yahoo! Acesso Grátis - Internet rápida e grátis. Instale o discador agora! 
http://br.acesso.yahoo.com/

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



RE: Exposing ActionForm and MVC fields

2004-10-15 Thread Leandro Melo
Hi Chris, what do you mean by "interfaces to filter"
(sorry for the stupidness)???
Is it an ordinary Servlet filter??
If so, i remember once using a few filters but i
coulnd`t get a reference to the request it self, only
to the context as a whole. Could you give an example?



 --- "McCormack, Chris"
<[EMAIL PROTECTED]> escreveu: 
> Look at using interfaces to filter the sensitive
> data away from each user when putting the data
> object in the request.
> 
> Chris McCormack
> 
> -Original Message-
> From: Leandro Melo
> [mailto:[EMAIL PROTECTED]
> Sent: 15 October 2004 13:53
> To: Struts Users Mailing List
> Subject: RE: Exposing ActionForm and MVC fields
> 
> 
> Hi guys, thanks for  your opinions, it seems that
> both
> of you stick with approach 2.
> 
> However, none of you mentioned that "exposing
> ActionForm fields" problem.
> 
> Suppose if build then 2 different pages (as you
> adviced me). I guess my Action for this both pages
> would still be the same, it will only send the
> request
> to 2 different pages depending the type of the
> company. Usually, i set the jsps pages form`s inside
> this Action (normally with BeanUtils), what will
> force
> me to give the correct names for the jsp form fields
> (even if they are labels for the case the user
> cannot
> alter them). In this case, i`m still suceptible to
> be
> hacked by javascript, because of the ActionForm
> fields
> exposure.
> What about that???
> 
> 
> 
>  --- "McCormack, Chris"
> <[EMAIL PROTECTED]> escreveu: 
> > +1
> > 
> > You could still create common elements to both
> pages
> > which will help maintain a look and feel and reuse
> > existing code, look at using different tile
> layouts
> > for each user type but the elements in the page
> are
> > common jsp/tile definitions.
> > If the spec for one user changes then you could
> > simply just copy the tile fragment that was
> changing
> > to a new location and work on it, then change the
> > tile definition for that user to point to the
> > updated fragement.
> > You would still maintain a majority of common code
> > and in the long run even if both user views
> totally
> > change you can deal with it as and when the
> changes
> > happen by copying and altering each tile fragment
> > that is changing and updating the tile definition
> to
> > point to the new fragment.
> > 
> > Chris McCormack
> > 
> > -Original Message-
> > From: Freddy Villalba A.
> > [mailto:[EMAIL PROTECTED]
> > Sent: 15 October 2004 11:54
> > To: Struts Users Mailing List
> > Subject: RE: Exposing ActionForm and MVC fields
> > 
> > 
> > Hi,
> > 
> > I'd go for approach #2. After all, they are
> > different VIEWS of the same
> > Model.
> > 
> > I've faced this situation in a couple of projects
> > before, and in both cases
> > buyer's and seller's views differed in the long
> run.
> > The more complex your
> > business rules / model gets, the higher is the
> > chance for that happening. It
> > may seem the right way to go at first (specially
> if
> > the differences are
> > insignificant), but after a few meetings with the
> > corporate managers, you'll
> > realize it was not such a smart move after all! :P
> > 
> > My humble oppinion,
> > Freddy.
> > 
> > -Mensaje original-
> > De: Leandro Melo
> [mailto:[EMAIL PROTECTED]
> > Enviado el: viernes, 15 de octubre de 2004 3:30
> > Para: struts jakarta
> > Asunto: Exposing ActionForm and MVC fields
> > 
> > 
> > Hi,
> > i'd like to hear some opinions.
> > 
> > I got a b2b application. I'm facing a desing
> > problem.
> > This problems is associated basically to 2 themes:
> > - MVC
> > - Exposing AcfionForm fields.
> > 
> > I got a page where the BUYER fills a form to buy
> an
> > specific item. The steps are very simple.
> > 
> > 1 - He sends a request for a quotation.
> > 2 - After the quotation, he sends a request for an
> > order.
> > 
> > The point is...
> > When the SELLER goes to make the quotation he's
> > supposed to see a very similar page to the one the
> > BUYER filled the information. This is obvious as
> the
> > information is the same for both parts. So, should
> i
> > implement the page for the SELLER:
> > 
> > ==>>>>>>> APPROACH 1 - using the same exact
> page
> >

RE: Exposing ActionForm and MVC fields

2004-10-15 Thread Leandro Melo
Hi guys, thanks for  your opinions, it seems that both
of you stick with approach 2.

However, none of you mentioned that "exposing
ActionForm fields" problem.

Suppose if build then 2 different pages (as you
adviced me). I guess my Action for this both pages
would still be the same, it will only send the request
to 2 different pages depending the type of the
company. Usually, i set the jsps pages form`s inside
this Action (normally with BeanUtils), what will force
me to give the correct names for the jsp form fields
(even if they are labels for the case the user cannot
alter them). In this case, i`m still suceptible to be
hacked by javascript, because of the ActionForm fields
exposure.
What about that???



 --- "McCormack, Chris"
<[EMAIL PROTECTED]> escreveu: 
> +1
> 
> You could still create common elements to both pages
> which will help maintain a look and feel and reuse
> existing code, look at using different tile layouts
> for each user type but the elements in the page are
> common jsp/tile definitions.
> If the spec for one user changes then you could
> simply just copy the tile fragment that was changing
> to a new location and work on it, then change the
> tile definition for that user to point to the
> updated fragement.
> You would still maintain a majority of common code
> and in the long run even if both user views totally
> change you can deal with it as and when the changes
> happen by copying and altering each tile fragment
> that is changing and updating the tile definition to
> point to the new fragment.
> 
> Chris McCormack
> 
> -Original Message-
> From: Freddy Villalba A.
> [mailto:[EMAIL PROTECTED]
> Sent: 15 October 2004 11:54
> To: Struts Users Mailing List
> Subject: RE: Exposing ActionForm and MVC fields
> 
> 
> Hi,
> 
> I'd go for approach #2. After all, they are
> different VIEWS of the same
> Model.
> 
> I've faced this situation in a couple of projects
> before, and in both cases
> buyer's and seller's views differed in the long run.
> The more complex your
> business rules / model gets, the higher is the
> chance for that happening. It
> may seem the right way to go at first (specially if
> the differences are
> insignificant), but after a few meetings with the
> corporate managers, you'll
> realize it was not such a smart move after all! :P
> 
> My humble oppinion,
> Freddy.
> 
> -Mensaje original-
> De: Leandro Melo [mailto:[EMAIL PROTECTED]
> Enviado el: viernes, 15 de octubre de 2004 3:30
> Para: struts jakarta
> Asunto: Exposing ActionForm and MVC fields
> 
> 
> Hi,
> i'd like to hear some opinions.
> 
> I got a b2b application. I'm facing a desing
> problem.
> This problems is associated basically to 2 themes:
> - MVC
> - Exposing AcfionForm fields.
> 
> I got a page where the BUYER fills a form to buy an
> specific item. The steps are very simple.
> 
> 1 - He sends a request for a quotation.
> 2 - After the quotation, he sends a request for an
> order.
> 
> The point is...
> When the SELLER goes to make the quotation he's
> supposed to see a very similar page to the one the
> BUYER filled the information. This is obvious as the
> information is the same for both parts. So, should i
> implement the page for the SELLER:
> 
> ==>>>>>>> APPROACH 1 - using the same exact page
> as the BUYER for the SELLER. Then i'd make the
> fields
> the BUYER filled disabled (or just make them labels)
> using some kind o scriptlet like this.
> 
>.../> ,
> 
>where sellerVisibility would be something =
>"disabled=true"
> 
> This approach seems nice to but i'd say that it's
> just
> not that cool!!! It doesn't look nice from an MVC
> point of view. I'll take the risk of having a lot of
> this kind of scripts in pages as the times goes by.
> I know that the Action (control layer) is actually
> responsible for setting the "sellerVisibility", what
> means that it's also not that bad from the MVC point
> of view.
> But any way, the major problem with this approah is
> that i use BeanUtils to copy data from the
> ActionForms
> to the VOs and vice-versa. So even with the fields
> disabled, i would take the risk of some smart guy
> cheatting and setting via javascript the fields he's
> not supposed to set. And as i copy the data with
> BeanUtils, my data will be changed when it's not
> supposed to do so.
> 
> 
> >>>>> APPROACH 2 - just create another page
> for the BUYER. This page would look exactly the same
> for the BUYER and the SELLER, but

Exposing ActionForm and MVC fields

2004-10-14 Thread Leandro Melo
Hi,
i'd like to hear some opinions.

I got a b2b application. I'm facing a desing problem.
This problems is associated basically to 2 themes:
- MVC
- Exposing AcfionForm fields.

I got a page where the BUYER fills a form to buy an
specific item. The steps are very simple.

1 - He sends a request for a quotation.
2 - After the quotation, he sends a request for an
order.

The point is...
When the SELLER goes to make the quotation he's
supposed to see a very similar page to the one the
BUYER filled the information. This is obvious as the
information is the same for both parts. So, should i
implement the page for the SELLER:

==>>> APPROACH 1 - using the same exact page
as the BUYER for the SELLER. Then i'd make the fields
the BUYER filled disabled (or just make them labels)
using some kind o scriptlet like this. 

   .../> , 

   where sellerVisibility would be something =   
   "disabled=true"

This approach seems nice to but i'd say that it's just
not that cool!!! It doesn't look nice from an MVC
point of view. I'll take the risk of having a lot of
this kind of scripts in pages as the times goes by. 
I know that the Action (control layer) is actually
responsible for setting the "sellerVisibility", what
means that it's also not that bad from the MVC point
of view.
But any way, the major problem with this approah is
that i use BeanUtils to copy data from the ActionForms
to the VOs and vice-versa. So even with the fields
disabled, i would take the risk of some smart guy
cheatting and setting via javascript the fields he's
not supposed to set. And as i copy the data with
BeanUtils, my data will be changed when it's not
supposed to do so.


> APPROACH 2 - just create another page
for the BUYER. This page would look exactly the same
for the BUYER and the SELLER, but they'll be different
pages. This way, i can build this other very similar
page without exposing my ActionForma attributes. This
approach seems to me allright from the MVC point of
view.
But the problem of this approach is that i'd start
building some kind of redundant and duplicated code.


Any opinions...

Leandro.





___ 
Yahoo! Acesso Grátis - Internet rápida e grátis. Instale o discador agora! 
http://br.acesso.yahoo.com/

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



Re: cleaning session

2004-10-06 Thread Leandro Melo
If you have your action in HttpSession, why don`t you
just call reset whenever a user clicks on the button
supposed to start this wizard?



 --- struts lover <[EMAIL PROTECTED]> escreveu: 
> Hello everyone,
> I am facing this problem of session. I have my
> action
> form in session(a wizard like thing). Now if the
> user
> starts filling in values  and clicks on the NEXT
> button, to go on to the next screen and then instead
> of completing the process of application, clicks on
> some other link.
> Again he wants to start with the application
> process,
> the form get pre-populated with the previous values,
> as the form in still in session. I want a clean
> form.
> How to overcome this problem???
> Any ideas???
> Thanks. 
> 
> 
>   
> ___
> Do you Yahoo!?
> Declare Yourself - Register online to vote today!
> http://vote.yahoo.com
> 
>
-
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
>  

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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



Re: Kind of out of topic, but... AOP in j2ee

2004-09-14 Thread Leandro Melo
Thanks vic!

 --- Vic <[EMAIL PROTECTED]> escreveu: 
> 
> You should check out Spring Framework. One of their
> major features is 
> AOP so check there on that.
> 
> (I like your idea about agents (check
> managebility.org, click open 
> source and find agents) and design paters book by
> GoF. For example CoR 
> patern is major part of Struts "2.0" code in CVS.
> You can post questions 
> about CoR on "Commons" user list  and get some
> help here.
> If you want something "futuristic" consider
> declerative programing like 
> JDNC and Flex and Longhorn's XAML or even Apache
> Jelly)
> 
> .V
> 
> Leandro Melo wrote:
> > Hi,
> > sorry for the kind of out of topic message, but
> i'm
> > looking for some information that developers like
> the
> > ones in this list may help me a little.
> > 
> > I'm applying for a master degree (M.sC) and i need
> to
> > have a project sumary, something like a "project
> idea"
> > for start up.
> > 
> > I've heard a lot about AOP (although i'm not very
> > familiar with it yet) then i thought i could
> submit a
> > project proposal about AOP, but i don't really
> know
> > what could be a good idea!
> > 
> > Instead of AOP i could also submit a proposal
> about
> > design patterns and agents.
> > 
> > Well, i'm just completely lost. If anyone could
> give
> > me an idea...??? May be a stupid one, but would be
> > probably better than mine.
> > 
> > Thanks,
> > ltcmelo
> > 
> > __
> > Do You Yahoo!?
> > Tired of spam?  Yahoo! Mail has the best spam
> protection around 
> > http://mail.yahoo.com 
> 
> 
> -- 
> Please post on Rich Internet Applications User
> Interface (RiA/SoA)
> <http://www.portalvu.com>
> 
> 
>
-
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
>  





___
Yahoo! Messenger 6.0 - jogos, emoticons sonoros e muita diversão. Instale agora!
http://br.download.yahoo.com/messenger/

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



Kind of out of topic, but... AOP in j2ee

2004-09-13 Thread Leandro Melo
Hi,
sorry for the kind of out of topic message, but i'm
looking for some information that developers like the
ones in this list may help me a little.

I'm applying for a master degree (M.sC) and i need to
have a project sumary, something like a "project idea"
for start up.

I've heard a lot about AOP (although i'm not very
familiar with it yet) then i thought i could submit a
project proposal about AOP, but i don't really know
what could be a good idea!

Instead of AOP i could also submit a proposal about
design patterns and agents.

Well, i'm just completely lost. If anyone could give
me an idea...??? May be a stupid one, but would be
probably better than mine.

Thanks,
ltcmelo

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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



Re: Advantages of J2EE w. Struts vs .NET ASP.NET

2004-09-12 Thread Leandro Melo
I guess it depends about what you really want for your
app. Is it just a project? Is it a product? Will it
need maintance? Do you care about best software
engineering? How much time do you have? 

My opinion is:
---> please answer this questions (just came up on
my mind at the moment).
Want a nice archictutred software? Want a maintanable
software? Want to make real use of design patterns?
Want a portable application? Want to work with tons of
best of breed techonologies (free)? Want to be able to
make choices among hundreds of frameworks (web,
validation, testing, persistence, code generation,
etc...)?
If you said YES to all of my last questions => Go for
J2EE!!! Better, go to a java enviroment!



 --- Anders Jacobsen <[EMAIL PROTECTED]> escreveu: 
> Hi
> 
> I think this place would be a good place to good
> some colored ;) comments on 
> and Web applications implemented with J2EE w./
> Struts and the same 
> implemented with ASP.NET.
> 
> Microsoft people tends to have just one
> point-of-view so I hope I could find 
> some people who preferable had experience with both
> frameworks.
> 
> I know it´s hard to find a winnner, but some
> con/pros from real developers 
> would be of great value. The main functionality of
> the web application is 
> edit/upate/delete operations and the like.
> 
> Thanks in regards
> Anders 
> 
> 
> 
> 
>
-
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
>  





___
Yahoo! Messenger 6.0 - jogos, emoticons sonoros e muita diversão. Instale agora!
http://br.download.yahoo.com/messenger/

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



Specifying validation field per Form, only way????

2004-09-11 Thread Leandro Melo
Hi,
do i need to specify validation fields per form in
validation.xml???

Suppose the field "name", for example, many form beans
may use this field. Is there a way i can specify a
global validation for "name", instead of specifying it
for all form beans that have the field name???



__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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



basic locale question

2004-09-11 Thread Leandro Melo
Hi,
this is very very basic.
When i started learning Java i really never payed
attention to that.

I don't have any one line of code in my struts
application that secifies my "locale". So, 

what's actually the default locale i'm using???

if i want to change the locale, how exactly should i
do?? would it be in a LogonAction ???


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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



good validator tutorial???

2004-09-10 Thread Leandro Melo
Hi,
what are your choices when talking about a nice
validator tutorial. Not only a start up one, but one
that covers some important features that "getting
started" tutorials usually doen't cover.

tx,
Leandro





___
Yahoo! Messenger 6.0 - jogos, emoticons sonoros e muita diversão. Instale agora!
http://br.download.yahoo.com/messenger/

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



Re: ActionForm data type X BeanUtils -> using Dates

2004-09-08 Thread Leandro Melo
That's because you don't know for how many hours i've
been sitting in from of my computer and screamming at
it, haha!!!


 --- Bryce Fischer <[EMAIL PROTECTED]>
escreveu: 
> Then you are doing better than I did. It took me
> several iterations to 
> figure it out. I ended up testing with two differnt
> forms, putting 
> breakpoints in my Converters to figure out what was
> going on...
> 
> 
> Leandro Melo wrote:
> 
> >I almost understand it in the other way, haha...
> >
> >Now things are clear!!!
> >
> >
> > --- Bryce Fischer <[EMAIL PROTECTED]>
> >escreveu: 
> >  
> >
> >>Leandro Melo wrote:
> >>
> >>
> >>
> >>>I got one doubt in your code when used in a
> >>>  
> >>>
> >>situation
> >>
> >>
> >>>that i mentioned (transforming data from action
> >>>  
> >>>
> >>form
> >>
> >>
> >>>to dto).
> >>>When date comes from action form, they usually
> come
> >>>  
> >>>
> >>in
> >>
> >>
> >>>Strings, but in your method you verify 
> >>>
> >>>value instanceof Date...
> >>>
> >>>This will never happen, as the value comes in
> >>>  
> >>>
> >>String.
> >>
> >>
> >>> 
> >>>
> >>>  
> >>>
> >>Sorry, I had it backwards (thats what I get when I
> >>post in a hurry).  
> >>The example I sent was converting a Date property
> to
> >>String. To convert 
> >>other types to Date I have the following
> Converter:
> >>
> >>public class DateConverter implements Converter{
> >>   public Object convert(Class type, Object value)
> {
> >>   if (value == null) {
> >>   return null;
> >>   } else if (type == Date.class) {
> >>   return convertToDate(type, value);
> >>   } else if (type == String.class) {
> >>   return convertToString(type, value);
> >>   }
> >>
> >>   throw new ConversionException("Could not
> >>convert " +
> >>
> >>value.getClass().getName() + " to " +
> >>
> >>type.getName());
> >>   }
> >>
> >>   protected Object convertToDate(Class type,
> Object
> >>value) {
> >>   if (value instanceof String) {
> >>   try {
> >>
> >>   return df.parse((String) value);
> >>   } catch (Exception pe) {
> >>   throw new
> ConversionException("Error
> >>converting String to 
> >>Date");
> >>   }
> >>   }
> >>
> >>   throw new ConversionException("Could not
> >>convert " +
> >>
> >>value.getClass().getName() + " to " +
> >>
> >>type.getName());
> >>   }
> >>}
> >>
> >>To register:
> >>
> >>ConvertUtils.register(new DateConverter(),
> >>Date.class);
> >>
> >>
> >>
> >>>Am i saying something stupid???
> >>>
> >>>I'm not saying your code is wrong, but not
> >>>  
> >>>
> >>appropriate
> >>
> >>
> >>>for the situation in question.
> >>>
> >>>Am i right?
> >>>
> >>>  
> >>>
> >>
> >>
>
>-
> >  
> >
> >>To unsubscribe, e-mail:
> >>[EMAIL PROTECTED]
> >>For additional commands, e-mail:
> >>[EMAIL PROTECTED]
> >>
> >> 
> >>
> >>
> >
> >
> > 
> > 
> > 
>
>___
> >Yahoo! Acesso Grátis - navegue de graça com conexão
> de qualidade! 
> >http://br.acesso.yahoo.com/
> >
>
>-
> >To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> >For additional commands, e-mail:
> [EMAIL PROTECTED]
> >
> >  
> >
> 
> 
>
-
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
>  





___
Yahoo! Acesso Grátis - navegue de graça com conexão de qualidade! 
http://br.acesso.yahoo.com/

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



Re: ActionForm data type X BeanUtils -> using Dates

2004-09-08 Thread Leandro Melo
I almost understand it in the other way, haha...

Now things are clear!!!


 --- Bryce Fischer <[EMAIL PROTECTED]>
escreveu: 
> Leandro Melo wrote:
> 
> >I got one doubt in your code when used in a
> situation
> >that i mentioned (transforming data from action
> form
> >to dto).
> >When date comes from action form, they usually come
> in
> >Strings, but in your method you verify 
> >
> >value instanceof Date...
> >
> >This will never happen, as the value comes in
> String.
> >  
> >
> 
> Sorry, I had it backwards (thats what I get when I
> post in a hurry).  
> The example I sent was converting a Date property to
> String. To convert 
> other types to Date I have the following Converter:
> 
> public class DateConverter implements Converter{
>public Object convert(Class type, Object value) {
>if (value == null) {
>return null;
>} else if (type == Date.class) {
>return convertToDate(type, value);
>} else if (type == String.class) {
>return convertToString(type, value);
>}
> 
>throw new ConversionException("Could not
> convert " +
> 
> value.getClass().getName() + " to " +
> 
> type.getName());
>}
> 
>protected Object convertToDate(Class type, Object
> value) {
>if (value instanceof String) {
>try {
> 
>return df.parse((String) value);
>} catch (Exception pe) {
>throw new ConversionException("Error
> converting String to 
> Date");
>}
>}
> 
>throw new ConversionException("Could not
> convert " +
> 
> value.getClass().getName() + " to " +
> 
> type.getName());
>}
> }
> 
> To register:
> 
> ConvertUtils.register(new DateConverter(),
> Date.class);
> 
> >Am i saying something stupid???
> >
> >I'm not saying your code is wrong, but not
> appropriate
> >for the situation in question.
> >
> >Am i right?
> >
> 
>
-
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
>  





___
Yahoo! Acesso Grátis - navegue de graça com conexão de qualidade! 
http://br.acesso.yahoo.com/

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



RE: ActionForm data type X BeanUtils -> using Dates

2004-09-08 Thread Leandro Melo
I was taking a look at bean utils source and could see
myself how this is done. Then i understood that
acutally you use the

value instanceof SOMETHING

However, the BeanUtilsBean class is quite complex and
i didn't have the patience (and the brains) to try to
understand it.

Anyway, it seems to me that when the "value" goes to
the convert method it already has a defined data type
(that's way the instanceof). But can anyone tell me
how exactly is the flux of data?? When does exactly my
"value" assumes the destination type???



 --- Leandro Melo <[EMAIL PROTECTED]>
escreveu: 
>  --- Jim Barrows <[EMAIL PROTECTED]> escreveu: 
> > 
> > 
> > > -Original Message-
> > > From: Leandro Melo
> > [mailto:[EMAIL PROTECTED]
> > > Sent: Wednesday, September 08, 2004 4:28 PM
> > > To: Struts Users Mailing List
> > > Subject: Re: ActionForm data type X BeanUtils ->
> > using Dates
> > > 
> > > 
> > > I got one doubt in your code when used in a
> > situation
> > > that i mentioned (transforming data from action
> > form
> > > to dto).
> > > When date comes from action form, they usually
> > come in
> > > Strings, but in your method you verify 
> > > 
> > > value instanceof Date...
> > 
> > Bi-directional conversion.  Look at what he does
> if
> > it is a date.  This isn't just for ActionForm to
> > DTO, it's for any other time you have to convert a
> > string to a date using BeanUtils.
> 
> 
> Yes Jim, "to convert a String to a Date", so if i
> use 
> 
> value instanceof Date
> 
> i will allways fail!!! Because value is a String,
> you
> just said that.
> 
> 
> 
> 
> 
> 
> > > This will never happen, as the value comes in
> > String.
> > > 
> > > Am i saying something stupid???
> > 
> > Not really... just not being generic enough for
> the
> > solution.
> > 
> > > 
> > > I'm not saying your code is wrong, but not
> > appropriate
> > > for the situation in question.
> > > 
> > > Am i right?
> > 
> > Sorta :)
> > 
> > > 
> > > 
> > >  --- Bryce Fischer <[EMAIL PROTECTED]>
> > > escreveu: 
> > > > The custom converter is done independently of
> > the
> > > > action, form or DTO.
> > > > 
> > > > First step is to implement the interface 
> > > > org.apache.commons.beanutils.Converter.
> > > > 
> > > > Keep in mind that the converter you are
> writing
> > uses
> > > > the appropriate 
> > > > converter for the original class. So, if you
> > were
> > > > converting from a 
> > > > String to a Date, you would create a String
> > > > converter. And vice versa, 
> > > > if you were converting from a Date to a String
> > you
> > > > would create a Date 
> > > > converter. Example below
> > > > 
> > > > Then, to override the standard converters, you
> > call:
> > > > ConvertUtils.register(,
> >  > > > to use converter 
> > > > on>.class);
> > > > 
> > > > First parameter is your new converter, and the
> > > > second is the class its 
> > > > used for. I call this in a static initializer
> of
> > a
> > > > utility class, you 
> > > > just need to make sure its called before any
> > > > validations occur, and it 
> > > > only needs to be done once.
> > > > 
> > > > Since we are interested in customizing
> > conversions
> > > > from String to Date, 
> > > > I override the String converter:
> > > > 
> > > > public class StringConverter implements
> > Converter{
> > > >public Object convert(Class type, Object
> > value) {
> > > >   Object returnObj = null;
> > > >   if (value != null) {
> > > >  if (value instanceof Date){
> > > > returnObj =
> > > > dateFormatter.format((Date)value);
> > > >  } else if (value instanceof
> > BigDecimal){
> > > > returnObj =
> > > > decimalFormatter.format((BigDecimal)value);
> > > >  } else {
> > > > returnObj = value.toString();
> >

RE: ActionForm data type X BeanUtils -> using Dates

2004-09-08 Thread Leandro Melo
 --- Jim Barrows <[EMAIL PROTECTED]> escreveu: 
> 
> 
> > -Original Message-
> > From: Leandro Melo
> [mailto:[EMAIL PROTECTED]
> > Sent: Wednesday, September 08, 2004 4:28 PM
> > To: Struts Users Mailing List
> > Subject: Re: ActionForm data type X BeanUtils ->
> using Dates
> > 
> > 
> > I got one doubt in your code when used in a
> situation
> > that i mentioned (transforming data from action
> form
> > to dto).
> > When date comes from action form, they usually
> come in
> > Strings, but in your method you verify 
> > 
> > value instanceof Date...
> 
> Bi-directional conversion.  Look at what he does if
> it is a date.  This isn't just for ActionForm to
> DTO, it's for any other time you have to convert a
> string to a date using BeanUtils.


Yes Jim, "to convert a String to a Date", so if i use 

value instanceof Date

i will allways fail!!! Because value is a String, you
just said that.






> > This will never happen, as the value comes in
> String.
> > 
> > Am i saying something stupid???
> 
> Not really... just not being generic enough for the
> solution.
> 
> > 
> > I'm not saying your code is wrong, but not
> appropriate
> > for the situation in question.
> > 
> > Am i right?
> 
> Sorta :)
> 
> > 
> > 
> >  --- Bryce Fischer <[EMAIL PROTECTED]>
> > escreveu: 
> > > The custom converter is done independently of
> the
> > > action, form or DTO.
> > > 
> > > First step is to implement the interface 
> > > org.apache.commons.beanutils.Converter.
> > > 
> > > Keep in mind that the converter you are writing
> uses
> > > the appropriate 
> > > converter for the original class. So, if you
> were
> > > converting from a 
> > > String to a Date, you would create a String
> > > converter. And vice versa, 
> > > if you were converting from a Date to a String
> you
> > > would create a Date 
> > > converter. Example below
> > > 
> > > Then, to override the standard converters, you
> call:
> > > ConvertUtils.register(,
>  > > to use converter 
> > > on>.class);
> > > 
> > > First parameter is your new converter, and the
> > > second is the class its 
> > > used for. I call this in a static initializer of
> a
> > > utility class, you 
> > > just need to make sure its called before any
> > > validations occur, and it 
> > > only needs to be done once.
> > > 
> > > Since we are interested in customizing
> conversions
> > > from String to Date, 
> > > I override the String converter:
> > > 
> > > public class StringConverter implements
> Converter{
> > >public Object convert(Class type, Object
> value) {
> > >   Object returnObj = null;
> > >   if (value != null) {
> > >  if (value instanceof Date){
> > > returnObj =
> > > dateFormatter.format((Date)value);
> > >  } else if (value instanceof
> BigDecimal){
> > > returnObj =
> > > decimalFormatter.format((BigDecimal)value);
> > >  } else {
> > > returnObj = value.toString();
> > >  }
> > >   }
> > >  
> > >   return returnObj;
> > >}
> > > }
> > > 
> > > I've left out some properties, their getters and
> > > setters, but I think 
> > > you get the gist of what I'm doing. Now, I
> register
> > > this converter as such:
> > > 
> > > ConvertUtils.register(new StringConverter(),
> > > String.class);
> > > 
> > > I actually have a utility class, where the
> register
> > > is done in the 
> > > static initializer. I suppose another way would
> be
> > > to use a servlet that 
> > > loads prior to Struts.. Or if your Actions have
> a
> > > base class, etc...
> > > 
> > > Maybe there's a more elegant way of doing that.
> This
> > > is what I've come 
> > > up with. If someone has a better way, post
> please,
> > > I'm always looking 
> > > for more elegant ways of accomplishing stuff
> like
> > > this.
> > > 
> > > Jason King wrote:
> > > 
> > > > Could you point us at some code that does
> this? 
> > > Do you customize in 
&

Re: ActionForm data type X BeanUtils -> using Dates

2004-09-08 Thread Leandro Melo
I got one doubt in your code when used in a situation
that i mentioned (transforming data from action form
to dto).
When date comes from action form, they usually come in
Strings, but in your method you verify 

value instanceof Date...

This will never happen, as the value comes in String.

Am i saying something stupid???

I'm not saying your code is wrong, but not appropriate
for the situation in question.

Am i right?


 --- Bryce Fischer <[EMAIL PROTECTED]>
escreveu: 
> The custom converter is done independently of the
> action, form or DTO.
> 
> First step is to implement the interface 
> org.apache.commons.beanutils.Converter.
> 
> Keep in mind that the converter you are writing uses
> the appropriate 
> converter for the original class. So, if you were
> converting from a 
> String to a Date, you would create a String
> converter. And vice versa, 
> if you were converting from a Date to a String you
> would create a Date 
> converter. Example below
> 
> Then, to override the standard converters, you call:
> ConvertUtils.register(,  to use converter 
> on>.class);
> 
> First parameter is your new converter, and the
> second is the class its 
> used for. I call this in a static initializer of a
> utility class, you 
> just need to make sure its called before any
> validations occur, and it 
> only needs to be done once.
> 
> Since we are interested in customizing conversions
> from String to Date, 
> I override the String converter:
> 
> public class StringConverter implements Converter{
>public Object convert(Class type, Object value) {
>   Object returnObj = null;
>   if (value != null) {
>  if (value instanceof Date){
> returnObj =
> dateFormatter.format((Date)value);
>  } else if (value instanceof BigDecimal){
> returnObj =
> decimalFormatter.format((BigDecimal)value);
>  } else {
> returnObj = value.toString();
>  }
>   }
>  
>   return returnObj;
>}
> }
> 
> I've left out some properties, their getters and
> setters, but I think 
> you get the gist of what I'm doing. Now, I register
> this converter as such:
> 
> ConvertUtils.register(new StringConverter(),
> String.class);
> 
> I actually have a utility class, where the register
> is done in the 
> static initializer. I suppose another way would be
> to use a servlet that 
> loads prior to Struts.. Or if your Actions have a
> base class, etc...
> 
> Maybe there's a more elegant way of doing that. This
> is what I've come 
> up with. If someone has a better way, post please,
> I'm always looking 
> for more elegant ways of accomplishing stuff like
> this.
> 
> Jason King wrote:
> 
> > Could you point us at some code that does this? 
> Do you customize in 
> > the action, the form or the DTO? 
> 
> 
>
-
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
>  





___
Yahoo! Acesso Grátis - navegue de graça com conexão de qualidade! 
http://br.acesso.yahoo.com/

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



RE: ActionForm with all application attributes

2004-09-08 Thread Leandro Melo
Thanks, i`ll take a look at that in the next days!!


 --- Jim Barrows <[EMAIL PROTECTED]> escreveu: 
> 
> 
> > -Original Message-
> > From: Leandro Melo
> [mailto:[EMAIL PROTECTED]
> > Sent: Wednesday, September 08, 2004 10:25 AM
> > To: Struts Users Mailing List
> > Subject: RE: ActionForm with all application
> attributes
> > 
> > 
> >  --- Jim Barrows <[EMAIL PROTECTED]> escreveu: 
> > > 
> > > 
> > > > -Original Message-
> > > > From: Leandro Melo
> > > [mailto:[EMAIL PROTECTED]
> > > > Sent: Wednesday, September 08, 2004 9:48 AM
> > > > To: Struts Users Mailing List
> > > > Subject: RE: ActionForm with all application
> > > attributes
> > > > 
> > > > 
> > > > Jim, all the code i`m talking about is inside
> a
> > > Base
> > > > Action Form. It seems the you`re thinking that
> my
> > > code
> > > > is inside a action, aren`t you?? Maybe a
> > > > misundertanding, maybe mine, maybe yours.
> > > 
> > > No, I understood you to have it in a Base
> Action.
> > > 
> > > > 
> > > > So, i agree with some of your comments, but
> not on
> > > all
> > > > of thems. In fact, i`m gonna to take a look
> about
> > > this
> > > > customized classes to use with validator.
> > > 
> > > Another trick, is to use the same AcitonForm
> class,
> > > but call it different things.  Since validator
> will
> > > work by name, and not by class you can customize
> > > based on that alone.  You can also validate a
> form
> > > by action mapping, rather then by form name.
> > 
> > 
> > Would you mind showing an example on how to do
> that?
> 
>
http://struts.apache.org/api/org/apache/struts/validator/ValidatorActionForm.html
> As opposed to ValidatorForm.  
> The following is from memory, but should be close.
> Assuming the following struts-config.xml
> blah blah
> 
type="com.sssc.csr.web.forms.BorrowerDemographicsForm">
> blah blah
>name="ChangeAddressForm" 
>   validate="true" 
>   type="com.sssc.csr.web.actions.ChangeAddressAction"
> 
>   scope="request">
> 
>path="changeAddress">
> 
> 
> 
> Normaly, your validation.xml would look like:
> 
> blah blah.
> 
> 
> Using the path mapping you would have the following
> in your validation.xml:
> blah blah
> 
> blah blah.
> 
> 
> AND, don't forget inherit from ValidatorActionForm,
> as oppposed to ValidatorForm.
> 
>
-
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
>  





___
Yahoo! Acesso Grátis - navegue de graça com conexão de qualidade! 
http://br.acesso.yahoo.com/

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



RE: ActionForm with all application attributes

2004-09-08 Thread Leandro Melo
 --- Jim Barrows <[EMAIL PROTECTED]> escreveu: 
> 
> 
> > -Original Message-
> > From: Leandro Melo
> [mailto:[EMAIL PROTECTED]
> > Sent: Wednesday, September 08, 2004 9:48 AM
> > To: Struts Users Mailing List
> > Subject: RE: ActionForm with all application
> attributes
> > 
> > 
> > Jim, all the code i`m talking about is inside a
> Base
> > Action Form. It seems the you`re thinking that my
> code
> > is inside a action, aren`t you?? Maybe a
> > misundertanding, maybe mine, maybe yours.
> 
> No, I understood you to have it in a Base Action.
> 
> > 
> > So, i agree with some of your comments, but not on
> all
> > of thems. In fact, i`m gonna to take a look about
> this
> > customized classes to use with validator.
> 
> Another trick, is to use the same AcitonForm class,
> but call it different things.  Since validator will
> work by name, and not by class you can customize
> based on that alone.  You can also validate a form
> by action mapping, rather then by form name.


Would you mind showing an example on how to do that?





> >  --- Jim Barrows <[EMAIL PROTECTED]> escreveu: 
> > > 
> > > 
> > > > -Original Message-
> > > > From: Leandro Melo
> > > [mailto:[EMAIL PROTECTED]
> > > > Sent: Tuesday, September 07, 2004 5:48 PM
> > > > To: struts jakarta
> > > > Subject: ActionForm with all application
> > > attributes
> > > > 
> > > > 
> > > > Hi, 
> > > > i sent this question yesterday, but as nowbody
> > > > answered me, i trying it again with a more
> > > > sifinificant title (sorry for the re-post).
> > > > Also, if i'm doing something terrible, i'd
> like to
> > > > know.
> > > > 
> > > > Keeping in mind that more than one action form
> may
> > > > have to validate and/or reset the same fields,
> i
> > > > decided to this.
> > > >  
> > > > I already have a MyBaseActionForm which
> > > incorporates
> > > > all
> > > > some methods that i need in my application. I
> > > don't
> > > > use Validator, as i prefer to use java classes
> for
> > > > validation  ligth business logic.
> > > > 
> > > > Now, i decided to add ALL fileds (setters and
> > > > getters)
> > > > i have in my application as private members of
> > > this
> > > > MyBaseActionForm.
> > > > 
> > > > Then i created classes WebValidation and
> WebReset.
> > > > This classes have validate methods for all
> fields
> > > in
> > > > my application. These classes can access the
> > > fields
> > > > they need for each method because all my
> action
> > > > forms
> > > > extend the MyBaseActionForm, thus this
> > > WebValidation
> > > > and WebReset classes can call the setters and
> > > > getters
> > > > of an y action form to validate with the light
> > > > business logic i need.
> > > > 
> > > > I got with this approach a centralized way and
> > > > "component" responsible for the validation.
> All my
> > > > action forms delegate the validate and reset
> > > methods
> > > > to the classes i mentioned.
> > > > 
> > > > I'd like to briefly describe some nice
> > > > benefits of this approach.
> > > > 
> > > > - With this approach i definetly solve my
> earlier
> > > > problem that i posted on question "1:N
> > > relationships -
> > > > ActionForm x DTOs".
> > > 
> > > Didn't see this post, but yes there could be 1
> to
> > > many between ActinForm and DTO's, and this is
> not a
> > > problem.  ActionForms directly represent what is
> on
> > > the screen, while DTO's represent your data. 
> You
> > > have a 1-to-many relationship between screens
> and
> > > tables.
> > > 
> > > > 
> > > > - With this approach i got no coupling between
> my
> > > > ActionForm and DTOs.
> > > 
> > > What do you mean by coupling?  You still have to
> > > transfer data to and from the DTO.
> > > 
> > > > 
> > > > - With this approach i have a centralized
> validate
> > > > unit. It's very usual to hav

Re: ActionForm data type X BeanUtils -> using Dates

2004-09-08 Thread Leandro Melo
I also would like to see this "converter" code and how
to use it!!!


 --- Jason King <[EMAIL PROTECTED]> escreveu: 
> Could you point us at some code that does this?  Do
> you customize in the 
> action, the form or the DTO?
> Bryce Fischer wrote:
> 
> > You can register a different converter that
> BeanUtils uses to copy 
> > from a string to a date. Write your own converter,
> using the date 
> > format you need, then use
> ConvertUtils.register(...) to register it.
> >
> > That's what I do anyhow.
> >
> >> -Original Message-
> >> From: Leandro Melo
> [mailto:[EMAIL PROTECTED]
> >> Sent: Wednesday, September 08, 2004 10:21 AM
> >> To: struts jakarta
> >> Subject: ActionForm data type X BeanUtils ->
> using Dates
> >>
> >>
> >> Hi,
> >> i believe that a lot of developers use BeanUtils
> to
> >> copy the data from ActionForms to the specific
> DTOs.
> >> I've used this approach, but right now i'm facing
> a
> >> problem, not a big one.
> >> I've allways been confused about working with
> dates in
> >> Java. I got a jsp where the user must input a
> date in
> >> the following format.
> >> Date: dd/mm/  That's how we use dates in
> Brazil: the day, month and
> >> year.
> >> I'd like to make a validation if the user input
> the
> >> date in the correct manner in the ActionForm (i'm
> >> using traditional validation and the user input
> comes
> >> in a String). So, keeping in mind the variou ways
> of
> >> doing this date validation (even the deprecated
> ones),
> >> how should a do the date validation Which one
> is
> >> the best way??? I just want to check if the user
> input
> >> a day with 2 digits,  a slash, a month with 2
> digits,
> >> a slash and a year with 4 digits.
> >> Also, after that i'd like to copy this form data
> to my
> >> DTO with BeanUtils. Which type should i use in my
> DTO for this 
> >> date??? Thanks,
> >> Leandro.
> >>  
> >>
> >
> >
>
-
> > 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]
> 
>  





___
Yahoo! Acesso Grátis - navegue de graça com conexão de qualidade! 
http://br.acesso.yahoo.com/

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



RE: ActionForm with all application attributes

2004-09-08 Thread Leandro Melo
Jim, all the code i`m talking about is inside a Base
Action Form. It seems the you`re thinking that my code
is inside a action, aren`t you?? Maybe a
misundertanding, maybe mine, maybe yours.

So, i agree with some of your comments, but not on all
of thems. In fact, i`m gonna to take a look about this
customized classes to use with validator.

 


 --- Jim Barrows <[EMAIL PROTECTED]> escreveu: 
> 
> 
> > -Original Message-
> > From: Leandro Melo
> [mailto:[EMAIL PROTECTED]
> > Sent: Tuesday, September 07, 2004 5:48 PM
> > To: struts jakarta
> > Subject: ActionForm with all application
> attributes
> > 
> > 
> > Hi, 
> > i sent this question yesterday, but as nowbody
> > answered me, i trying it again with a more
> > sifinificant title (sorry for the re-post).
> > Also, if i'm doing something terrible, i'd like to
> > know.
> > 
> > Keeping in mind that more than one action form may
> > have to validate and/or reset the same fields, i
> > decided to this.
> >  
> > I already have a MyBaseActionForm which
> incorporates
> > all
> > some methods that i need in my application. I
> don't
> > use Validator, as i prefer to use java classes for
> > validation  ligth business logic.
> > 
> > Now, i decided to add ALL fileds (setters and
> > getters)
> > i have in my application as private members of
> this
> > MyBaseActionForm.
> > 
> > Then i created classes WebValidation and WebReset.
> > This classes have validate methods for all fields
> in
> > my application. These classes can access the
> fields
> > they need for each method because all my action
> > forms
> > extend the MyBaseActionForm, thus this
> WebValidation
> > and WebReset classes can call the setters and
> > getters
> > of an y action form to validate with the light
> > business logic i need.
> > 
> > I got with this approach a centralized way and
> > "component" responsible for the validation. All my
> > action forms delegate the validate and reset
> methods
> > to the classes i mentioned.
> > 
> > I'd like to briefly describe some nice
> > benefits of this approach.
> > 
> > - With this approach i definetly solve my earlier
> > problem that i posted on question "1:N
> relationships -
> > ActionForm x DTOs".
> 
> Didn't see this post, but yes there could be 1 to
> many between ActinForm and DTO's, and this is not a
> problem.  ActionForms directly represent what is on
> the screen, while DTO's represent your data.  You
> have a 1-to-many relationship between screens and
> tables.
> 
> > 
> > - With this approach i got no coupling between my
> > ActionForm and DTOs.
> 
> What do you mean by coupling?  You still have to
> transfer data to and from the DTO.
> 
> > 
> > - With this approach i have a centralized validate
> > unit. It's very usual to have more than 1 action
> form
> > validating the same field, what may causes some
> > duplication and a harder maintenance. A central
> unit
> > of validation and resetting suits this problem
> very
> > well.
> 
> The strtus validate stuff is centralized, and easier
> to configure.  Doing it all in one class, means that
> at some point your going to have logic to handle
> special cases The more of these you have hte
> more complex the logic... Complex logic is directly
> related to the stability of your code.
> In addition I don't have to code the validations
> myself.  Just specify what I want validated and I'm
> done.  You could do the same thing, however you
> still have to glue it all together.
> 
> > 
> > - With this approach i can perform light business
> > validation that must be done in java code. So, for
> one
> > or more situation i could access some util classes
> > that do some validation for me.
> 
> You can do this with custom validation classes and
> still achieve centralizations.  Depending on what
> you mean by light business validation.  I like
> consistency in where things are.  Business rules in
> business layer, and validation in the view tier.  A
> newcomer to the app would have to guess (yeah, sure
> they'll ask, maybe) where the code is supposed to
> go.
> 
> > 
> > - With this approach i have very small action
> forms
> > that basically has a validate and reset methods
> that
> > just delegate to the WebValidation and WebReset
> > classes.
> 
> With the standard struts approach I have even
> smaller action clas

ActionForm data type X BeanUtils -> using Dates

2004-09-08 Thread Leandro Melo
Hi,
i believe that a lot of developers use BeanUtils to
copy the data from ActionForms to the specific DTOs.
I've used this approach, but right now i'm facing a
problem, not a big one.

I've allways been confused about working with dates in
Java. I got a jsp where the user must input a date in
the following format.

Date: dd/mm/  

That's how we use dates in Brazil: the day, month and
year.

I'd like to make a validation if the user input the
date in the correct manner in the ActionForm (i'm
using traditional validation and the user input comes
in a String). So, keeping in mind the variou ways of
doing this date validation (even the deprecated ones),
how should a do the date validation Which one is
the best way??? I just want to check if the user input
a day with 2 digits,  a slash, a month with 2 digits,
a slash and a year with 4 digits.

Also, after that i'd like to copy this form data to my
DTO with BeanUtils. Which type should i use in my DTO 
for this date??? 

Thanks,
Leandro.







___
Yahoo! Acesso Grátis - navegue de graça com conexão de qualidade! 
http://br.acesso.yahoo.com/

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



Re: ActionForm with all application attributes

2004-09-08 Thread Leandro Melo
Bill, wait a minute, i just thought on something.
I wouldn't matter if a hacker set a attributes in my
BaseActionFomr, if i don't use it to build my DTOs. I
mount my DTOs case specific, so i'd just ignore the
hacker set attribute.
But if this hacker set attribute is in my DTO, i agree
that i could get problems. But if this attribute is
present in the DTO it means that even if i was using
the traditional way this attribute would present in
the traditional ActionForm and, consequently, would be
suceptible to the same problem.
Got the point???


 --- Bill Siggelkow <[EMAIL PROTECTED]> escreveu:

> Are all of your getters and setters public? If so,
> (which I assume is 
> true), one disadavantage is that request parameters
> can be passed in 
> that set stuff on the form that you may not be
> expecting. For example, 
> suppose your uber form supports properties for 'foo'
> 'bar' and 'baz'.
> 
> Let's say one form sets the first two properties --
> from a GET you would 
> see:
>
http://localhost/myapp/SubmitFooBar.do?foo=blah&bar=glob
> 
> Now suppose some hacker comes along and does the
> following:
> 
>
http://localhost/myapp/SubmitFooBar.do?foo=blah&bar=glob&baz=evilvalue
> 
> Now, the property for baz has been set when you
> weren't expecting it to.
> 
> - Bill Siggelkow
> 
> 
> Leandro Melo wrote:
> 
> > Hi, 
> > i sent this question yesterday, but as nowbody
> > answered me, i trying it again with a more
> > sifinificant title (sorry for the re-post).
> > Also, if i'm doing something terrible, i'd like to
> > know.
> > 
> > Keeping in mind that more than one action form may
> > have to validate and/or reset the same fields, i
> > decided to this.
> >  
> > I already have a MyBaseActionForm which
> incorporates
> > all
> > some methods that i need in my application. I
> don't
> > use Validator, as i prefer to use java classes for
> > validation  ligth business logic.
> > 
> > Now, i decided to add ALL fileds (setters and
> > getters)
> > i have in my application as private members of
> this
> > MyBaseActionForm.
> > 
> > Then i created classes WebValidation and WebReset.
> > This classes have validate methods for all fields
> in
> > my application. These classes can access the
> fields
> > they need for each method because all my action
> > forms
> > extend the MyBaseActionForm, thus this
> WebValidation
> > and WebReset classes can call the setters and
> > getters
> > of an y action form to validate with the light
> > business logic i need.
> > 
> > I got with this approach a centralized way and
> > "component" responsible for the validation. All my
> > action forms delegate the validate and reset
> methods
> > to the classes i mentioned.
> > 
> > I'd like to briefly describe some nice
> > benefits of this approach.
> > 
> > - With this approach i definetly solve my earlier
> > problem that i posted on question "1:N
> relationships -
> > ActionForm x DTOs".
> > 
> > - With this approach i got no coupling between my
> > ActionForm and DTOs.
> > 
> > - With this approach i have a centralized validate
> > unit. It's very usual to have more than 1 action
> form
> > validating the same field, what may causes some
> > duplication and a harder maintenance. A central
> unit
> > of validation and resetting suits this problem
> very
> > well.
> > 
> > - With this approach i can perform light business
> > validation that must be done in java code. So, for
> one
> > or more situation i could access some util classes
> > that do some validation for me.
> > 
> > - With this approach i have very small action
> forms
> > that basically has a validate and reset methods
> that
> > just delegate to the WebValidation and WebReset
> > classes.
> > 
> > - With this approach i also have a central unit of
> > fields and their types, so if it's necessary to
> chance
> > them, i don't need to go through all the action
> forms
> > that have these fields. 
> > 
> > This approach will only work correctly if you
> don't
> > have fields with the same name in your
> application.
> > Naturally, this is not a drawback because forces
> you
> > to use a nice use of software engineering forcing
> you
> > to give significant names for the fiels.
> > 
> > Well, i'd appreciate comments (bad or nice ones)
> on

Re: ActionForm with all application attributes

2004-09-08 Thread Leandro Melo
Bill, this is for sure a disadavantage. Do you see
others
Actually, we're suceptible to this avantage in all
forms, but i agree with you that if i have a base form
with all atributes the chances of things getting
messed up is a log bigger.


 --- Bill Siggelkow <[EMAIL PROTECTED]> escreveu:

> Are all of your getters and setters public? If so,
> (which I assume is 
> true), one disadavantage is that request parameters
> can be passed in 
> that set stuff on the form that you may not be
> expecting. For example, 
> suppose your uber form supports properties for 'foo'
> 'bar' and 'baz'.
> 
> Let's say one form sets the first two properties --
> from a GET you would 
> see:
>
http://localhost/myapp/SubmitFooBar.do?foo=blah&bar=glob
> 
> Now suppose some hacker comes along and does the
> following:
> 
>
http://localhost/myapp/SubmitFooBar.do?foo=blah&bar=glob&baz=evilvalue
> 
> Now, the property for baz has been set when you
> weren't expecting it to.
> 
> - Bill Siggelkow
> 
> 
> Leandro Melo wrote:
> 
> > Hi, 
> > i sent this question yesterday, but as nowbody
> > answered me, i trying it again with a more
> > sifinificant title (sorry for the re-post).
> > Also, if i'm doing something terrible, i'd like to
> > know.
> > 
> > Keeping in mind that more than one action form may
> > have to validate and/or reset the same fields, i
> > decided to this.
> >  
> > I already have a MyBaseActionForm which
> incorporates
> > all
> > some methods that i need in my application. I
> don't
> > use Validator, as i prefer to use java classes for
> > validation  ligth business logic.
> > 
> > Now, i decided to add ALL fileds (setters and
> > getters)
> > i have in my application as private members of
> this
> > MyBaseActionForm.
> > 
> > Then i created classes WebValidation and WebReset.
> > This classes have validate methods for all fields
> in
> > my application. These classes can access the
> fields
> > they need for each method because all my action
> > forms
> > extend the MyBaseActionForm, thus this
> WebValidation
> > and WebReset classes can call the setters and
> > getters
> > of an y action form to validate with the light
> > business logic i need.
> > 
> > I got with this approach a centralized way and
> > "component" responsible for the validation. All my
> > action forms delegate the validate and reset
> methods
> > to the classes i mentioned.
> > 
> > I'd like to briefly describe some nice
> > benefits of this approach.
> > 
> > - With this approach i definetly solve my earlier
> > problem that i posted on question "1:N
> relationships -
> > ActionForm x DTOs".
> > 
> > - With this approach i got no coupling between my
> > ActionForm and DTOs.
> > 
> > - With this approach i have a centralized validate
> > unit. It's very usual to have more than 1 action
> form
> > validating the same field, what may causes some
> > duplication and a harder maintenance. A central
> unit
> > of validation and resetting suits this problem
> very
> > well.
> > 
> > - With this approach i can perform light business
> > validation that must be done in java code. So, for
> one
> > or more situation i could access some util classes
> > that do some validation for me.
> > 
> > - With this approach i have very small action
> forms
> > that basically has a validate and reset methods
> that
> > just delegate to the WebValidation and WebReset
> > classes.
> > 
> > - With this approach i also have a central unit of
> > fields and their types, so if it's necessary to
> chance
> > them, i don't need to go through all the action
> forms
> > that have these fields. 
> > 
> > This approach will only work correctly if you
> don't
> > have fields with the same name in your
> application.
> > Naturally, this is not a drawback because forces
> you
> > to use a nice use of software engineering forcing
> you
> > to give significant names for the fiels.
> > 
> > Well, i'd appreciate comments (bad or nice ones)
> on
> > that.
> > 
> > Thanks,
> > Leandro
> > 
> > 
> > 
> > 
> > 
> >
>
___
> > Yahoo! Acesso Grátis - navegue de graça com
> conexão de qualidade! 
> > http://br.acesso.yahoo.com/
> 
> 
>
-
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
>  





___
Yahoo! Acesso Grátis - navegue de graça com conexão de qualidade! 
http://br.acesso.yahoo.com/

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



ActionForm with all application attributes

2004-09-07 Thread Leandro Melo
Hi, 
i sent this question yesterday, but as nowbody
answered me, i trying it again with a more
sifinificant title (sorry for the re-post).
Also, if i'm doing something terrible, i'd like to
know.

Keeping in mind that more than one action form may
have to validate and/or reset the same fields, i
decided to this.
 
I already have a MyBaseActionForm which incorporates
all
some methods that i need in my application. I don't
use Validator, as i prefer to use java classes for
validation  ligth business logic.

Now, i decided to add ALL fileds (setters and
getters)
i have in my application as private members of this
MyBaseActionForm.

Then i created classes WebValidation and WebReset.
This classes have validate methods for all fields in
my application. These classes can access the fields
they need for each method because all my action
forms
extend the MyBaseActionForm, thus this WebValidation
and WebReset classes can call the setters and
getters
of an y action form to validate with the light
business logic i need.

I got with this approach a centralized way and
"component" responsible for the validation. All my
action forms delegate the validate and reset methods
to the classes i mentioned.

I'd like to briefly describe some nice
benefits of this approach.

- With this approach i definetly solve my earlier
problem that i posted on question "1:N relationships -
ActionForm x DTOs".

- With this approach i got no coupling between my
ActionForm and DTOs.

- With this approach i have a centralized validate
unit. It's very usual to have more than 1 action form
validating the same field, what may causes some
duplication and a harder maintenance. A central unit
of validation and resetting suits this problem very
well.

- With this approach i can perform light business
validation that must be done in java code. So, for one
or more situation i could access some util classes
that do some validation for me.

- With this approach i have very small action forms
that basically has a validate and reset methods that
just delegate to the WebValidation and WebReset
classes.

- With this approach i also have a central unit of
fields and their types, so if it's necessary to chance
them, i don't need to go through all the action forms
that have these fields. 

This approach will only work correctly if you don't
have fields with the same name in your application.
Naturally, this is not a drawback because forces you
to use a nice use of software engineering forcing you
to give significant names for the fiels.

Well, i'd appreciate comments (bad or nice ones) on
that.

Thanks,
Leandro





___
Yahoo! Acesso Grátis - navegue de graça com conexão de qualidade! 
http://br.acesso.yahoo.com/

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



Re: Is this some kind of pattern? is this good at all? (MORE INFO)

2004-09-06 Thread Leandro Melo
I just would like to briefly describe some nice
features of this approach.

- With this approach i definetly solve my earlier
problem that i posted on question "1:N relationships -
ActionForm x DTOs".

- With this approach i got no coupling between my
ActionForm and DTOs.

- With this approach i have a centralized validate
unit. It's very usual to have more than 1 action form
validating the same field, what may causes some
duplication and a harder maintenance. A central unit
of validation and resetting suits this problem very
well.

- With this approach i can perform light business
validation that must be done in java code. So, for one
or more situation i could access some util classes
that do some validation for me.

- With this approach i have very small action forms
that basically has a validate and reset methods that
just delegate to the WebValidation and WebReset
classes.

- With this approach i also have a central unit of
fields and their types, so if it's necessary to chance
them, i don't need to go through all the action forms
that have these fields. 

This approach will only work correctly if you don't
have fields with the same name in your application.
Naturally, this is not a drawback because forces you
to use a nice use of software engineering forcing you
to give significant names for the fiels.

Well, i'd appreciate comments (bad or nice ones) on
that.

Leandro.






 --- Leandro Melo <[EMAIL PROTECTED]>
escreveu: 
> Hi,
> keeping in mind that more than one action form may
> have to validate and/or reset the same fields, i
> decided to this.
> 
> I already have a MyBaseActionForm which incorporates
> all
> some methods that i need in my application. I don't
> use Validator, as i prefer to use java classes for
> validation  ligth business logic.
> 
> Now, i decided to add ALL fileds (setters and
> getters)
> i have in my application as private members of this
> MyBaseActionForm.
> 
> Then i created classes WebValidation and WebReset.
> This classes have validate methods for all fields in
> my application. These classes can access the fields
> they need for each method because all my action
> forms
> extend the MyBaseActionForm, thus this WebValidation
> and WebReset classes can call the setters and
> getters
> of an y action form to validate with the light
> business logic i need.
> 
> I got with this approach a centralized way and
> "component" responsible for the validation. All my
> action forms delegate the validate and reset methods
> to the classes i mentioned.
> 
> Is this some kind of pattern?? Is this good at
> all???
> 
> Leandro
> 
> 
>   
>   
>   
>
___
> Yahoo! Acesso Grátis - navegue de graça com conexão
> de qualidade! 
> http://br.acesso.yahoo.com/
> 
>
-
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
>  





___
Yahoo! Acesso Grátis - navegue de graça com conexão de qualidade! 
http://br.acesso.yahoo.com/

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



Is this some kind of pattern? is this good at all?

2004-09-06 Thread Leandro Melo
Hi,
keeping in mind that more than one action form may
have to validate and/or reset the same fields, i
decided to this.

I already have a MyBaseActionForm which incorporates
all
some methods that i need in my application. I don't
use Validator, as i prefer to use java classes for
validation  ligth business logic.

Now, i decided to add ALL fileds (setters and getters)
i have in my application as private members of this
MyBaseActionForm.

Then i created classes WebValidation and WebReset.
This classes have validate methods for all fields in
my application. These classes can access the fields
they need for each method because all my action forms
extend the MyBaseActionForm, thus this WebValidation
and WebReset classes can call the setters and getters
of an y action form to validate with the light
business logic i need.

I got with this approach a centralized way and
"component" responsible for the validation. All my
action forms delegate the validate and reset methods
to the classes i mentioned.

Is this some kind of pattern?? Is this good at all???

Leandro





___
Yahoo! Acesso Grátis - navegue de graça com conexão de qualidade! 
http://br.acesso.yahoo.com/

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



1:N relationship - ActionForms x DTOs

2004-09-06 Thread Leandro Melo
hi,
unfortunatelly i got my action forms coupled with my
DTOs . This is a very common disucussion in which i
don't want to go to the merits of it right now.

I just need a solution for a specific problem, but if
this solutions requires going back to the first point,
it's ok.

I'm used to have jsps that are "coupled" with my dtos,
so for a page in which the user regiter data about the
company, there's a CompanyDTO object that will
transfer the data from the Action to the persistent
layer.
Also i have an analogue ProjectDTO which transfer data
from Action to persisten layer.

The page used to register a company has a form bean
with fields that matches the CompanyDTO data type.
The page used to register project data has a form bean
with fields that matches the ProjectDTO.

Now, i have a new page for user to input data about
the company and it's projects. A better approach would
be building a "new" form bean and a new ActionForm
with both the company fields and the project fields.
Naturally this "new" form bean and ActionForm would
like just the same as the CompanyActionForm +
ProjectActionForm, so i thought if there's a way i can
reuse my ProjectActionForm and my CompanyActionForm to
build a CompanyProjectActionForm without having to go
with all the fields one by one for this action Form.
Is there a way to do that???
So i would have an CompanyProjectActionForm "composed"
by two other ActionForms, instead of having to write a
whole new CompanyProjectActionForm.

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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



Re: How long is Action's scope?

2004-09-01 Thread Leandro Melo
I could save the reference to stateful session ejb and
 jsessionid in a map in HttpSession.
This way, things wouldn't get counfusing, am i right?


 --- Brett Connor <[EMAIL PROTECTED]> escreveu: 
> Leandro Melo wrote:
> 
> >Hi,
> >for how long will an Action be in memory?
> >Here's the point.
> >
> >I have a situation where the user register his/her
> >company in my application. He/she uses a wizard of
> 4
> >jsp pages, as he/she submits one, he/she is
> redirected
> >to the other one. In this situation i keep a
> reference
> >of my Stateful session ejb in HttpSession so the 4
> >Actions can reference them to complete the wizard.
> >This is pretty much fine to me.
> >
> >BUT..., now i'm facing a new question. I have a
> >similar situation where the user can submit the
> page
> >more than one time, and it is always the SAME
> aciton
> >the will handle this request. It's a search page,
> so
> >the user can search once, search again, search even
> >more, and it always the same action the will handel
> >this (behind the scenes a i got a business POJO
> that
> >implements the ValueListHandler pattern). For this
> >case i also have a Statefull session ejb that
> >maintains a reference to my business POJO (the one
> >that implements the valueListHandler). Obviously,
> this
> >Statefull sesison ejb is accessed by this one
> Action
> >that i've been talking about.
> >My question is:
> >In the first situation i mentioned, i had to save a
> >reference to my Stateful session ejb in HttpSession
> >because 4 action would need that reference. But
> what
> >should i do for the last situation?? Only one
> Action
> >will handle the user requests, so can i ASSUME that
> >this Action will still be in memory for next
> requests
> >and consequently this Action will still have a
> >reference to my my Statefull Session ejb
> (naturally,
> >this reference would be a member of the action).??
> >For how long???
> >  
> >
> 
> Don't forget that the action is not specific to one
> user / session / 
> connection. Think about the case of 2, or 100 users
> all doing a search. 
> If this is a statefull session ejb you're using I
> doubt holding a 
> reference in the action is really what you want to
> do, unless I've 
> misunderstood your situation here.
> 
> Brett Connor
> 
>
-
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
>  





___
Yahoo! Acesso Grátis - navegue de graça com conexão de qualidade! 
http://br.acesso.yahoo.com/

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



struts exception handler

2004-09-01 Thread Leandro Melo
I got this from struts page.
"Don't throw it, catch it! - Ever used a commercial
website only to have a stack trace or exception thrown
in your face after you've already typed in your credit
card number and clicked the purchase button? Let's
just say it doesn't inspire confidence. Now is your
chance to deal with these application errors - in the
Action class. If your application specific code throws
expections you should catch these exceptions in your
Action class, log them in your application's log
(servlet.log("Error message", exception)) and return
the appropriate ActionForward.".

But what about struts mecahnism of handling
exceptions? I`m really used to throw exceptions from
my actions and let the configurabled exception handler
(i actually use the default one) take care of the rest.





___
Yahoo! Acesso Grátis - navegue de graça com conexão de qualidade! 
http://br.acesso.yahoo.com/

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



How long is Action's scope?

2004-08-31 Thread Leandro Melo
Hi,
for how long will an Action be in memory?
Here's the point.

I have a situation where the user register his/her
company in my application. He/she uses a wizard of 4
jsp pages, as he/she submits one, he/she is redirected
to the other one. In this situation i keep a reference
of my Stateful session ejb in HttpSession so the 4
Actions can reference them to complete the wizard.
This is pretty much fine to me.

BUT..., now i'm facing a new question. I have a
similar situation where the user can submit the page
more than one time, and it is always the SAME aciton
the will handle this request. It's a search page, so
the user can search once, search again, search even
more, and it always the same action the will handel
this (behind the scenes a i got a business POJO that
implements the ValueListHandler pattern). For this
case i also have a Statefull session ejb that
maintains a reference to my business POJO (the one
that implements the valueListHandler). Obviously, this
Statefull sesison ejb is accessed by this one Action
that i've been talking about.
My question is:
In the first situation i mentioned, i had to save a
reference to my Stateful session ejb in HttpSession
because 4 action would need that reference. But what
should i do for the last situation?? Only one Action
will handle the user requests, so can i ASSUME that
this Action will still be in memory for next requests
and consequently this Action will still have a
reference to my my Statefull Session ejb (naturally,
this reference would be a member of the action).??
For how long???


Thanks,
Leandro 





__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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



Re: LookupDispatchAction (Newbie)

2004-08-27 Thread Leandro Melo
Michael, i`d preffer to do it the way i described.
Having all "submit" buttons with the it`s name beeing
"method" por exemplo, and then checking if the return
of getName() is null. If it is -> 
String methodName request.getParameter("method") 

dipatchMethod(..., methodName); 



 --- Michael McGrady <[EMAIL PROTECTED]>
escreveu: 
> I just assumed on the wiki that people would extend
> to submit as follows:
> 
> 
> 
>   
>  value='add'>
>  value='delete'>
> 
> 
> 
> I will amend the wiki to reflect that possibility. 
> This just mimics the 
> functionality of the  tag.
> 
> Michael
> 
> Paul McCulloch wrote:
> 
> >I'm confused. Looking at the wiki (ImageTagUtil
> class) it seems that a non
> >null command will only be returned if there is a
> request parameter with name
> >ending in ".x". My understanding of html is that
> only  >.../> tags send the x & y coordinates to the server
> in submission.
> >
> >What am I missing? 
> >
> >Thanks,
> >
> >Paul
> >
> >
> >  
> >
> >>-Original Message-
> >>From: Michael McGrady
> [mailto:[EMAIL PROTECTED]
> >>Sent: Friday, August 27, 2004 2:54 PM
> >>To: Struts Users Mailing List
> >>Subject: Re: LookupDispatchAction (Newbie)
> >>
> >>
> >>Paul McCulloch wrote:
> >>
> >>
> >>
> >>>Am I right in thinking that your solution works
> for image 
> >>>  
> >>>
> >>buttons, whereas
> >>
> >>
> >>>the LookupDispatchAction is for text labeled
> buttons?
> >>>
> >>>Paul
> >>>
> >>>  
> >>>
> >>No, my solution works for both, Paul.  The code
> mined is decoupled 
> >>entirely from the display. 
> >>
> >>Michael
> >>
> >>
>
>>-
> >>To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> >>For additional commands, e-mail:
> [EMAIL PROTECTED]
> >>
> >>
> >>
> >
> >
>
>**
> >Axios Email Confidentiality Footer
> >Privileged/Confidential Information may be
> contained in this message. If you are not the
> addressee indicated in this message (or responsible
> for delivery of the message to such person), you may
> not copy or deliver this message to anyone. In such
> case, you should destroy this message, and notify us
> immediately. If you or your employer does not
> consent to Internet email messages of this kind,
> please advise us immediately. Opinions, conclusions
> and other information expressed in this message are
> not given or endorsed by my Company or employer
> unless otherwise indicated by an authorised
> representative independent of this message.
> >WARNING:
> >While Axios Systems Ltd takes steps to prevent
> computer viruses from being transmitted via
> electronic mail attachments we cannot guarantee that
> attachments do not contain computer virus code.  You
> are therefore strongly advised to undertake anti
> virus checks prior to accessing the attachment to
> this electronic mail.  Axios Systems Ltd grants no
> warranties regarding performance use or quality of
> any attachment and undertakes no liability for loss
> or damage howsoever caused.
>
>**
> >
> >
>
>-
> >To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> >For additional commands, e-mail:
> [EMAIL PROTECTED]
> >
> >
> >
> >
> >  
> >
> 
> 
> 
>
-
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
>  

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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



RE: LookupDispatchAction (Newbie)

2004-08-27 Thread Leandro Melo
I gues the point of the ImageTagUtil class is
specially for use with "submit" image buttons.
However you can do build your wokraround for use in
any cases. In my case for example, here`s what i do.

In my application, i decided to make of my submissions
that go for Actions must have the parameter
"method=nameOfMethodToBeCalled" in the cases the
submissions don`t came from image buttons.

Then i if the ImateTagUtil class returns null for the
name of the button, i get the parameter "method" and
dispatches to the specific method.





 --- Paul McCulloch <[EMAIL PROTECTED]>
escreveu: 
> I'm confused. Looking at the wiki (ImageTagUtil
> class) it seems that a non
> null command will only be returned if there is a
> request parameter with name
> ending in ".x". My understanding of html is that
> only  .../> tags send the x & y coordinates to the server
> in submission.
> 
> What am I missing? 
> 
> Thanks,
> 
> Paul
> 
> 
> > -Original Message-
> > From: Michael McGrady
> [mailto:[EMAIL PROTECTED]
> > Sent: Friday, August 27, 2004 2:54 PM
> > To: Struts Users Mailing List
> > Subject: Re: LookupDispatchAction (Newbie)
> > 
> > 
> > Paul McCulloch wrote:
> > 
> > >Am I right in thinking that your solution works
> for image 
> > buttons, whereas
> > >the LookupDispatchAction is for text labeled
> buttons?
> > >
> > >Paul
> > >
> > 
> > No, my solution works for both, Paul.  The code
> mined is decoupled 
> > entirely from the display. 
> > 
> > Michael
> > 
> > 
> >
>
-
> > To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> > For additional commands, e-mail:
> [EMAIL PROTECTED]
> > 
> 
> 
>
**
> Axios Email Confidentiality Footer
> Privileged/Confidential Information may be contained
> in this message. If you are not the addressee
> indicated in this message (or responsible for
> delivery of the message to such person), you may not
> copy or deliver this message to anyone. In such
> case, you should destroy this message, and notify us
> immediately. If you or your employer does not
> consent to Internet email messages of this kind,
> please advise us immediately. Opinions, conclusions
> and other information expressed in this message are
> not given or endorsed by my Company or employer
> unless otherwise indicated by an authorised
> representative independent of this message.
> WARNING:
> While Axios Systems Ltd takes steps to prevent
> computer viruses from being transmitted via
> electronic mail attachments we cannot guarantee that
> attachments do not contain computer virus code.  You
> are therefore strongly advised to undertake anti
> virus checks prior to accessing the attachment to
> this electronic mail.  Axios Systems Ltd grants no
> warranties regarding performance use or quality of
> any attachment and undertakes no liability for loss
> or damage howsoever caused.
>
**
> 
> 
>
-
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
>  

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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



Re: Help with Cactus StrutsTestCase

2004-08-27 Thread Leandro Melo
Thanks Duncan, i`ll check it out!


 --- Duncan Mills <[EMAIL PROTECTED]> escreveu: 
> Leandro - a good article has just been published on
> the Oracle 
> Technology Network on using JUnit, Cactus and
> StrutsTestCase - the setup 
> portions relate to setting up these up with
> JDeveloper, but the basic 
> flow and tutorial portions provide a good kickstart
> even if you use 
> another IDE - check it out:
>
http://www.oracle.com/technology/pub/articles/server_side_unit_tests.html
> 
> Regards
> 
> Duncan Mills
> http://www.groundside.com/blog
> 
> 
> 
> Leandro Melo wrote:
> 
> >Doesn`t know the answer, where can i find a good
> >tutorial do test struts applications?
> >Is it true that for good testing the actions must
> >delegate their work to POJOs ??
> >
> >
> >
> > --- [EMAIL PROTECTED] escreveu: 
> >  
> >
> >>I am trying to write test cases for my Struts app,
> >>but can't seem to figure it out.
> >>I have used the examples, but I don't seem to get
> >>the correct outcome when I run them.
> >>
> >>I am using LookupDispatchAction's exclusively. 
> >>
> >>So here is the method I am testing:
> >>==
> >>public void productSelectionAction(
> >>ActionMapping mapping
> >>,
> ActionForm
> >>form
> >>,
> >>HttpServletRequest request
> >>,
> >>HttpServletResponse response ) {
> >>log.info( "Process
> CreditApplicationActions
> >>productSelectionAction(...)" );
> >>
> >>NavigationBean navigationBean = (
> >>NavigationBean )request.getSession().getAttribute(
> >>"navigationBean" );
> >>if( navigationBean == null ) {
> >>navigationBean = new NavigationBean();
> >>}
> >>
> >>if( Constants.TRUE.equals(
> >>request.getParameter( Constants.BUS_LINE_SELECTED
> )
> >>) ) {
> >>navigationBean.setHasBusinessLine(
> true
> >>);
> >>} else {
> >>request.getSession().setAttribute(
> >>"businessLineForm", null );
> >>navigationBean.setHasBusinessLine(
> false
> >>);
> >>}
> >>
> >>if( Constants.TRUE.equals(
> >>request.getParameter( Constants.BUS_CARD_SELECTED
> )
> >>) ) {
> >>navigationBean.setHasBusinessCard(
> true
> >>);
> >>} else {
> >>request.getSession().setAttribute(
> >>"businessCardForm", null );
> >>navigationBean.setHasBusinessCard(
> false
> >>);
> >>}
> >>
> >>if( Constants.TRUE.equals(
> >>request.getParameter(
> >>Constants.BUS_SEC_CARD_SELECTED ) ) ) {
> >>navigationBean.setHasSecuredCard( true
> >>);
> >>} else {
> >>request.getSession().setAttribute(
> >>"securedCardForm", null );
> >>navigationBean.setHasSecuredCard(
> false
> >>);
> >>}
> >>
> >>if( Constants.TRUE.equals(
> >>request.getParameter(
> >>Constants.EQUIP_EXPRESS_SELECTED ) ) ) {
> >>navigationBean.setHasEquipExpress(
> true
> >>);
> >>} else {
> >>request.getSession().setAttribute(
> >>"equipExpressForm", null );
> >>navigationBean.setHasEquipExpress(
> false
> >>);
> >>}
> >>
> >>request.getSession().setAttribute(
> >>"navigationBean", navigationBean );
> >>};
> >>
> >>
> >>
> >>
> >>Here is the action in the struts-config.xml:
> >>===
> >>
> >> >>input=".productSelection"
> >>name="productSelectionForm"
> >>parameter="action"
> >>scope="session"   
> >>   
> >>
> >>
> >>
>
>type="com.wf.bd.ice.creditapplication.CreditApplicationActions"
> >  
> >
> >>validate="true">
> >>   

Re: LookupDispatchAction (Newbie)

2004-08-27 Thread Leandro Melo
A quick look at the DispatchAction source (if you
don`t have the source, you can download it) would the
best way for you to understand. It`s not that
complicated.

I never took a detailed look at the source, but
basically, it gets the mapping for the method
specified in struts-config.xml and then get the value
of this parameter. After that it dispatches the
request to the specifc method a calling to
dispatchMethod() method.



 --- "Varley, Roger" <[EMAIL PROTECTED]>
escreveu: 
> Hi
> 
> I have implemented a LookupDispatchAction action
> class to deal with a form that contains multiple
> submit buttons as outlined in the sample chapter
> from "The Struts Survival Guide" at
> http://www.objectsource.com/Chapter4.pdf I've got
> everything working but I would be grateful if
> someone could either explain or point me to
> documentation explaining, *why* it works? 
> 
> Regards
> Roger
> 
> 
>
__
> This e-mail and the documents attached are
> confidential and intended 
> solely for the addressee; it may also be privileged.
> If you receive this 
> e-mail in error, please notify the sender
> immediately and destroy it.
> As its integrity cannot be secured on the Internet,
> the Atos Origin group 
> liability cannot be triggered for the message
> content. Although the 
> sender endeavours to maintain a computer virus-free
> network, the sender 
> does not warrant that this transmission is
> virus-free and will not be 
> liable for any damages resulting from any virus
> transmitted.
>
__
> 
>
-
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
>  





___
Yahoo! Acesso Grátis - navegue de graça com conexão de qualidade! 
http://br.acesso.yahoo.com/

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



RE: Question about authentication

2004-08-26 Thread Leandro Melo
If you write a servlet filter that checks for any
request if the user is authenticated and then set some
httpsession data, you can easily handle this
redirection thing of tomcat. That's how i do it.



 --- Joe Hertz <[EMAIL PROTECTED]> escreveu: 
> My gripe with container managed authentication for
> Tomcat was the inability
> to have a login page I could show the user myself
> (it redirected the user to
> one, but showing one yourself wasn't possible). I
> would have used it myself
> if it did what I wanted. :-/
> 
> Your point is bigger than Container Mangled Security
> though. I mean, why
> would people write in VB 6? It's not portable
> between OS'. Not everyone
> cares about that to the same degree.
> 
> Everyone has code that they would have to rewrite
> something if an underlying
> assumption fails. For some people the assumption is
> their choice of servlet
> container being used.
> 
> > -Original Message-
> > From: struts Dude [mailto:[EMAIL PROTECTED]
> > Sent: Thursday, August 26, 2004 11:16 PM
> > To: Struts Users Mailing List
> > Subject: Re: Question about authentication
> >
> >
> > Thanks Joe. Geee I wander why someone would
> > advocate for container managed security since
> > it's not portable between servers.
> >
> > :D
> >
> >
> > - Original Message -
> > From: "Joe Hertz" <[EMAIL PROTECTED]>
> > To: "'Struts Users Mailing List'"
> <[EMAIL PROTECTED]>
> > Sent: Friday, August 27, 2004 3:02 PM
> > Subject: RE: Question about authentication
> >
> >
> > > Take a look at http://www.securityfilter.org
> > >
> > > > Can u show me some links of tutorial on how to
> authenticate
> > > > users using
> > > > servlet filter??
> > > >
> > > > I think servlet filter may be the most
> portable way for
> > > > authenticating user
> > > > since declarative authentication on web.xml is
> dependent
> > on Tomcat.
> > >
> > >
> > >
> > >
> >
>
-
> > > 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]
> 
>  





___
Yahoo! Acesso Grátis - navegue de graça com conexão de qualidade! 
http://br.acesso.yahoo.com/

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



Re: Struts login with JAAS (Part 2)

2004-08-26 Thread Leandro Melo
You don't need to learn, it's an option.
If you need a secure system though you may want to use
some kind of authentication and authorization service.
You can learn just a little of JAAS which is enough to
use container managed security, or you can write your
own security mechanism (using or not jaas).


 --- struts Dude <[EMAIL PROTECTED]> escreveu: 
> Is it really necessary to learn JAAS in order to
> authenticate users
> in complex J2EE systems??
> 
> More API to learn, more complication and headache.
> I would try to get away with it if I can.
> 
> Regards
> 
> - Original Message - 
> From: "Leandro Melo" <[EMAIL PROTECTED]>
> To: "struts jakarta" <[EMAIL PROTECTED]>
> Sent: Friday, August 20, 2004 4:40 PM
> Subject: Struts login with JAAS (Part 2)
> 
> 
> > I'm back!
> > After getting some jaas studies, i'm a little bit
> > better, so i can now formulate a better question.
> >
> > Here it is... (I know that this is not only a
> Struts
> > question, because it envolves jaas, but i'm pretty
> > sure that people over here could give me some
> advise
> > on how to handle the problem).
> >
> >
> > I got my application protected with JAAS, so users
> > cannot access any pages or servles withou a login.
> I
> > build then an Action to handle login stuff.
> >
> > Heres the code of my LoginAction (execute method).
> >
> > //...
> > String j_username =
> > (String)request.getParameter("j_username");
> > String x =
> (String)request.getParameter("j_password");
> >
> > if (x != null){
> > j_password = x.toCharArray();
> > handler = new UsernamePasswordHandler(j_username,
> > j_password);
> > }
> >
> > LoginContext lc = null;
> >
> > try {
> > lc = new LoginContext("example2",
> handler);
> > lc.login();
> >
> >
> > //this part doesn't matter very much
> > Subject subject = lc.getSubject();
> > Set principals = subject.getPrincipals();
> > Principal user = new SimplePrincipal(j_username);
> > principals.add(user);
> >
> > } catch (LoginException e) {
> > // TODO Auto-generated catch block
> > e.printStackTrace();
> > throw new Exception();
> > }
> >
> > return mapping.findForward("index");
> >
> >
> >
> > The above code runs perfectly! It logs the user
> > correctly and then i'm forwared to my index page.
> > [b]But[/b], when i get to index, everything is
> gone!!!
> > I'm not logged anymore. If i try to access another
> > page in my application, i'm redirect to the
> login.jsp
> > page again!!!
> >
> > I heard that this is because the multi-thread
> > characteristic of the servlets, but
> >
> > How can i workaround this??? how can i make this
> > maintain my login through the rest of my
> session???
> >
> >
> > Here's a piece of login-config.xml
> >
> > 
> >
> >> "org.jboss.security.ClientLoginModule"
> >  flag = "required">
> >   
> >
> > 
> >
> >
> >
> > 
> > 
> >  >
>
code="org.jboss.security.auth.spi.DatabaseServerLoginModule"
> > flag="required">
> > 
> >  > name="dsJndiName">java:/DefaultDS
> > Select
> > Password from Principals where PrincipalID
> > =?
> > Select Role
> > 'Roles', RoleGroup 'RoleGroups' from Roles where
> > PrincipalID =?
> > 
> > 
> > 
> >
> >
> > Thanks and regards,
> > Leandro
> >
> >
> >
> >
> >
> >
>
___
> > Yahoo! Acesso Grátis - navegue de graça com
> conexão de qualidade!
> > http://br.acesso.yahoo.com/
> >
> >
>
-
> > To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> > For additional commands, e-mail:
> [EMAIL PROTECTED]
> >
> 
> 
>
-
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
>  





___
Yahoo! Acesso Grátis - navegue de graça com conexão de qualidade! 
http://br.acesso.yahoo.com/

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



Re: Help with Cactus StrutsTestCase

2004-08-26 Thread Leandro Melo
Sorry for the confusing sentence. 
I meant to say that i don`t know the answer, but i`d
like to use the opportunity and also ask a basic
question.

Where can i find a good
tutorial do test struts applications?
Is it true that for good testing the actions must
delegate their work to POJOs ??



 --- Leandro Melo <[EMAIL PROTECTED]>
escreveu: 
> Doesn`t know the answer, where can i find a good
> tutorial do test struts applications?
> Is it true that for good testing the actions must
> delegate their work to POJOs ??
> 
> 
> 
>  --- [EMAIL PROTECTED] escreveu: 
> > I am trying to write test cases for my Struts app,
> > but can't seem to figure it out.
> > I have used the examples, but I don't seem to get
> > the correct outcome when I run them.
> > 
> > I am using LookupDispatchAction's exclusively. 
> > 
> > So here is the method I am testing:
> > ==
> > public void productSelectionAction(
> > ActionMapping mapping
> > ,
> ActionForm
> > form
> > ,
> > HttpServletRequest request
> > ,
> > HttpServletResponse response ) {
> > log.info( "Process
> CreditApplicationActions
> > productSelectionAction(...)" );
> > 
> > NavigationBean navigationBean = (
> > NavigationBean )request.getSession().getAttribute(
> > "navigationBean" );
> > if( navigationBean == null ) {
> > navigationBean = new NavigationBean();
> > }
> > 
> > if( Constants.TRUE.equals(
> > request.getParameter( Constants.BUS_LINE_SELECTED
> )
> > ) ) {
> > navigationBean.setHasBusinessLine(
> true
> > );
> > } else {
> > request.getSession().setAttribute(
> > "businessLineForm", null );
> > navigationBean.setHasBusinessLine(
> false
> > );
> > }
> > 
> > if( Constants.TRUE.equals(
> > request.getParameter( Constants.BUS_CARD_SELECTED
> )
> > ) ) {
> > navigationBean.setHasBusinessCard(
> true
> > );
> > } else {
> > request.getSession().setAttribute(
> > "businessCardForm", null );
> > navigationBean.setHasBusinessCard(
> false
> > );
> > }
> > 
> > if( Constants.TRUE.equals(
> > request.getParameter(
> > Constants.BUS_SEC_CARD_SELECTED ) ) ) {
> > navigationBean.setHasSecuredCard( true
> > );
> > } else {
> > request.getSession().setAttribute(
> > "securedCardForm", null );
> > navigationBean.setHasSecuredCard(
> false
> > );
> > }
> > 
> > if( Constants.TRUE.equals(
> > request.getParameter(
> > Constants.EQUIP_EXPRESS_SELECTED ) ) ) {
> > navigationBean.setHasEquipExpress(
> true
> > );
> > } else {
> > request.getSession().setAttribute(
> > "equipExpressForm", null );
> > navigationBean.setHasEquipExpress(
> false
> > );
> > }
> > 
> > request.getSession().setAttribute(
> > "navigationBean", navigationBean );
> > };
> > 
> > 
> > 
> > 
> > Here is the action in the struts-config.xml:
> > ===
> > 
> >  > input=".productSelection"
> > name="productSelectionForm"
> > parameter="action"
> > scope="session"   
> >
> >
>
type="com.wf.bd.ice.creditapplication.CreditApplicationActions"
> > 
> > validate="true">
> >  > path=".productSelection" redirect="true" />
> >  > path=".business" redirect="true" />
> >  > path=".productSelection" redirect="true" />
> >  > path=".business" redirect="true" />
> >  > path=".firstOwner" redirect="true" />
> >  > path=".secondOwner" redirect="true" />
> >  > path=".businessLine" redirect="true" />
> >  > path=".businessCard" 

Re: Help with Cactus StrutsTestCase

2004-08-26 Thread Leandro Melo
Doesn`t know the answer, where can i find a good
tutorial do test struts applications?
Is it true that for good testing the actions must
delegate their work to POJOs ??



 --- [EMAIL PROTECTED] escreveu: 
> I am trying to write test cases for my Struts app,
> but can't seem to figure it out.
> I have used the examples, but I don't seem to get
> the correct outcome when I run them.
> 
> I am using LookupDispatchAction's exclusively. 
> 
> So here is the method I am testing:
> ==
> public void productSelectionAction(
> ActionMapping mapping
> , ActionForm
> form
> ,
> HttpServletRequest request
> ,
> HttpServletResponse response ) {
> log.info( "Process CreditApplicationActions
> productSelectionAction(...)" );
> 
> NavigationBean navigationBean = (
> NavigationBean )request.getSession().getAttribute(
> "navigationBean" );
> if( navigationBean == null ) {
> navigationBean = new NavigationBean();
> }
> 
> if( Constants.TRUE.equals(
> request.getParameter( Constants.BUS_LINE_SELECTED )
> ) ) {
> navigationBean.setHasBusinessLine( true
> );
> } else {
> request.getSession().setAttribute(
> "businessLineForm", null );
> navigationBean.setHasBusinessLine( false
> );
> }
> 
> if( Constants.TRUE.equals(
> request.getParameter( Constants.BUS_CARD_SELECTED )
> ) ) {
> navigationBean.setHasBusinessCard( true
> );
> } else {
> request.getSession().setAttribute(
> "businessCardForm", null );
> navigationBean.setHasBusinessCard( false
> );
> }
> 
> if( Constants.TRUE.equals(
> request.getParameter(
> Constants.BUS_SEC_CARD_SELECTED ) ) ) {
> navigationBean.setHasSecuredCard( true
> );
> } else {
> request.getSession().setAttribute(
> "securedCardForm", null );
> navigationBean.setHasSecuredCard( false
> );
> }
> 
> if( Constants.TRUE.equals(
> request.getParameter(
> Constants.EQUIP_EXPRESS_SELECTED ) ) ) {
> navigationBean.setHasEquipExpress( true
> );
> } else {
> request.getSession().setAttribute(
> "equipExpressForm", null );
> navigationBean.setHasEquipExpress( false
> );
> }
> 
> request.getSession().setAttribute(
> "navigationBean", navigationBean );
> };
> 
> 
> 
> 
> Here is the action in the struts-config.xml:
> ===
> 
>  input=".productSelection"
> name="productSelectionForm"
> parameter="action"
> scope="session"   
>
>
type="com.wf.bd.ice.creditapplication.CreditApplicationActions"
> 
> validate="true">
>  path=".productSelection" redirect="true" />
>  path=".business" redirect="true" />
>  path=".productSelection" redirect="true" />
>  path=".business" redirect="true" />
>  path=".firstOwner" redirect="true" />
>  path=".secondOwner" redirect="true" />
>  path=".businessLine" redirect="true" />
>  path=".businessCard" redirect="true" />
>  path=".securedCard" redirect="true" />
>  path=".equipExpress" redirect="true" />
>  path=".noSecondOwner" redirect="true" />
>  path=".noBusinessLine" redirect="true" />
>  path=".noBusinessCard" redirect="true" />
>  path=".noSecuredCard" redirect="true" />
>  path=".noEquipExpress" redirect="true" />
>  path=".acceptanceAgreement" redirect="true" />
> 
> 
> 
> 
> 
> 
> Here is the test method:
> ==
>   public void testProductSelection() throws
> Exception {
> // JUnitDoclet begin method productSelection
> 
> setRequestPathInfo( "/productSelection" );
> 
> addRequestParameter( "action", "nextPage" );
> 
> addRequestParameter( "businessLineSelected",
> "true" );
> addRequestParameter( "businessCardSelected",
> "true" );
> addRequestParameter(
> "businessSecuredCardSelected", "true" );
> addRequestParameter(
> "equipmentExpressSelected", "true" );
> 
> actionPerform();
> 
> verifyForward( Constants.ERROR_FWD );
> verifyForward(
> Constants.PRODUCTSELECTION_FWD );
> 
> //verifyActionErrors(new String[]
> {"error.nodefault.implementation" } );
> //verifyActionErrors(new String[] {
> "error.noaction.specified"} );
> 
> //NavigationBean navigationBean =
> (NavigationBean)getSession().getAttribute(
> "navigationBean" );
> //assertTrue( "NavigationBean is null",
> navigationBean == null);
> verifyNoActionErrors();
> 
> // JUnitDoclet end method productSelection
>

Re: ActionForm and Transfer Object

2004-08-25 Thread Leandro Melo
Sure Rick, and "where should me do it" might be a good
discussion (like the one that we`re all going on right
now).

A few months ago i had a similar discussion in a
forum.
Is someone is interested to hear more opinions, here
it is
http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=58&t=002880



 --- Rick Reumann <[EMAIL PROTECTED]> escreveu: 
> Leandro Melo wrote:
> > Rick, 
> > i agree with you, i also use BeanUtils to populate
> my
> > forms.
> > But, this doesn't go far way from having your
> > ActionForms dependent on your TOs (or CustomTOs,
> > doesn' t matter).
> 
> Well I wouldn't say they are 'dependent' on each
> other except that it 
> makes it easier if the property names match. Think
> about it, at some 
> point you are always going to have some sort of
> binding match up going 
> on. Something somewhere along the line has to bind a
> request parameter 
> name (which is just a key in a Map) to the real
> business object 
> property. You can devise different ways to do this
> and look at how other 
> frameworks handle it, but somewhere this has to be
> done.
> 
> -- 
> Rick
> 
>
-
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
>  





___
Yahoo! Acesso Grátis - navegue de graça com conexão de qualidade! 
http://br.acesso.yahoo.com/

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



Re: ActionForm and Transfer Object

2004-08-25 Thread Leandro Melo
Rick, 
i agree with you, i also use BeanUtils to populate my
forms.
But, this doesn't go far way from having your
ActionForms dependent on your TOs (or CustomTOs,
doesn' t matter).
As Sebastian said, i've heard a lot that TOs should
mirror or shouldn't be coupled to your ActionForms,
but i really don't how it's possible to build a very
modular architecture without this coupling.




 --- Rick Reumann <[EMAIL PROTECTED]> escreveu: 
> Sebastian Ho wrote:
> 
> > 
> > Say I retrieve a TO from database and convert it
> into a actionForm for
> > display. In this case I have 4 fields for my
> actionForm but 10 in my TO.
> > (6 are not needed for display). A user updates the
> 4 fields and the
> > action convert those into TO. In this case, the
> other 6 fields will be
> > reset to null(or empty) in my database!
> > 
> > To prevent this, I actually need to use hidden
> fields in my JSP or some
> > other ugly solutions in my Action class. They are
> still dependent on
> > each others afterall.
> 
> You can handle this several ways...
> 
> For example, one solution is you create a
> TransferObject that refers to 
> only the fields you care about - in this case the 4
> fields you 
> mentioned. So your call to the business layer would
> return that 
> TransferObject and you could then convert that
> easily to your form 
> (using BeanUtils). Then going back the other way
> your business layer 
> would take as an arguemnt the same type of
> TransferObject.
> 
> I actually don't prefer the above, though, because
> say later on you 
> decide you want to add another field to your form
> now your backend has 
> to worry about handling a new object with different
> fields.
> 
> I think the best solution is to simply make another
> call to get back the 
> initial TO from the db, then simply use BeanUtils to
> populate that TO 
> with the form fields. It will only set the fields in
> which it has the 
> same names for so your other data will be fine.
> 
> So it looks like...
> 
> TransferObject to =
> BackendEnd.getMyTransferObject(..);
> MyForm myForm = (MyForm)form;
> BeanUtils.copyProperties( to, myForm);
> BackEnd.doUpdate( to );
> 
> Pretty simple I think. Just make sure your
> ActionForm doesn't contain 
> properties that you don't care about editing
> otherwise it will 
> over-write the TO properties. If the JSP form is
> going to be very 
> dyanmic, as in it will sometimes have some
> properties and sometimes have 
> others, then you will have to use more complex
> 'tricks' such as using 
> hidden variables.. or I'd just prefer to manually
> set the TO fields in 
> the Action.
> 
> -- 
> Rick
> 
>
-
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
>  





___
Yahoo! Acesso Grátis - navegue de graça com conexão de qualidade! 
http://br.acesso.yahoo.com/

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



Weird message when redirecting

2004-08-23 Thread Leandro Melo
I'm working on a login module, wich because of
JBoss/Tomcat way of handling JAAS it has some
redirections on the way.

I built an action the does some stuff for me and then
returns an ordinary forward. I decided to set
redirect="true" in this forwared just to make sure
that the user sees the correct page on the browser's
url input (in my specific case, i don't have reasons
to send a forwared instead of redirect, if i should do
i forward or a redirect doesn't matter very much at
the moment). Keeping in mind that this is part of the
login, i really would like for the to see the
index.jsp (wich is the one i send the forward to)
rather than some other page that he/she requested.
As we all know, if i use redirect="false" (the default
otpion) the user would see some other page name in the
address bar of the browser, and not index.jsp.

But, when i try to make the login, here's what i got
from Mozilla Firefox.


"Redirection limit for this URL exceeded. Unable to
load the requested page. This maybe caused by cookies
that are blocked."

In Internet Explorer the request just doesn't
complete.

Naturally, if i take out the redirect="true",
everything works fine. I know that when we use
redirect="true" it's necessary a reconnection between
the browser and the application, but why exactly i
would get these errors for using more than one
redirect in a single request.

It's not possible for me to know exactly how many
redirections are going on, because Tomcat that really
handles this request by itself. However i'd guess that
they are two by default. After i added my own redirect
for one of my actions (as i described) they become
three.


Any comments on that???

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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



Re: Browse button localization -- IMPORTANT !!!!

2004-08-23 Thread Leandro Melo
I think this problem goes right at the same point as
the 100 last messages of the list... :-), the ones
about a image button replacing the browse button.


 --- struts lover <[EMAIL PROTECTED]> escreveu: 
> Hello Everyone,
> I am stuck with this localization issue. 
> I am using  tag. I am not able to
> localize
> the text of the Browse button.
> Does any one know how to solve this problem. 
> Please help.
> 
> Thanks
> 
> __
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam
> protection around 
> http://mail.yahoo.com 
> 
>
-
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
>  

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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



Re: Tiles set up

2004-08-22 Thread Leandro Melo
You can also try this:

http://www.onjava.com/pub/a/onjava/excerpt/progjakstruts_14/index4.html

There are definitions examples there.

Leandro.



 --- Shinobu Kawai <[EMAIL PROTECTED]> escreveu: 
> 
> Hi Andy,
> 
> > I am (still!) trying to set up Tiles in my Struts
> app.
> > I am hoping to use Tiles definitions, but can't
> find any usable (working) 
> > simple examples to build from.  Even the one at
> Cedric Dumoulin's site 
> > doesn't use this (best practice?) feature.
> > I have tried a 'cut n shut' from the stuff bundled
> with Struts to no avail.
> They don't?  Have you checked out the "Tutorial Live
> Examples"?  It uses
> definitions, in a step-by-step way, too.
> 
> 
> > As far as I can work out, to get Tiles working
> (with Struts already 
> > configured), you need to:
> > 
> > Add the following to web.xml:
> > 
> >  etc...
> > 
> >   definitions-config
> >  
> /WEB-INF/tiles-defs.xml
> >   
> > 
> Actually, you don't need this here;  the one in the
> plug-in declaration
> does fine.
> 
> > Add the following to struts-config.xml:
> > 
> > 
> > 
> >  className="org.apache.struts.tiles.TilesPlugin" >
> >value="/WEB-INF/tiles-defs.xml 
> > />
> > 
> > 
> > 
> > I have the following in my tiles defs.xml file:
> Unless it's a typo, rename it to "tiles-defs.xml".
> ;)
> 
> > Then I invoke the action forward in a jsp file
> with the following:
> > 
> > Login
> > 
> > and get this...
> > 
> > java.lang.NullPointerException
> > 
>
org.apache.struts.util.RequestUtils.pageURL(RequestUtils.java:1532)
> > 
>
org.apache.struts.util.RequestUtils.computeURL(RequestUtils.java:487)
> > 
>
org.apache.struts.taglib.html.RewriteTag.doStartTag(RewriteTag.java:99)
> > 
>
org.apache.strutsel.taglib.html.ELRewriteTag.doStartTag(ELRewriteTag.java:291)
> > 
>
org.apache.jsp.index_jsp._jspx_meth_html_rewrite_0(index_jsp.java:110)
> > 
>
org.apache.jsp.index_jsp._jspService(index_jsp.java:69)
> > 
>
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
> > 
>
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> > 
>
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
> > 
>
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
> > 
>
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
> > 
>
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> > 
> > All the webapp/tiles/*.jsp files are where they
> should be and the Struts 
> > stuff alone works OK.
> Are you saying that it works if you change
> 
> to  ?
>  I'm pretty
> uncomfortable with the "/do" prefixing the "/login"
> in your html:link
> tag (not that I've tried it).
> 
> Best regards,
> -- Shinobu Kawai
> 
> --
> Shinobu Kawai <[EMAIL PROTECTED],
> [EMAIL PROTECTED]>
> 
> 
> 
> 
>
-
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
>  





___
Yahoo! Acesso Grátis - navegue de graça com conexão de qualidade! 
http://br.acesso.yahoo.com/

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



Re: image button for file upload

2004-08-21 Thread Leandro Melo
I'm no expert here, but i think you're gonna have to
deal with the tradicional and ordinary file button as
it comes. In other words, i don't think it's possible
to use an image for this button.
That's not because of struts, it's how the browsers
implement thier html.


 --- "Dean A. Hoover" <[EMAIL PROTECTED]>
escreveu: 
> I've been reading some interesting methods for
> using image buttons on forms in place of the
> familiar "Submit" style browser generated
> buttons. There is one automatically generated
> button that I am still puzzled on how to use
> an image for it, though. That's the one for
> do file uploading, as in:
> 
>  enctype="multipart/form-data">
> 
> 
> 
> 
> Any ideas?
> Dean Hoover
> 
> 
> 
>
-
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
>  





___
Yahoo! Acesso Grátis - navegue de graça com conexão de qualidade! 
http://br.acesso.yahoo.com/

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



JAAS, JBoss and Struts review. Erik, now i get the point !!!

2004-08-21 Thread Leandro Melo
Hi,
i've been trying for days to make this thing work.
I googled the web for many tutorials and
documentation, i read Scot Stark review, and lot other
stuff.

Unfortunatelly, i guess i didn't make a good search
right here on the struts mail archive. I if i've done
i'd have found this very explanatory discussion (by
Erik, Craig and others).

http://www.mail-archive.com/[EMAIL PROTECTED]/msg07533.html

Maybe it was because of english interpretation
problems, by i couln't still figure out (in the
earlier posts) what Erik was trying to tell me, but
now i do understand!!!

Erik, now i'd like to now if could work out a "final"
solution for your problem? From one of your last
posts, i remember you saying that you haven't worked
on the "security integration between Tomcat and
JBoss", so i'd guess you're still working with the
j_security_check thing, aren't you?

If you're still sticked with the j_security_check
action, i have one question number 1 for your, but if
you're not working with j_security_check anymore and
found out a better work around, i have question number
2 for you.

1 - Suupose a user ruquests page
http://www.EriksApp/someOtherPage.jsp of your
application instead of requestion the
http://www.EriksApp/index.jsp (or just
http://www.EriksApp). First, the user will be
redirected to the login page (assume that all your
application is secure). Second, if login was
sucessful, he'll be redirected to
http://www.EriksApp/someOtherPage.jsp
and NOT to http://www.EriksApp/index.jsp, because
Tomcat saved that first request. But I'd like to have
a forward to SetStuffAction.do in my index.jsp, so i
can set user information in this SetStuffAction.do.
But if the user is redirected to
http://www.EriksApp/someOtherPage.jsp instead of 
http://www.EriksApp/index.jsp, he/she will bypass that
step and won't get their stuff set. How do you "solve"
this (a filter, or something else)???

2 - Well, if you get the whole thing working without
the j_security_check thing and with a "logonAction",
would it be possible for you to send me some code???


Thank you very much,
Leandro.





___
Yahoo! Acesso Grátis - navegue de graça com conexão de qualidade! 
http://br.acesso.yahoo.com/

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



Re: Struts login with JAAS (Part 2)

2004-08-20 Thread Leandro Melo
Hi Erik, i was not missing that, i just forgot to tell
you that...

- JBoss actually propagates it`s security suff to
Tomcat and vice-versa. I got this information from the
JBoss forum
(http://jboss.org/index.html?module=bb&op=viewtopic&t=53202).
Then i tested it myself with a simple login using
j_security_check and could confirm this fact. JAAS is
propagates between JBoss and Tomcat.

Anyway, let`s have some thoughts...
In my logon action, i can log in fine (as i told you,
using JBoss structure) then i forward to the index.jsp
page, wich is a secure page. Then i think that if this
security was not propagated i wouldn`t even get to the
index.jsp, because it`s a protected page. And as i
told you, i reach the index.jsp finely.
So, it seems that i`m actually been authenticated in
JBoss and Tomcat (i`m not home right now, but when i
get there i`ll try to use a request.isUserInRole
method inside that action to confim my thesis), but
only for a request scope.

Leandro.



 --- Erik Weber <[EMAIL PROTECTED]> escreveu: 
> Sorry to hear that you are so mad, it is indeed
> frustrating to try to 
> work with APIs that are poorly documented, but, I
> think you're still 
> missing one thing I've been saying . . .
> 
> Leandro Melo wrote:
> 
> >Hi Erik, 
> >the point is that i actually changing my approach.
> >I gave up for a moment the
> action="j_security_check"
> >(i'm using j_username and j_password just to make
> it
> >similar just because they names were already there
> >when i tried something with j_security_check) thing
> >and pointed the action of my login.jsp to
> >action="/logon.do".
> >Then, in this action, i just create login using
> >defaults's JBoss structure (i'm using
> >DatabaseServlerLogin,
> UsernamePasswordCallbackHanlder,
> >wich are JBoss' stuff).
> >BUT, i'm really, really, really mad with this
> thing.
> >Never been so disapointed about one thing as i'm to
> >this.
> >If you note my logon action you'll see that it does
> >just all tutorials and references to JAAS say to
> do.
> >
> >String j_username =
> >(String)request.getParameter("j_username");
> >String x =
> (String)request.getParameter("j_password");
> >
> >if (x != null){
> >   j_password = x.toCharArray();
> >   handler = new
> UsernamePasswordHandler(j_username,
> >j_password);
> >}
> >
> >LoginContext lc = null;
> >
> >try {
> >   lc = new LoginContext("example2", handler);
> >   lc.login();
> >   Subject subject = lc.getSubject();
> >   Set principals = subject.getPrincipals();
> >   Principal user = new
> SimplePrincipal(j_username);
> >   principals.add(user);
> >} catch (LoginException e) {
> >   e.printStackTrace();
> >   throw new Exception();
> >}
> >
> >return mapping.findForward("index");
> >
> >
> >As i said, this WORKS, it actually logs the user
> >correctly.
> >
> I think it may have logged you in correctly *with
> JBoss*. The 
> LoginContext you are using here is specific to
> JBoss, if I am not mistaken.
> 
> > BUT when i get to index.jsp, i'm not logged
> >anymore, the action seems to be logging the user
> doing
> >the stuff i ask and as soon as the action leaves
> the
> >scope, i back not logged again. This makes me
> mad
> >  
> >
> Struts runs in the Tomcat container, within the
> JBoss JVM. When you 
> logged in with the JBoss login module, Tomcat knew
> nothing about it. To 
> login with Tomcat, you have to send the form action
> to 
> "j_security_check". That is the way I understand it.
> 
> Erik
> 
> >Then, i thought i could be HttpSession issues, and
> i
> >inserted the following line in the beggining of the
> >Action, BUT, take a look on what happens.
> >
> >//the first lines of the action
> >if (request.getSession(false) == null){
> >   System.out.println("session not created");
> >}
> > 
> >/*Hahahaha, the weird thing is that my
> >getSession(false) NEVER returns null!!! Even this
> >beeing the first Action of my app. As sugestion of
> >other people i inserted the following line in
> >struts-config.xml -> locale="false"/>
> >Because struts creates a session object if
> >locale="true", which is default option.
> >So, to FORCE my login over here, i'll just go with
> >invalidating my session. */
> >
> >request.getSession().invalidate

Re: Struts login with JAAS (Part 2)

2004-08-20 Thread Leandro Melo
at I have not been able to use
> this approach when 
> > deploying web apps in the JBoss-3.2.x-Tomcat-5.0.x
> stack.
> 
> By "this approach" I meant making the login page be
> a part of Struts. 
> But using a login page that is a simple form with an
> action set to 
> "j_security_check", and the parameters set to
> "j_username" and 
> "j_password" does work just fine. I was trying to
> make my login screen a 
> part of Struts (with an associated form-bean, etc.,
> as I think you are 
> trying to do) and that's what I'm saying doesn't
> work, not 
> container-managed security itself, in JBoss/Tomcat.
> 
> > I tried something similar to what you are trying
> (I wrote a 
> > CallbackHandler, etc., -- see the JBoss free doc
> on JAAS by Scott 
> > Stark, or maybe you already have). The problem is
> that you are logging 
> > in with a JBoss login module, and there is no
> integration between that 
> > module and Tomcat, if I am not mistaken.
> >
> > I haven't tried container-managed security with
> Tomcat stand alone, 
> > but I am led to believe it is straightforward.
> 
> I don't know why I even wrote this sentence, it is
> completely irrelevant 
> to what we were talking about (a container-managed
> login that is also 
> part of your Struts app). I got sidetracked in my
> thinking. I am certain 
> that container-managed security works just fine in
> its own right in 
> either container.
> 
> >
> > A possible solution, if you have to stick with
> JBoss, could be for you 
> > to write code that logs in with not only the JBoss
> login modules, but 
> > the Tomcat ones. I don't know spefically how to do
> this or if it can 
> > be done, but I suspect that it can, and I seen
> suggestions here and 
> > there on how to do it. However, I question whether
> it is worth the 
> > trouble. The idea here is to let the container do
> all this for you. 
> > Still, if you get something along these lines
> working, please share 
> > it, because I suspect it would be useful until
> such a time as JBoss 
> > and Tomcat integrate better when it comes to
> security. But be careful 
> > of wasting your time.
> >
> > Erik
> >
> >
> >
> >
> > Leandro Melo wrote:
> >
> >> I'm back!
> >> After getting some jaas studies, i'm a little bit
> >> better, so i can now formulate a better question.
> >>
> >> Here it is... (I know that this is not only a
> Struts
> >> question, because it envolves jaas, but i'm
> pretty
> >> sure that people over here could give me some
> advise
> >> on how to handle the problem).
> >>
> >> I got my application protected with JAAS, so
> users
> >> cannot access any pages or servles withou a
> login. I
> >> build then an Action to handle login stuff.
> >>
> >> Heres the code of my LoginAction (execute
> method).
> >>
> >> //...
> >> String j_username =
> >> (String)request.getParameter("j_username");
> >> String x =
> (String)request.getParameter("j_password");
> >>
> >> if (x != null){
> >>j_password = x.toCharArray();
> >> handler = new
> UsernamePasswordHandler(j_username,
> >> j_password);
> >> }
> >>LoginContext lc = null;
> >>
> >> try {
> >>lc = new LoginContext("example2",
> handler);
> >> lc.login();
> >> 
> >>
> >>//this part doesn't matter very much
> >> Subject subject = lc.getSubject();
> >>Set principals = subject.getPrincipals();
> >> Principal user = new
> SimplePrincipal(j_username);
> >> principals.add(user);
> >>
> >> } catch (LoginException e) {
> >>// TODO Auto-generated catch block
> >> e.printStackTrace();
> >> throw new Exception();
> >> }
> >>
> >> return mapping.findForward("index");
> >>
> >>
> >>
> >> The above code runs perfectly! It logs the user
> >> correctly and then i'm forwared to my index page.
> >> [b]But[/b], when i get to index, everything is
> gone!!!
> >> I'm not logged anymore. If i try to access
> another
> >> page in my application, i'm redirect to the
> login.jsp
> >> page again!!!
> >>
> >> I heard that this is because the multi-thread
> >> characteristic of the servlets, but
> >> How can i workaround this??? how can i make this
> >> maintain my login through the rest of my
> session???
> >>
> >>
> >> Here's a piece of login-config.xml
> >>
> >>
> >>   
> >>   
=== message truncated === 





___
Yahoo! Acesso Grátis - navegue de graça com conexão de qualidade! 
http://br.acesso.yahoo.com/

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



Struts login with JAAS (Part 2)

2004-08-19 Thread Leandro Melo
I'm back!
After getting some jaas studies, i'm a little bit
better, so i can now formulate a better question.

Here it is... (I know that this is not only a Struts
question, because it envolves jaas, but i'm pretty
sure that people over here could give me some advise
on how to handle the problem). 


I got my application protected with JAAS, so users
cannot access any pages or servles withou a login. I
build then an Action to handle login stuff.

Heres the code of my LoginAction (execute method).

//...
String j_username =
(String)request.getParameter("j_username");
String x = (String)request.getParameter("j_password");

if (x != null){
j_password = x.toCharArray();
handler = new UsernamePasswordHandler(j_username,
j_password);
}
   
LoginContext lc = null;

try {
lc = new LoginContext("example2", handler);
lc.login();


//this part doesn't matter very much
Subject subject = lc.getSubject();
Set principals = subject.getPrincipals();
Principal user = new SimplePrincipal(j_username);
principals.add(user);

} catch (LoginException e) {
// TODO Auto-generated catch block
e.printStackTrace();
throw new Exception();
}

return mapping.findForward("index");



The above code runs perfectly! It logs the user
correctly and then i'm forwared to my index page.
[b]But[/b], when i get to index, everything is gone!!!
I'm not logged anymore. If i try to access another
page in my application, i'm redirect to the login.jsp
page again!!!

I heard that this is because the multi-thread
characteristic of the servlets, but 

How can i workaround this??? how can i make this
maintain my login through the rest of my session???


Here's a piece of login-config.xml


   
  
  
   








java:/DefaultDS
Select
Password from Principals where PrincipalID
=?
Select Role
'Roles', RoleGroup 'RoleGroups' from Roles where
PrincipalID =?





Thanks and regards,
Leandro





___
Yahoo! Acesso Grátis - navegue de graça com conexão de qualidade! 
http://br.acesso.yahoo.com/

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



Re: Security - From tradition to struts

2004-08-19 Thread Leandro Melo
Thank you very much for your time Erik, i'll try to
get some study around it!!!

I don't know if it's possible (probably not, i
know...) , but if you could send me your LogonAction
class (and associated stuff) would awsome! But i you
can't, that's allrigth, i completely understand!

Regards,
Leandro.



 --- Erik Weber <[EMAIL PROTECTED]> escreveu: 
> Sorry, by "hand-rolled" I just mean one that is
> written specifically for 
> the application (written by you).
> 
> The general idea is something like this:
> 
> Make a BaseAction class.
> 
> Implement a checkLogin method in the BaseAction
> class that looks in the 
> current request's HttpSession for a "User" object,
> which you would have 
> placed into the session in your LoginAction.
> Implement a checkPermission method in the BaseAction
> class that looks in 
> the current HttpSession for a role associated with
> the user (maybe this 
> is part of the "User" object) that matches the role
> required for the 
> current request (or you can go as fine-grained as
> you want, with many 
> different permissions to check for a single request)
> to be granted.
> 
> All your Action classes extend the BaseAction class.
> They can invoke the 
> checkLogin and/or the checkPermission methods at the
> beginning of the 
> execute method to decide whether/how to proceed.
> 
> Write a LoginAction class that sets the "User"
> action, along with 
> permissions, roles, etc., whatever else is needed in
> your checkLogin and 
> checkPermission methods, in the session after login
> has succeeded (you 
> have taken the entered username and password and
> matched them 
> successfully against a username and password
> combination in your 
> database -- typically in a USERS table).
> 
> Write a Logout Action that invalidates the current
> session.
> 
> Alternatively, you could check the login and the
> permissions the same 
> way, but in a sublass of the Struts
> RequestProcessor, or in a Servlet 
> Filter, instead of in a BaseAction class.
> 
> If you want to go with container-managed security
> and you can use 
> Tomcat, try this (you should probably read it
> anyway).
> 
>
http://jakarta.apache.org/tomcat/tomcat-5.0-doc/realm-howto.html
> 
> I also suggest you read the security section of the
> J2EE tutorial, and 
> the security sections of the JSP and Servlet
> specifications.
> 
> If you go with container-managed security, it's real
> easy to allow/deny 
> entire JSPs, but you still may need to implement
> finer-grained 
> permissions checks on your own if you need to, for
> example, show/hide 
> links on a page based on permissions.
> 
> Erik
> 
> Leandro Melo wrote:
> 
> >Erik,
> >i don't quite understand what you call a
> hand-rolled
> >java component (maybe because of my english).
> >Anyway, it seems to me that you're not using JAAS
> to
> >completely control application's security, are u?
> >I don't know if it possible, but if so, would you
> post
> >your setup and basic classes?
> >I'm very very new at security stuff...
> >Anyway, i cleared out a lot of things for me.
> >
> >Thanks,
> >Leandro.
> >
> >
> > --- Erik Weber <[EMAIL PROTECTED]>
> escreveu: 
> >  
> >
> >>I don't really consider myself an expert here, but
> I
> >>dare say that there 
> >>are a lot of webapps deployed out there using
> >>programmatic (hand-rolled) 
> >>security successfully. I have used the approach
> with
> >>success. What 
> >>exactly the advantages are to using
> >>container-managed security I am not 
> >>able to fully deduce (except for the obvious --
> it's
> >>nice to declare 
> >>stuff in web.xml in a standardized way -- and that
> >>perhaps it might make 
> >>Servlets a *little* more portable if you wanted to
> >>use them among 
> >>different apps). But then again, I haven't had to
> >>take on a project yet 
> >>where the environment was extremely complicated,
> >>when it came to how 
> >>users and permissions were managed (typically I
> see
> >>the same tried and 
> >>trusted setup -- USER, GROUP, ROLES and
> PERMISSIONS
> >>tables in some 
> >>central database, and some hand-rolled Java
> >>component, used to authorize 
> >>the current request, that is invoked in some
> >>"common" area, such as a 
> >>Servlet Filter -- or, in Struts, a base Action
> class
&

Re: Security - From tradition to struts

2004-08-19 Thread Leandro Melo
Erik,
i don't quite understand what you call a hand-rolled
java component (maybe because of my english).
Anyway, it seems to me that you're not using JAAS to
completely control application's security, are u?
I don't know if it possible, but if so, would you post
your setup and basic classes?
I'm very very new at security stuff...
Anyway, i cleared out a lot of things for me.

Thanks,
Leandro.


 --- Erik Weber <[EMAIL PROTECTED]> escreveu: 
> I don't really consider myself an expert here, but I
> dare say that there 
> are a lot of webapps deployed out there using
> programmatic (hand-rolled) 
> security successfully. I have used the approach with
> success. What 
> exactly the advantages are to using
> container-managed security I am not 
> able to fully deduce (except for the obvious -- it's
> nice to declare 
> stuff in web.xml in a standardized way -- and that
> perhaps it might make 
> Servlets a *little* more portable if you wanted to
> use them among 
> different apps). But then again, I haven't had to
> take on a project yet 
> where the environment was extremely complicated,
> when it came to how 
> users and permissions were managed (typically I see
> the same tried and 
> trusted setup -- USER, GROUP, ROLES and PERMISSIONS
> tables in some 
> central database, and some hand-rolled Java
> component, used to authorize 
> the current request, that is invoked in some
> "common" area, such as a 
> Servlet Filter -- or, in Struts, a base Action class
> or a custom 
> RequestProcessor). It seems like JAAS is still at an
> immature stage 
> perhaps, or at least the state of documenation about
> it is.
> 
> The other route it seems you could go is to use a
> container-managed 
> login as you suggest, and enjoy using the methods
> such as 
> request.isUserInRole instead of invoking security
> methods on a 
> hand-rolled component, but I think you will have to
> give up the 
> JBoss/Tomcat stack to do this for now (someone
> please correct me if I am 
> wrong), because I think there is a security
> integration problem there, 
> as I described earlier. I'm guessing Tomcat as stand
> alone might be a 
> good way to go though. I have not done this and
> couldn't say whether it 
> is "common and usual".
> 
> I have tried to write my role-checking methods so
> that in the future if 
> I port an application to JAAS I can just refactor
> them to invoke the 
> standard methods instead of my own. But like I say,
> I'm far from an 
> expert in this area.
> 
> Hope that helps,
> 
> Erik
> 
> Leandro Melo wrote:
> 
> >So Erik, is it a common and usual aproach to do
> login
> >outside of Struts (ordinary jsps), and then use
> Struts
> >afterwards???
> >
> >
> > --- Erik Weber <[EMAIL PROTECTED]>
> escreveu: 
> >  
> >
> >>Leandro, search the archives of this List for
> >>"JAAS". I participated in 
> >>a thread about this within the last two months.
> >>
> >>I'm not sure if I understand exactly what you want
> >>to do, but if you 
> >>want to use container-managed security, I don't
> know
> >>of a way to have 
> >>your login screen be part of Struts. As far as I
> >>know, you have to let 
> >>the container process the request that results
> from
> >>the login screen's 
> >>form submittal (I tried having an Action intercept
> >>this request and then 
> >>attempt to login with the JBoss JAAS module
> manually
> >>but gave up when I 
> >>realized problem # 2 -- below).
> >>
> >>Another problem you are probably going to run into
> >>is that the JBoss 
> >>security context is not propagated to Tomcat, and
> >>vice versa, as far as 
> >>I know. So if you authenticate using JBoss JAAS,
> >>Tomcat won't know about 
> >>it, and the methods such as request.isUserInRole
> >>aren't going to do you 
> >>any good (although you would presumably be able to
> >>use the similar 
> >>methods on EJBs, because they are running within
> the
> >>JBoss security 
> >>context).
> >>
> >>I found JAAS to be a nightmare, though a couple
> >>people gave me possible 
> >>solutions to the problems I mentioned in the
> thread
> >>(one would be 
> >>intercepting the login screen request and then
> >>manually logging in with 
> >>both JBoss JAAS as well as Tomcat JAAS modules --
> >>but I don't know if 
>

Re: Security - From tradition to struts

2004-08-18 Thread Leandro Melo
So Erik, is it a common and usual aproach to do login
outside of Struts (ordinary jsps), and then use Struts
afterwards???


 --- Erik Weber <[EMAIL PROTECTED]> escreveu: 
> Leandro, search the archives of this List for
> "JAAS". I participated in 
> a thread about this within the last two months.
> 
> I'm not sure if I understand exactly what you want
> to do, but if you 
> want to use container-managed security, I don't know
> of a way to have 
> your login screen be part of Struts. As far as I
> know, you have to let 
> the container process the request that results from
> the login screen's 
> form submittal (I tried having an Action intercept
> this request and then 
> attempt to login with the JBoss JAAS module manually
> but gave up when I 
> realized problem # 2 -- below).
> 
> Another problem you are probably going to run into
> is that the JBoss 
> security context is not propagated to Tomcat, and
> vice versa, as far as 
> I know. So if you authenticate using JBoss JAAS,
> Tomcat won't know about 
> it, and the methods such as request.isUserInRole
> aren't going to do you 
> any good (although you would presumably be able to
> use the similar 
> methods on EJBs, because they are running within the
> JBoss security 
> context).
> 
> I found JAAS to be a nightmare, though a couple
> people gave me possible 
> solutions to the problems I mentioned in the thread
> (one would be 
> intercepting the login screen request and then
> manually logging in with 
> both JBoss JAAS as well as Tomcat JAAS modules --
> but I don't know if 
> this has been done). I presume it's a much easier
> endeavor if you are 
> just using Tomcat stand alone, but I'll let Craig
> address that if he 
> wants, because I've never tried it.
> 
> Erik
> 
> 
> Leandro Melo wrote:
> 
> >Or i just extend the DatabaseServerLoginModule
> class
> >and leave an empty class
> >
> >
> >
> > --- Leandro Melo <[EMAIL PROTECTED]>
> >escreveu: 
> >  
> >
> >>Just complementing my question...
> >>
> >>Would it be fair if i copy JBoss'
> >>DatabaseServerLoginModule code and place it inside
> >>an
> >>Action???
> >>
> >>This way, i'll have an Action (for example,
> >>MyLoginAction) that does exactly what
> >>DatabaseServerLoginModule does.
> >>
> >>
> >>
> >> --- Leandro Melo <[EMAIL PROTECTED]>
> >>escreveu: 
> >>
> >>
> >>>Please help me out here!
> >>>I'm very new with jaas, so i need some help.
> >>>
> >>>I got a simple login that is working fine for me,
> >>>here
> >>>it is:
> >>>
> >>>...
> >>> >>>  method="get">
> >>>  
> >>>   NOME: >>>  
> >>>
> >>/>
> >>
> >>
> >>>   
> >>>   
> >>>   SENHA:  >>>name="j_password"
> >>>/>
> >>>   
> >>>  
> >>>...
> >>>
> >>>I'm using JBoss' default stuff (LoginModule,
> >>>CallbackHandler, etc...) to make it works. Here's
> >>>  
> >>>
> >>a
> >>
> >>
> >>>piece of my configuration file (for jboss).
> >>>
> >>>...
> >>>example2
> >>>{
> >>>
> >>>  
> >>>
>
>org.jboss.security.auth.spi.DatabaseServerLoginModule
> >  
> >
> >>>required
> >>>dsJndiName="java:/DefaultDS"
> >>>principalsQuery="Select Password from Principals
> >>>where
> >>>PrincipalID =?"
> >>>rolesQuery="Select Role 'Roles', RoleGroup
> >>>'RoleGroups' from Roles where PrincipalID =?"
> >>>;
> >>>};
> >>>...
> >>>
> >>>
> >>>As i said, this works fine for me. I only made
> >>>configuration and login.jsp, after the user
> >>>  
> >>>
> >>submits
> >>
> >>
> >>>data from login.jsp, JBoss takes care of the
> whole
> >>>thing and already directs the user to index.jsp
> >>>  
> >>>
> >>(in
> >>
> >>
> >>>case of sucessful login).
> >>>
> >>>NOW, i want to do the exact same thing with
> Struts
> >>>(my
> >>>enviroment is all setup, the only thing i didn't
> >>>have
> >>>was the login module, i already have everything
> >>>  
> >>>
> >>set
> >>
> >>
> >>>and working with Tiles). 
> >>>
> >>>The problem is that i don't know what to do,
> >>>  
> >>>
> >>because
> >>
> >>
> >>>i'll probably have to write a Servlet that
> handles
> >>>this request won't i???
> >>>
> >>>Here's in my web.xml
> >>>   
> >>>   
> >>>   
> >>>  
> >>>
> >>Restricted
> >>
> >>
> >>>   Declarative security
> >>>tests
> >>>   /jaas_tests/*
> >>>   HEAD
> >>>   GET
> >>>   POST
> >>>   PUT
> >>>   DELETE
> >>>   
> >>>   
> >>>   
> >>>   Echo
> >>>   
> >>>   
> >>>   
> 
=== message truncated === 

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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



Re: Security - From tradition to struts

2004-08-18 Thread Leandro Melo
Or i just extend the DatabaseServerLoginModule class
and leave an empty class



 --- Leandro Melo <[EMAIL PROTECTED]>
escreveu: 
> Just complementing my question...
> 
> Would it be fair if i copy JBoss'
> DatabaseServerLoginModule code and place it inside
> an
> Action???
> 
> This way, i'll have an Action (for example,
> MyLoginAction) that does exactly what
> DatabaseServerLoginModule does.
> 
> 
> 
>  --- Leandro Melo <[EMAIL PROTECTED]>
> escreveu: 
> > Please help me out here!
> > I'm very new with jaas, so i need some help.
> > 
> > I got a simple login that is working fine for me,
> > here
> > it is:
> > 
> > ...
> >  >   method="get">
> >   
> >NOME: />
> >
> >
> >SENHA:  > name="j_password"
> > />
> >
> >   
> > ...
> > 
> > I'm using JBoss' default stuff (LoginModule,
> > CallbackHandler, etc...) to make it works. Here's
> a
> > piece of my configuration file (for jboss).
> > 
> > ...
> > example2
> > {
> >
>
org.jboss.security.auth.spi.DatabaseServerLoginModule
> > required
> > dsJndiName="java:/DefaultDS"
> > principalsQuery="Select Password from Principals
> > where
> > PrincipalID =?"
> > rolesQuery="Select Role 'Roles', RoleGroup
> > 'RoleGroups' from Roles where PrincipalID =?"
> > ;
> > };
> > ...
> > 
> > 
> > As i said, this works fine for me. I only made
> > configuration and login.jsp, after the user
> submits
> > data from login.jsp, JBoss takes care of the whole
> > thing and already directs the user to index.jsp
> (in
> > case of sucessful login).
> > 
> > NOW, i want to do the exact same thing with Struts
> > (my
> > enviroment is all setup, the only thing i didn't
> > have
> > was the login module, i already have everything
> set
> > and working with Tiles). 
> > 
> > The problem is that i don't know what to do,
> because
> > i'll probably have to write a Servlet that handles
> > this request won't i???
> > 
> > Here's in my web.xml
> > 
> > 
> > 
> Restricted
> > Declarative security
> > tests
> > /jaas_tests/*
> > HEAD
> > GET
> > POST
> > PUT
> > DELETE
> > 
> > 
> > 
> > Echo
> > 
> > 
> > 
> > no description
> > NONE
> > 
> > 
> > 
> > FORM
> > 
> > 
> >
>
/jaas_tests/login.jsp
> > 
> > 
> >
>
/jaas_tests/error.jsp
> > 
> > 
> > 
> > 
> > I can start by changing the login page from
> > login.jsp
> > to login.do, mapping this Action, then what... ???
> > 
> > Thanks,
> > Leandro
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> >
>
___
> > Yahoo! Acesso Grátis - navegue de graça com
> conexão
> > de qualidade! 
> > http://br.acesso.yahoo.com/
> > 
> >
>
-
> > To unsubscribe, e-mail:
> > [EMAIL PROTECTED]
> > For additional commands, e-mail:
> > [EMAIL PROTECTED]
> > 
> >  
> 
> 
>   
>   
>   
>
___
> Yahoo! Acesso Grátis - navegue de graça com conexão
> de qualidade! 
> http://br.acesso.yahoo.com/
> 
>
-
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
>  





___
Yahoo! Acesso Grátis - navegue de graça com conexão de qualidade! 
http://br.acesso.yahoo.com/

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



Re: Security - From tradition to struts

2004-08-18 Thread Leandro Melo
Just complementing my question...

Would it be fair if i copy JBoss'
DatabaseServerLoginModule code and place it inside an
Action???

This way, i'll have an Action (for example,
MyLoginAction) that does exactly what
DatabaseServerLoginModule does.



 --- Leandro Melo <[EMAIL PROTECTED]>
escreveu: 
> Please help me out here!
> I'm very new with jaas, so i need some help.
> 
> I got a simple login that is working fine for me,
> here
> it is:
> 
> ...
>method="get">
>   
>NOME:
>
>
>SENHA:  name="j_password"
> />
>
>   
> ...
> 
> I'm using JBoss' default stuff (LoginModule,
> CallbackHandler, etc...) to make it works. Here's a
> piece of my configuration file (for jboss).
> 
> ...
> example2
> {
>
org.jboss.security.auth.spi.DatabaseServerLoginModule
> required
> dsJndiName="java:/DefaultDS"
> principalsQuery="Select Password from Principals
> where
> PrincipalID =?"
> rolesQuery="Select Role 'Roles', RoleGroup
> 'RoleGroups' from Roles where PrincipalID =?"
> ;
> };
> ...
> 
> 
> As i said, this works fine for me. I only made
> configuration and login.jsp, after the user submits
> data from login.jsp, JBoss takes care of the whole
> thing and already directs the user to index.jsp (in
> case of sucessful login).
> 
> NOW, i want to do the exact same thing with Struts
> (my
> enviroment is all setup, the only thing i didn't
> have
> was the login module, i already have everything set
> and working with Tiles). 
> 
> The problem is that i don't know what to do, because
> i'll probably have to write a Servlet that handles
> this request won't i???
> 
> Here's in my web.xml
>   
>   
>   Restricted
>   Declarative security
> tests
>   /jaas_tests/*
>   HEAD
>   GET
>   POST
>   PUT
>   DELETE
>   
>   
>   
>   Echo
>   
>   
>   
>   no description
>   NONE
>   
>   
>   
>   FORM
>   
>   
>
/jaas_tests/login.jsp
> 
>   
>
/jaas_tests/error.jsp
>   
>   
> 
> 
> I can start by changing the login page from
> login.jsp
> to login.do, mapping this Action, then what... ???
> 
> Thanks,
> Leandro
> 
> 
> 
> 
>   
>   
>   
>
___
> Yahoo! Acesso Grátis - navegue de graça com conexão
> de qualidade! 
> http://br.acesso.yahoo.com/
> 
>
-
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
>  





___
Yahoo! Acesso Grátis - navegue de graça com conexão de qualidade! 
http://br.acesso.yahoo.com/

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



Security - From tradition to struts

2004-08-18 Thread Leandro Melo
Please help me out here!
I'm very new with jaas, so i need some help.

I got a simple login that is working fine for me, here
it is:

...

  
   NOME:
   
   
   SENHA: 
   
  
...

I'm using JBoss' default stuff (LoginModule,
CallbackHandler, etc...) to make it works. Here's a
piece of my configuration file (for jboss).

...
example2
{
org.jboss.security.auth.spi.DatabaseServerLoginModule
required
dsJndiName="java:/DefaultDS"
principalsQuery="Select Password from Principals where
PrincipalID =?"
rolesQuery="Select Role 'Roles', RoleGroup
'RoleGroups' from Roles where PrincipalID =?"
;
};
...


As i said, this works fine for me. I only made
configuration and login.jsp, after the user submits
data from login.jsp, JBoss takes care of the whole
thing and already directs the user to index.jsp (in
case of sucessful login).

NOW, i want to do the exact same thing with Struts (my
enviroment is all setup, the only thing i didn't have
was the login module, i already have everything set
and working with Tiles). 

The problem is that i don't know what to do, because
i'll probably have to write a Servlet that handles
this request won't i???

Here's in my web.xml


Restricted
Declarative security
tests
/jaas_tests/*
HEAD
GET
POST
PUT
DELETE



Echo



no description
NONE



FORM


/jaas_tests/login.jsp


/jaas_tests/error.jsp




I can start by changing the login page from login.jsp
to login.do, mapping this Action, then what... ???

Thanks,
Leandro







___
Yahoo! Acesso Grátis - navegue de graça com conexão de qualidade! 
http://br.acesso.yahoo.com/

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



Login and authentication

2004-08-17 Thread Leandro Melo
Hi,
i'm building a b2b application that must be released
for testing in a few days.

I got 1 very basic problem:
- I don't know jaas 

The good point is that i need only a login module to
go with Struts and jboss. It doesn't need to be
definitie, but it must work.

I don't know if by the fact i'm using struts, things
should be implemented diferent (as i said, i don't how
jaas works), that's why i'm sendind this e-mail.

Does anyone know a short tutorial i can use?





___
Yahoo! Acesso Grátis - navegue de graça com conexão de qualidade! Acesse: 
http://br.acesso.yahoo.com/

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



RE: Overwritting RequestProcessor, how to???

2004-08-16 Thread Leandro Melo
Frank, as i said, i only want to call another method
everytime validate() fails. That's the only thing i
wanna do.

If i only overwritte ActionForm and create a
MyBaseActionForm, in my specific forms i'd have to do
something like this inside validate() method.

if (errors != null){
  mySpecificMethod();
}

What will cause me to modify all action forms i got.
I thought i'd be simpler if i just overwritte the
request processor and put the above code inside it.

What do you thing now? Is still not the better idea?

I ask because i'm really a beginner, so i don't know
if it would be the best architecture.






 --- Frank Zammetti <[EMAIL PROTECTED]> escreveu: 
> Maybe it would be enough to just write your own base
> class that extends 
> ActionForm, have your "common" code in it, and then
> extend your ActionForms 
> from that class?
> 
> If not, take a look at my code from
> http://www.omnytex.com/strutsws for an 
> example of writing your own command processor.  I
> get the feeling it's not 
> the right approach, but I could be wrong.
> 
> Frank W. Zammetti
> Founder and Chief Software Architect
> Omnytex Technologies
> www.omnytex.com
> 
> 
> 
> 
> 
> >From: Leandro Melo <[EMAIL PROTECTED]>
> >Reply-To: "Struts Users Mailing List"
> <[EMAIL PROTECTED]>
> >To: struts jakarta <[EMAIL PROTECTED]>
> >Subject: Overwritting RequestProcessor, how to???
> >Date: Sun, 15 Aug 2004 14:06:34 -0300 (ART)
> >
> >Hi,
> >i'd like to overwirte RequestProcessor, but
> actually i
> >don't really know if it's a good idea.
> >
> >Here's the point:
> >I'd like to have one more action if my
> form.validate()
> >method fails on ActionForm. I'd like to do some
> >specific stuff everytime the validate method fails.
> >Then, i thought of overwritting the
> RequestProcessor.
> >
> >Is that a good idea, or there's another way to
> >accomplish what i want???
> >
> >Regards,
> >ltcmelo
> >
> >
> >
> >
> >
>
>___
> >Yahoo! Acesso Grátis - navegue de graça com conexão
> de qualidade! Acesse: 
> >http://br.acesso.yahoo.com/
> >
>
>-
> >To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> >For additional commands, e-mail:
> [EMAIL PROTECTED]
> >
> 
>
_
> Get ready for school! Find articles, homework help
> and more in the Back to 
> School Guide!
> http://special.msn.com/network/04backtoschool.armx
> 
> 
>
-
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
>  

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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



Re: Modifying Tiles definitions dinamically

2004-08-16 Thread Leandro Melo
I'm not sure if i get it right, i still have a couple
doubts.
Take this definition:


...

  

...




Naturally i got a login page, would i have to redirect
the login (or just forward the login) to  this
"TilesAction" and then manipulate my definition and
insert the real jsp page i want???

I have never heard of this "TilesAction" (haven`t been
dealling with struts for long time), but is it
possible to some post some bib reference (or web
reference) where i can learn how to work with it???

If it`s easy, maybe a little piece of code would also
work.

Thanks,
Leandro









 --- [EMAIL PROTECTED] escreveu: 
> think the best (and the most elegant) way to make
> dynamic tiles is by
> using TilesAction. This because this class has
> knowledge of the use of
> Tiles.
> So write your TilesAction (it is similar to a plain
> Action, except of some
> more parameters in the "execute" method). In the
> "execute" method put your
> code that can distinguish between different users
> and for each one forward
> to a different JSP page, that will be your "real"
> tile.
> Obviously map your actions in struts-config.xml just
> the same way as
> normal actions.
> Then put a definition like this (I am using your
> example):
> 
>  path="/layouts/layout.jsp">
>   
>   
>   
>value="/functionalBlocks/errorHTMLcomponent.jsp"/>
>value="/choosePageComment.do"/>
>   
>   
> 
> 
> Hope it helps.
> Ciao
> Antonio
> 
> P.S. In fact in this example a normal Action can be
> used, but I suggest to
> use TilesAction because that class can manipulate
> the definition itself
> (please people working on Struts, correct me if I am
> wrong).
> 
> Leandro Melo wrote:
> 
> >Hi,
> >i got a very ordinary problem.
> >I need to provide diferent menus for diferent
> people
> >that are logged in the application.
> >I don't know what i should do exactly to provide
> this
> >funcionality, because i don't really know what
> Tiles
> >allow me to do (i don't know it's potencial).
> >
> >I got the following base tiles definition in my
> app.
> > >path="/layouts/layout.jsp">
> >  
> >  
> >  
> >   >value="/functionalBlocks/errorHTMLcomponent.jsp"/>
> >  
> >  
> >  
> >
> >
> >One thing i thought is to verify the user
> permissions
> >at log time, then, depending on the user i'd change
> >the attribute "menu" of my definition to the page
> >menu2.jsp or menu3.jsp, for example. Can (how) i do
> >that???
> >
> >I also thought on bulding 2 (or 3 or 4) BASE
> >deifinitions and at log time i'd decide which base
> >definition to use. Can i do that (how??)??
> >
> >I'd appreciate if some show me some reference or
> just
> >some sample code on how to do that.
> >
> >Thansk,
> >ltcmelo
> >
> 
> 
>
-
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
>  





___
Yahoo! Acesso Grátis - navegue de graça com conexão de qualidade! Acesse: 
http://br.acesso.yahoo.com/

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



Modifying Tiles definitions dinamically

2004-08-15 Thread Leandro Melo
Hi,
i got a very ordinary problem.
I need to provide diferent menus for diferent people
that are logged in the application.
I don't know what i should do exactly to provide this
funcionality, because i don't really know what Tiles
allow me to do (i don't know it's potencial).

I got the following base tiles definition in my app.

  
  
  
  
  
  
  


One thing i thought is to verify the user permissions
at log time, then, depending on the user i'd change
the attribute "menu" of my definition to the page
menu2.jsp or menu3.jsp, for example. Can (how) i do
that???

I also thought on bulding 2 (or 3 or 4) BASE
deifinitions and at log time i'd decide which base
definition to use. Can i do that (how??)??

I'd appreciate if some show me some reference or just
some sample code on how to do that.

Thansk,
ltcmelo



=






___
Yahoo! Acesso Grátis - navegue de graça com conexão de qualidade! Acesse: 
http://br.acesso.yahoo.com/

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



Re: Overwritting RequestProcessor, how to???

2004-08-15 Thread Leandro Melo
Niall,
i actually use tiles, but does it mean that the
requestProcessor i'm using is the Tiles one.
In my struts-config.xml i got this for the
configuration part.

 

So, i guess i'm using default's RequestProcessor, wich
is struts RequestProcessor, am i right?


 --- Niall Pemberton
<[EMAIL PROTECTED]> escreveu: 
> All you have to do is extend the RequestProcessor
> (or TilesRequestProcessor
> if you use tiles) and then specify it in the
>  element of the
> struts-config.xml
> 
> processorClass="myPackage.MyRequestProcessor"/>
> 
>
http://struts.apache.org/userGuide/configuration.html#controller_config
> 
> I guess whether its a good idea or not depends on
> what you're doing.
> 
> Niall
> 
> - Original Message - 
> From: "Leandro Melo" <[EMAIL PROTECTED]>
> To: "struts jakarta" <[EMAIL PROTECTED]>
> Sent: Sunday, August 15, 2004 6:06 PM
> Subject: Overwritting RequestProcessor, how to???
> 
> 
> > Hi,
> > i'd like to overwirte RequestProcessor, but
> actually i
> > don't really know if it's a good idea.
> >
> > Here's the point:
> > I'd like to have one more action if my
> form.validate()
> > method fails on ActionForm. I'd like to do some
> > specific stuff everytime the validate method
> fails.
> > Then, i thought of overwritting the
> RequestProcessor.
> >
> > Is that a good idea, or there's another way to
> > accomplish what i want???
> >
> > Regards,
> > ltcmelo
> >
> >
> >
> >
> >
> >
>
___
> > Yahoo! Acesso Grátis - navegue de graça com
> conexão de qualidade! Acesse:
> http://br.acesso.yahoo.com/
> >
> >
>
-
> > To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> > For additional commands, e-mail:
> [EMAIL PROTECTED]
> >
> >
> >
> 
> 
> 
>
-
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
>  

=






___
Yahoo! Acesso Grátis - navegue de graça com conexão de qualidade! Acesse: 
http://br.acesso.yahoo.com/

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



Re: Problems on disabling inputs

2004-08-15 Thread Leandro Melo
I don't get exception Mike, i just get the following
on my page (viewing source from the browser).



instead of getting this.



Then, when the user submits the data, my ActionForm
understands that the input "test" is equals("").
So, it returns some action errors.


 --- Mike Deegan <[EMAIL PROTECTED]> escreveu: 
> Not sure the exact error you are getting, but I had
> a similar and going from
> memory ...
> when using the  tag with disable="true"
> for a property I had to
> also code a  for the property being
> disabled
> not sure if this will solve you problem - a dump of
> the exact exception you
> are getting may shed more light
> 
> Regards
> Mike
> 
> 
> - Original Message - 
> From: "Leandro Melo" <[EMAIL PROTECTED]>
> To: "struts jakarta" <[EMAIL PROTECTED]>
> Sent: Sunday, August 15, 2004 11:21 AM
> Subject: Problems on disabling inputs
> 
> 
> > Hi,
> > if i try to disable an input like this
> >
> > 
> >
> > i get something like this form the browser
> >
> > 
> >
> > which, i don't know why causes my ActionForm to
> not
> > "see" the value of the specific input, and then
> > generate an error.
> >
> > 
> >
> > Leandro
> >
> >
> >
> >
> >
> >
>
___
> > Yahoo! Acesso Grátis - navegue de graça com
> conexão de qualidade! Acesse:
> http://br.acesso.yahoo.com/
> >
> >
>
-
> > To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> > For additional commands, e-mail:
> [EMAIL PROTECTED]
> >
> >
> 
>
-
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
>  

=






___
Yahoo! Acesso Grátis - navegue de graça com conexão de qualidade! Acesse: 
http://br.acesso.yahoo.com/

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



Problems on disabling inputs

2004-08-15 Thread Leandro Melo
Hi,
if i try to disable an input like this



i get something like this form the browser



which, i don't know why causes my ActionForm to not
"see" the value of the specific input, and then
generate an error.



Leandro





___
Yahoo! Acesso Grátis - navegue de graça com conexão de qualidade! Acesse: 
http://br.acesso.yahoo.com/

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



Overwritting RequestProcessor, how to???

2004-08-15 Thread Leandro Melo
Hi,
i'd like to overwirte RequestProcessor, but actually i
don't really know if it's a good idea.

Here's the point:
I'd like to have one more action if my form.validate()
method fails on ActionForm. I'd like to do some
specific stuff everytime the validate method fails.
Then, i thought of overwritting the RequestProcessor.

Is that a good idea, or there's another way to
accomplish what i want???

Regards,
ltcmelo





___
Yahoo! Acesso Grátis - navegue de graça com conexão de qualidade! Acesse: 
http://br.acesso.yahoo.com/

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



Re: Who calls the validate method ???

2004-08-13 Thread Leandro Melo
Rick,
as i said i really like your approach, but there are
some input pages that are really really simple, so
there's no need for doing this.
Then, in this cases, i'd like to call some other
method just after validate is called from Struts.
That's why i was wondering "who" calls it.


 --- Rick Reumann <[EMAIL PROTECTED]> escreveu: 
> Leandro Melo wrote:
> 
> > Hi,
> > could anyone tell me who calls the validate method
> of
> > the ActionForms?
> 
> I think "you" should:) I find it's often more
> beneficial to not rely on 
> Struts calling this validate() method and instead
> you should call this 
> manually.
> 
>  From my other post:
> 
>  - when validation fails and you are back on
> the initial form you 
> will not have access to the previous set request
> attributes. It is for 
> this reason that I now rarely ever set my mapping
> validate to "true" and 
> instead call validate() from my Action after the
> form submits. The 
> reason for this is when validation fails
> (ActionErrors/Messages return) 
> I can then call a private setUp() method in my
> Action that is used to 
> set up my form with any other request attributes
> that should always be 
> there.
> 
> For example, a common complaint is: "I have a List
> that I set up in 
> request scope that is used on the form for the user
> to select an item, 
> but when validation fails this List will not be
> there." To get around 
> this problem, simply call validate() manually in
> your action and if 
> errors return you can then call a setUp() method
> that will repopulate 
> what you need to be in the request, otherwise you
> just proceed on as normal.
> 
> 
> 
> -- 
> Rick
> 
>
-
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
>  

=






___
Yahoo! Acesso Grátis - navegue de graça com conexão de qualidade! Acesse: 
http://br.acesso.yahoo.com/

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



Re: Loosing request attributes

2004-08-13 Thread Leandro Melo
Vary nice Rick!
Interesting solution, i'll work on that!


 --- Rick Reumann <[EMAIL PROTECTED]> escreveu: 
> Leandro Melo wrote:
> 
> > Suppose a user submits a request that is handled
> by
> > MyActionDoSomething. Then this action sets a
> request
> > attribute like this:
> > 
> > request.setAttribute("MyObject", obj); 
> > 
> > and forwards the request to the page
> > myPageDoSomeOtherThing.jsp, wich has some inputs
> for
> > the user to fill in.
> 
> The problem you are describing comes up a lot on
> this list - when 
> validation fails and you are back on the initial
> form you will not have 
> access to the previous set request attributes. It is
> for this reason 
> that I now rarely ever set my mapping validate to
> "true" and instead 
> call validate() from my Action after the form
> submits. The reason for 
> this is when validation fails (ActionErrors/Messages
> return) I can then 
> call a private setUp() method in my Action that is
> used to set up my 
> form with any other request attributes that should
> always be there.
> 
> For example, a common complaint is: "I have a List
> that I set up in 
> request scope that is used on the form for the user
> to select an item, 
> but when validation fails this List will not be
> there." To get around 
> this problem, simply call validate() manually in
> your action and if 
> errors return you can then call a setUp() method
> that will repopulate 
> what you need to be in the request, otherwise you
> just proceed on as 
> normal.
> 
> -- 
> Rick
> 
>
-
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
>  

=






___
Yahoo! Acesso Grátis - navegue de graça com conexão de qualidade! Acesse: 
http://br.acesso.yahoo.com/

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



Who calls the validate method ???

2004-08-13 Thread Leandro Melo
Hi,
could anyone tell me who calls the validate method of
the ActionForms?

I thought it was ActionServlet, but it seems not be
it.

ltcmelo

=






___
Yahoo! Acesso Grátis - navegue de graça com conexão de qualidade! Acesse: 
http://br.acesso.yahoo.com/

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



Re: Loosing request attributes

2004-08-13 Thread Leandro Melo
Erik,
i'm not talking about form attributes, that's what i
said in my last e-mail.
I'll try to clear it out.
Suppose a user submits a request that is handled by
MyActionDoSomething. Then this action sets a request
attribute like this:

request.setAttribute("MyObject", obj); 

and forwards the request to the page
myPageDoSomeOtherThing.jsp, wich has some inputs for
the user to fill in.
This page (myPageDoSomeOtherThing.jsp) uses the bean
"obj" that was set in MyActionDoSomething.java ok !?

Now suppose the user submits wrong information in
myPageDoSomeOtherThing.jsp, what will cause the
validate method in the associated ActionForm to return
some ActionErrors. BUT when the ActionForm send this
page back for the user to re-input data, the bean
"obj" that was set at the very beginning in
MyActionDoSomething.java is NOT present anymore!

I think now it's clear that i'm not talking about the
formBean attributes, right !? 








 --- Erik Weber <[EMAIL PROTECTED]> escreveu: 
> You shouldn't have to do anything (in general, you
> rarely need to 
> implement reset) special for this. Struts does this
> for you. The user 
> submits the form. The form bean is populated with
> the user's input. 
> Validation starts on the form bean. Validation
> fails. Struts forwards 
> back to the input page, and the struts tags render
> all the values that 
> the user had input using the populated form bean.
> 
> Could you describe in more detail which types of
> form values seem to be 
> "missing" and which ones are intact? Is there a
> pattern to it?
> 
> Erik
> 
> 
> 
> Leandro Melo wrote:
> 
> >I don`t want to reset the attributes of my
> ActionForm
> >(what a form.reset() would do), BUT the attributes
> of
> >the request the were probably set by the Action
> that
> >forwarded to the specific page.
> >
> >So i need them back in that page if validate fails.
> >
> >
> > --- Robert Taylor <[EMAIL PROTECTED]> escreveu:
> 
> >  
> >
> >>form.reset();
> >>
> >>robert
> >>
> >>
> >>
> >>>-Original Message-
> >>>From: Leandro Melo
> >>>  
> >>>
> >>[mailto:[EMAIL PROTECTED]
> >>
> >>
> >>>Sent: Friday, August 13, 2004 11:20 AM
> >>>To: Struts Users Mailing List
> >>>Subject: Re: Loosing request attributes
> >>>
> >>>
> >>>I was taking a look at the HttpServeltRequest and
> >>>ServletRequest apis and noted that theres a
> method
> >>>"getParameterMap()" wich returns a map of the
> >>>parameters, BUT there isn`t such a
> >>>  
> >>>
> >>"setParameterMap()"
> >>
> >>
> >>>method.
> >>>
> >>>So, what`s an automated way to re-set all my
> >>>  
> >>>
> >>request
> >>
> >>
> >>>parameters in the ActionForm??? Do i have to go
> >>>  
> >>>
> >>one by
> >>
> >>
> >>>one for each ActionForm :-( ???
> >>>
> >>>
> >>> --- "Ruth, Brice" <[EMAIL PROTECTED]> escreveu:
> >>>  
> >>>
> >>>>Ensure that the request attributes are set in
> >>>>
> >>>>
> >>the
> >>
> >>
> >>>>ActionForm, this is
> >>>>the only way that you can ensure that they'll
> >>>>
> >>>>
> >>still
> >>
> >>
> >>>>be there when the
> >>>>validate fails.
> >>>>
> >>>>Leandro Melo wrote:
> >>>>
> >>>>
> >>>>
> >>>>>Hi,
> >>>>>when a user request hits the ActionForm's
> >>>>>  
> >>>>>
> >>validate
> >>
> >>
> >>>>>method and bounces back, i'm loosing some
> >>>>>  
> >>>>>
> >>request
> >>
> >>
> >>>>>attributes that i had set for the page. In
> >>>>>  
> >>>>>
> >>other
> >>
> >>
> >>>>>words, if the user inputs some data that don't
> >>>>>  
> >>>>>
> >>pass
>

Re: Losing request attributes

2004-08-13 Thread Leandro Melo
Denis, that's not the point of our discussion. One
more time: I'm not talking about formBean attributes.

Anyway, Hubert pointed a workaroung for my problem.

Thanks.


 --- Denis Avdic <[EMAIL PROTECTED]> escreveu: 
> In order to keep the actual entries that the user
> typed in (so they
> don't have to retype everything if they changed a
> bunch of things) I
> usually put the entire form and errors into request
> if there are
> errors.
> 
> Then you need to make sure that your  populate
> action checks for
> presence of the form in request and overrides the DB
> entries with the
> ones in the form.
> 
> On Fri, 13 Aug 2004 15:23:47 -0300 (ART), Leandro
> Melo
> <[EMAIL PROTECTED]> wrote:
> > Hubert,
> > i think that's actually the only solution.
> > Thanks.
> > 
> > 
> > 
> > 
> > > You can point the "input" to an action which
> will
> > > populate the request with
> > > the attribute(s) you need, and then forwards to
> your
> > > form.
> > >
> > > --- Hubert Rabago <[EMAIL PROTECTED]> wrote:
> > >
> > > > This is because when the user submits the
> form,
> > > that already starts a
> > > > different request, so the request attributes
> are
> > > no longer there.
> > > > In your mapping for the action where the form
> gets
> > > submitted to, where does
> > > > the input attribute point to?
> > > >
> > > > Hubert
> > > >
> > > > --- Leandro Melo <[EMAIL PROTECTED]>
> > > wrote:
> > > >
> > > > > As i replied many times for this topic, i'd
> like
> > > to
> > > > > expose the situation again and in DETAILS.
> > > > >
> > > > > Suppose a user submits a request that is
> handled
> > > by
> > > > > MyActionDoSomething. Then this action sets a
> > > request
> > > > > attribute like this:
> > > > >
> > > > > request.setAttribute("MyObject", obj);
> > > > >
> > > > > and forwards the request to the page
> > > > > myPageDoSomeOtherThing.jsp, wich has some
> inputs
> > > for
> > > > > the user to fill in.
> > > > > This page (myPageDoSomeOtherThing.jsp) uses
> the
> > > bean
> > > > > "obj" that was set in
> MyActionDoSomething.java
> > > ok !?
> > > > >
> > > > > Now suppose the user submits wrong
> information
> > > in
> > > > > myPageDoSomeOtherThing.jsp, what will cause
> the
> > > > > validate method in the associated ActionForm
> to
> > > return
> > > > > some ActionErrors. BUT when the ActionForm
> send
> > > this
> > > > > page back for the user to re-input data, the
> > > bean
> > > > > "obj" that was set at the very beginning in
> > > > > MyActionDoSomething.java is NOT present
> anymore!
> > > > >
> > > > > I think now it's clear that i'm not talking
> > > about the
> > > > > formBean attributes, right !?
> > > > >
> > >
> > >
> > >
> __
> > > Do You Yahoo!?
> > > Tired of spam?  Yahoo! Mail has the best spam
> > > protection around
> > > http://mail.yahoo.com
> > >
> > >
> >
>
-
> > > To unsubscribe, e-mail:
> > > [EMAIL PROTECTED]
> > > For additional commands, e-mail:
> > > [EMAIL PROTECTED]
> > >
> > >
> > 
> > =
> > 
> > 
> >
>
___
> > Yahoo! Acesso Grátis - navegue de graça com
> conexão de qualidade! Acesse:
> http://br.acesso.yahoo.com/
> > 
> > 
> > 
> >
>
-
> > To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> > For additional commands, e-mail:
> [EMAIL PROTECTED]
> > 
> >
> 
>
-
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
>  

=






___
Yahoo! Acesso Grátis - navegue de graça com conexão de qualidade! Acesse: 
http://br.acesso.yahoo.com/

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



RE: Losing request attributes

2004-08-13 Thread Leandro Melo
Hubert, 
i think that's actually the only solution.
Thanks.

 
> You can point the "input" to an action which will
> populate the request with
> the attribute(s) you need, and then forwards to your
> form.
> 
> --- Hubert Rabago <[EMAIL PROTECTED]> wrote:
> 
> > This is because when the user submits the form,
> that already starts a
> > different request, so the request attributes are
> no longer there.
> > In your mapping for the action where the form gets
> submitted to, where does
> > the input attribute point to?
> > 
> > Hubert
> > 
> > --- Leandro Melo <[EMAIL PROTECTED]>
> wrote:
> > 
> > > As i replied many times for this topic, i'd like
> to
> > > expose the situation again and in DETAILS.
> > > 
> > > Suppose a user submits a request that is handled
> by
> > > MyActionDoSomething. Then this action sets a
> request
> > > attribute like this:
> > > 
> > > request.setAttribute("MyObject", obj); 
> > > 
> > > and forwards the request to the page
> > > myPageDoSomeOtherThing.jsp, wich has some inputs
> for
> > > the user to fill in.
> > > This page (myPageDoSomeOtherThing.jsp) uses the
> bean
> > > "obj" that was set in MyActionDoSomething.java
> ok !?
> > > 
> > > Now suppose the user submits wrong information
> in
> > > myPageDoSomeOtherThing.jsp, what will cause the
> > > validate method in the associated ActionForm to
> return
> > > some ActionErrors. BUT when the ActionForm send
> this
> > > page back for the user to re-input data, the
> bean
> > > "obj" that was set at the very beginning in
> > > MyActionDoSomething.java is NOT present anymore!
> > > 
> > > I think now it's clear that i'm not talking
> about the
> > > formBean attributes, right !? 
> > > 
> 
> 
> __
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam
> protection around 
> http://mail.yahoo.com 
> 
>
-
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
>  

=






___
Yahoo! Acesso Grátis - navegue de graça com conexão de qualidade! Acesse: 
http://br.acesso.yahoo.com/

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



RE: Loosing request attributes

2004-08-13 Thread Leandro Melo
As i replied many times for this topic, i'd like to
expose the situation again and in DETAILS.

Suppose a user submits a request that is handled by
MyActionDoSomething. Then this action sets a request
attribute like this:

request.setAttribute("MyObject", obj); 

and forwards the request to the page
myPageDoSomeOtherThing.jsp, wich has some inputs for
the user to fill in.
This page (myPageDoSomeOtherThing.jsp) uses the bean
"obj" that was set in MyActionDoSomething.java ok !?

Now suppose the user submits wrong information in
myPageDoSomeOtherThing.jsp, what will cause the
validate method in the associated ActionForm to return
some ActionErrors. BUT when the ActionForm send this
page back for the user to re-input data, the bean
"obj" that was set at the very beginning in
MyActionDoSomething.java is NOT present anymore!

I think now it's clear that i'm not talking about the
formBean attributes, right !? 




 --- Jim Barrows <[EMAIL PROTECTED]> escreveu: 
> 
> 
> > -Original Message-
> > From: Leandro Melo
> [mailto:[EMAIL PROTECTED]
> > Sent: Friday, August 13, 2004 10:50 AM
> > To: Struts Users Mailing List
> > Subject: RE: Loosing request attributes
> > 
> > 
> > No i'm not Kataria. Is this the default option???
> > Actually, i checked it out in some bibliography
> and it
> > seems that redirect is not even a valid attribute
> for
> > action mappings :-| ??
> 
> Missing, as in the when the screen gets re-rendered
> they're missing or the data is missing?
> If the data is missing are you using primitives
> in your action form or Strings?  If you're using
> primitives then of course your data is misssing. 
> See archives and documentation for why.
> 
> 
> > 
> > 
> >  --- "Kataria, Satish" <[EMAIL PROTECTED]>
> > escreveu: 
> > > Ru using redirect="true" in ur action mapping.
> If so
> > > then changing it to false will solve the
> problem.
> > > 
> > > Thanx,
> > > Satish Kataria
> > > 
> > > -Original Message-
> > > From: Leandro Melo
> > > [mailto:[EMAIL PROTECTED] 
> > > Sent: Friday, August 13, 2004 7:39 AM
> > > To: struts jakarta
> > > Subject: Loosing request attributes
> > > 
> > > 
> > > Hi,
> > > when a user request hits the ActionForm's
> validate
> > > method and bounces back, i'm loosing some
> request
> > > attributes that i had set for the page. In other
> > > words, if the user inputs some data that don't
> pass
> > > the validate method,
> > > the page comes back with a few request scope
> > > attributes missing.
> > > 
> > > Is there a way to avoid that this happens?
> > > 
> > > =
> > > _
> > > Leandro Terra C. Melo
> > > Eng. de Controle e Automação - UFMG
> > > 
> > > 
> > >   
> > >   
> > >   
> > >
> >
>
___
> > > Yahoo! Acesso Grátis - navegue de graça com
> conexão
> > > de qualidade! Acesse:
> http://br.acesso.yahoo.com/
> > > 
> > >
> >
>
-
> > > To unsubscribe, e-mail:
> > > [EMAIL PROTECTED]
> > > For additional commands, e-mail:
> > > [EMAIL PROTECTED]
> > > 
> > >
> >
>
-
> > > To unsubscribe, e-mail:
> > > [EMAIL PROTECTED]
> > > For additional commands, e-mail:
> > > [EMAIL PROTECTED]
> > > 
> > >  
> > 
> > =
> > 
> > 
> > __
> > Do You Yahoo!?
> > Tired of spam?  Yahoo! Mail has the best spam
> protection around 
> > http://mail.yahoo.com 
> > 
> >
>
-
> > To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> > For additional commands, e-mail:
> [EMAIL PROTECTED]
> > 
> > 
> 
>
-
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
>  

=






___
Yahoo! Acesso Grátis - navegue de graça com conexão de qualidade! Acesse: 
http://br.acesso.yahoo.com/

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



RE: Loosing request attributes

2004-08-13 Thread Leandro Melo
Sorry Kataria,
the redirect attribute is inside the forward tag. My
fault.
Any way, i'm not using and as i understand the default
is false.


 --- Leandro Melo <[EMAIL PROTECTED]>
escreveu: 
> No i'm not Kataria. Is this the default option???
> Actually, i checked it out in some bibliography and
> it
> seems that redirect is not even a valid attribute
> for
> action mappings :-| ??
> 
> 
>  --- "Kataria, Satish" <[EMAIL PROTECTED]>
> escreveu: 
> > Ru using redirect="true" in ur action mapping. If
> so
> > then changing it to false will solve the problem.
> > 
> > Thanx,
> > Satish Kataria
> > 
> > -Original Message-
> > From: Leandro Melo
> > [mailto:[EMAIL PROTECTED] 
> > Sent: Friday, August 13, 2004 7:39 AM
> > To: struts jakarta
> > Subject: Loosing request attributes
> > 
> > 
> > Hi,
> > when a user request hits the ActionForm's validate
> > method and bounces back, i'm loosing some request
> > attributes that i had set for the page. In other
> > words, if the user inputs some data that don't
> pass
> > the validate method,
> > the page comes back with a few request scope
> > attributes missing.
> > 
> > Is there a way to avoid that this happens?
> > 
> > =
> > _
> > Leandro Terra C. Melo
> > Eng. de Controle e Automação - UFMG
> > 
> > 
> > 
> > 
> > 
> >
>
___
> > Yahoo! Acesso Grátis - navegue de graça com
> conexão
> > de qualidade! Acesse: http://br.acesso.yahoo.com/
> > 
> >
>
-
> > To unsubscribe, e-mail:
> > [EMAIL PROTECTED]
> > For additional commands, e-mail:
> > [EMAIL PROTECTED]
> > 
> >
>
-
> > To unsubscribe, e-mail:
> > [EMAIL PROTECTED]
> > For additional commands, e-mail:
> > [EMAIL PROTECTED]
> > 
> >  
> 
> =
> 
> 
> __
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam
> protection around 
> http://mail.yahoo.com 
> 
>
-
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
>  

=


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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



RE: Loosing request attributes

2004-08-13 Thread Leandro Melo
No i'm not Kataria. Is this the default option???
Actually, i checked it out in some bibliography and it
seems that redirect is not even a valid attribute for
action mappings :-| ??


 --- "Kataria, Satish" <[EMAIL PROTECTED]>
escreveu: 
> Ru using redirect="true" in ur action mapping. If so
> then changing it to false will solve the problem.
> 
> Thanx,
> Satish Kataria
> 
> -Original Message-
> From: Leandro Melo
> [mailto:[EMAIL PROTECTED] 
> Sent: Friday, August 13, 2004 7:39 AM
> To: struts jakarta
> Subject: Loosing request attributes
> 
> 
> Hi,
> when a user request hits the ActionForm's validate
> method and bounces back, i'm loosing some request
> attributes that i had set for the page. In other
> words, if the user inputs some data that don't pass
> the validate method,
> the page comes back with a few request scope
> attributes missing.
> 
> Is there a way to avoid that this happens?
> 
> =
> _
> Leandro Terra C. Melo
> Eng. de Controle e Automação - UFMG
> 
> 
>   
>   
>   
>
___
> Yahoo! Acesso Grátis - navegue de graça com conexão
> de qualidade! Acesse: http://br.acesso.yahoo.com/
> 
>
-
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
>
-
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
>  

=


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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



RE: Loosing request attributes

2004-08-13 Thread Leandro Melo
I don`t want to reset the attributes of my ActionForm
(what a form.reset() would do), BUT the attributes of
the request the were probably set by the Action that
forwarded to the specific page.

So i need them back in that page if validate fails.


 --- Robert Taylor <[EMAIL PROTECTED]> escreveu: 
> form.reset();
> 
> robert
> 
> > -Original Message-
> > From: Leandro Melo
> [mailto:[EMAIL PROTECTED]
> > Sent: Friday, August 13, 2004 11:20 AM
> > To: Struts Users Mailing List
> > Subject: Re: Loosing request attributes
> >
> >
> > I was taking a look at the HttpServeltRequest and
> > ServletRequest apis and noted that theres a method
> > "getParameterMap()" wich returns a map of the
> > parameters, BUT there isn`t such a
> "setParameterMap()"
> > method.
> >
> > So, what`s an automated way to re-set all my
> request
> > parameters in the ActionForm??? Do i have to go
> one by
> > one for each ActionForm :-( ???
> >
> >
> >  --- "Ruth, Brice" <[EMAIL PROTECTED]> escreveu:
> > > Ensure that the request attributes are set in
> the
> > > ActionForm, this is
> > > the only way that you can ensure that they'll
> still
> > > be there when the
> > > validate fails.
> > >
> > > Leandro Melo wrote:
> > >
> > > >Hi,
> > > >when a user request hits the ActionForm's
> validate
> > > >method and bounces back, i'm loosing some
> request
> > > >attributes that i had set for the page. In
> other
> > > >words, if the user inputs some data that don't
> pass
> > > >the validate method,
> > > >the page comes back with a few request scope
> > > >attributes missing.
> > > >
> > > >Is there a way to avoid that this happens?
> > > >
> > > >=
> > > >_
> > > >Leandro Terra C. Melo
> > > >Eng. de Controle e Automação - UFMG
> > > >
> > > >
> > > >
> > > >
> > > >
> > >
> >
>
>___
> > > >Yahoo! Acesso Grátis - navegue de graça com
> conexão
> > > de qualidade! Acesse:
> http://br.acesso.yahoo.com/
> > > >
> > >
> >
>
>-
> > > >To unsubscribe, e-mail:
> > > [EMAIL PROTECTED]
> > > >For additional commands, e-mail:
> > > [EMAIL PROTECTED]
> > > >
> > > >
> > > >
> > >
> > > --
> > > Brice Ruth, Sr. IT Analyst
> > > Fiskars Brands Inc
> > > http://www.fiskarsbrands.com/
> > >
> > >
> > >
> >
>
-
> > > To unsubscribe, e-mail:
> > > [EMAIL PROTECTED]
> > > For additional commands, e-mail:
> > > [EMAIL PROTECTED]
> > >
> > >
> >
> > =
> >
> >
> >
> >
> >
> >
> >
>
___
> > Yahoo! Acesso Grátis - navegue de graça com
> conexão de qualidade! Acesse:
> http://br.acesso.yahoo.com/
> >
> >
>
-
> > To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> > For additional commands, e-mail:
> [EMAIL PROTECTED]
> >
> 
> 
>
-
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
>  

=






___
Yahoo! Acesso Grátis - navegue de graça com conexão de qualidade! Acesse: 
http://br.acesso.yahoo.com/

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



Re: Loosing request attributes

2004-08-13 Thread Leandro Melo
I was taking a look at the HttpServeltRequest and
ServletRequest apis and noted that theres a method
"getParameterMap()" wich returns a map of the
parameters, BUT there isn`t such a "setParameterMap()"
method.

So, what`s an automated way to re-set all my request
parameters in the ActionForm??? Do i have to go one by
one for each ActionForm :-( ???


 --- "Ruth, Brice" <[EMAIL PROTECTED]> escreveu: 
> Ensure that the request attributes are set in the
> ActionForm, this is 
> the only way that you can ensure that they'll still
> be there when the 
> validate fails.
> 
> Leandro Melo wrote:
> 
> >Hi,
> >when a user request hits the ActionForm's validate
> >method and bounces back, i'm loosing some request
> >attributes that i had set for the page. In other
> >words, if the user inputs some data that don't pass
> >the validate method,
> >the page comes back with a few request scope
> >attributes missing.
> >
> >Is there a way to avoid that this happens?
> >
> >=
> >_
> >Leandro Terra C. Melo
> >Eng. de Controle e Automação - UFMG
> >
> >
> > 
> > 
> > 
>
>___
> >Yahoo! Acesso Grátis - navegue de graça com conexão
> de qualidade! Acesse: http://br.acesso.yahoo.com/
> >
>
>-
> >To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> >For additional commands, e-mail:
> [EMAIL PROTECTED]
> >
> >  
> >
> 
> -- 
> Brice Ruth, Sr. IT Analyst
> Fiskars Brands Inc
> http://www.fiskarsbrands.com/
> 
> 
>
-
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
>  

=






___
Yahoo! Acesso Grátis - navegue de graça com conexão de qualidade! Acesse: 
http://br.acesso.yahoo.com/

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



A character decoding problem

2004-08-12 Thread Leandro Melo
Hi,
i got a weird thing happening. Actually it's not that
weird, it has very sense, but anyway, i would like to
avoid that.

Ther word "you" in portuguese is "você".
I got some error messages like that.

error.invalid.name=Vocç deve digitar o nome.

What in english would be

error.invalid.name=You should input your name.

I'm using, as Jim, the following block to catch my
errors.


  


When i get the error a described above, here is what
the browse page displays:

 Você deve especificar o nome fantasia.

and what i really wanted for it display was:

 Você deve especificar o nome fantasia.

If i take a look at the page's source code via
browser, here's the source for that line.

Você deve especificar o nome fantasia.

As you, it's not what i expected. How can i avoid
Struts "decoding" my characters???



__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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



Loosing request attributes

2004-08-12 Thread Leandro Melo
Hi,
when a user request hits the ActionForm's validate
method and bounces back, i'm loosing some request
attributes that i had set for the page. In other
words, if the user inputs some data that don't pass
the validate method,
the page comes back with a few request scope
attributes missing.

Is there a way to avoid that this happens?

=
_
Leandro Terra C. Melo
Eng. de Controle e Automação - UFMG





___
Yahoo! Acesso Grátis - navegue de graça com conexão de qualidade! Acesse: 
http://br.acesso.yahoo.com/

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



Re: Importing Struts context

2004-08-12 Thread Leandro Melo
Worked perfectly Jim!
Thanks,
ltcmelo


> Try this instead of html:errors:
> 
> 
> 
>   
> 
> 
> 
> 
> If that works then you can mangle the html however
> you want of course.


=
_
Leandro Terra C. Melo
Eng. de Controle e Automação - UFMG

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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



Re: Multiple image tags

2004-08-12 Thread Leandro Melo
LOL!!!
You wouldn't believe if i tell you that it was what i
first thought!
I speak portuguese (from Brazil).

ltcmelo

 --- Michael McGrady <[EMAIL PROTECTED]>
escreveu: 
> Leandro Melo wrote:
> 
> >Allright!
> >Actually, my first languages "are" c++ and pascal.
> >Why did you ask anyway!?
> >
> >Thanks again,
> >ltcmelo
> >
> >  
> >
> 
> LOL  I meant your SPOKEN or READING language,
> Leandro, not your computer 
> language.
> 
> Michael
> 
> 
>
-
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
>  





___
Yahoo! Acesso Grátis - navegue de graça com conexão de qualidade! Acesse: 
http://br.acesso.yahoo.com/

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



Re: Multiple image tags

2004-08-12 Thread Leandro Melo
Allright!
Actually, my first languages "are" c++ and pascal.
Why did you ask anyway!?

Thanks again,
ltcmelo


> ATTACHMENT part 9 message/rfc822 
> Data: Wed, 11 Aug 2004 14:17:11 -0700
> Para: "Struts Users Mailing List"
> <[EMAIL PROTECTED]>
> De: Michael McGrady <[EMAIL PROTECTED]>
> Assunto: Re: Multiple image tags
> 
> You got it, Leandro.
> 
> You end up doing with this solution what the
> LookupDispatchAction does with 
> less overhead, less of a footprint, and without all
> the coupling to the 
> framework.  I put the solution on the Struts wiki,
> and a pretty good 
> programmer actually suggested using this solution
> and adding it to 
> LookupDispatchAction.  That really confounded me.
> 
> What's your first language?  Don't say Java!  LOL
> 
> Michael
> 
> At 01:46 PM 8/11/2004, you wrote:
> >Michael,
> >i think i understand your point now!
> >If my english let get the point correctly, i
> realized
> >that if i have an ordinary Action, and have such
> >method that finds out what was the value of the
> image
> >tag (using your getCommand function) and delegate
> >(probably with an "if") the processing of the
> request
> >to the responsible method, i'll end up doing just
> what
> >DispatchAction and LookupDispatchAction does. This
> way
> >your solution certainly works perfectly.
> >Is that it?
> >
> >Thank you again,
> >ltcmelo
> >
> >
> > > Let me try again on this, Leandro, as much for
> > > myself as for you.  The
> > > LookupDIspatchAction, which I don't care for,
> only
> > > gives you one thing: a
> > > promise that the page author will have to use a
> > > particular name for the
> > > parameter name to be used in the Action for
> deciding
> > > which method to
> > > use.  That is it.  So, somehow the page author
> has
> > > to provide a value for
> > > the parameter name you specify in your
> > > LookupDispatchAction action mapping
> > > xml parameter attribute.  Thus, if you use
> > > parameter='method' in your
> > > action mapping xml, then you can know that using
> > > 'method' in your "hidden"
> > > values in the form will work.  You can also
> know, of
> > > course, that you then
> > > MUST use the request parameter 'method' in your
> > > form.  You can do the same
> > > thing without giving the parameter attribute of
> your
> > > action mapping any
> > > value at all.  You merely have to coordinate the
> > > page hidden parameter name
> > > and the parameter name mined in the Action.  The
> use
> > > of the parameter
> > > attribute in the action mapping MERELY forces
> the
> > > page author to conform to
> > > your requirements in the Action class, which
> then
> > > becomes the
> > > DispatchAction class or LookupDispatchActino
> class.
> > >
> > > The whole point of using an image tag solution
> is to
> > > (1) get out of a
> > > Struts specific solution to this "age old"
> problem
> > > and to (2) provide a
> > > solution to the need to make a switch in the
> > > processing of an action.  The
> > > ".x" and ".y" in the parameter names of an image
> tag
> > > operate just like the
> > > parameter attribute of the action mapping for
> the
> > > LookupDispatchAction and
> > > DispatchAction.  The difference is that it is
> not
> > > Struts specific and is a
> > > "worldwide" standard.  The code which follows,
> viz.
> > >
> > > public final class ButtonCommand {
> > >private ButtonCommand() {
> > >}
> > >public final static String
> > > getCommand(HttpServletRequest request) {
> > >  Enumeration enum =
> request.getParameterNames();
> > >  String parameterName = null;
> > >  while(enum.hasMoreElements()) {
> > >parameterName =
> (String)enum.nextElement();
> > >if(parameterName.endsWith(".x")) {
> > >  return
> > >
>
>parameterName.substring(0,parameterName.indexOf('.'));
> > >}
> > >  }
> > >  return parameterName;
> > >}
> > > }
> > >
> > > simply does this using image tags instead of
> hidden
> > > parameters in the
> > > form.  You can, of course, just copy the method
> > > getCommand into your
> > > processing helper classes in the model.
> > >
> > > Does this ring any bells?
> > >
> > > Michael McGrady
> > >
> > > At 08:09 PM 8/10/2004, you wrote:
> > > >The problem is that both solutions in a higher
> > > level
> > > >focus on getting the parameter and checking it
> out
> > > to
> > > >see its value.
> > > >
> > > >In my case, i got a MyLookupDispatchAction that
> > > >receives all the requests and forwards it to
> the
> > > >specific method. So, there's no meanwhile to
> get
> > > the
> > > >request parameter, check it out and forward to
> some
> > > >method.
> > > >
> > > >UNLESS,
> > > >i use someking of hidden field in the form with
> a
> > > name
> > > >that MyLookupDispatchAction expects:
> > > >
> > > >protected Map getKeyMethodMap(){
> > > >Map map = new HashMap();
> > > >map.put("hidden.field",
> > > "verifyParameterMethod");
> > > >}
> > > >
> > > >And the in the "verifyParameterMethod()",

Re: Importing context with Struts

2004-08-11 Thread Leandro Melo
Jim,
as i said i have a page with only one line of code,
wich is the error page.
It only has this:



Suppose now we want to register a company in the
application, i got then an form with all the necessary
inputs in a page registercompanycustominforeq.jsp.
Here's the page for registering.


  <%@ include
file="/functionalBlocks/companyHTMLcomponent.jsf" %>


The user sees the following definition when he's
filling the company info.

  
  
  


If your remember, the base class ".PartyPlace" has
already inserts the error page.

I don't know what you meant about "WHat scope are
your errors beign put in?". How do i find out that?

The only thing i know is if the user request is
blocked in validation, my html:errors tag doesn't show
anything.
BUT, if i place the html:errors tag inside the page
with the registercompanycustominfo action, it works
fine.
In other words, if i modify my
registercompanycustominforeq.jsp to this:

  
  <%@ include
file="/functionalBlocks/companyHTMLcomponent.jsf" %>


Everything works!!! The errors tag works.



> OKay... I have the exact same setup, and validation
> works just fine with this setup.  The one thing I'm
> not doing is the ${name} that you are, but that
> shouldn't make a difference at all.  WHat scope are
> your errors beign put in?  That could be an issue.
> 
> Here's my base layout:
>  path="/layout/layout2.jsp">
>  />
>
> 
>   
> 
> 
>   
>value="/showPaymentHistory.do?detail=summary"/>
>   
>   
>   
>   
> 
>   
>
>
>   
>   
>   
>   
>   
> 
> 
> 
> > 
> > Here's the simple
> > /functionalBlocks/errorHTMLcomponent.jsp page:
> > <%@ taglib uri="/WEB-INF/struts-html.tld"
> > prefix="html"%> 
> >   
> > 
> > 
> > I have a page for registering company data, wich
> is
> > part of the following definition:
> > > name=".PartyPlace.RegisterCompanyCustomInfoReq"
> > extends=".PartyPlaceSideBar">
> >  >
> value="/register/registercompanycustominforeq.jsp"/>
> >  >
>
value="/pageComments/registercompanycustominforeq_PAGECOMMENT.jsp"/>
> >  >
>
value="/functionalSideBars/registercompany_SideBar.jsp"/>
> >
> > 
> > 
> > The registercompanycustominforeq.jsp page is the
> > following one:
> > 
> > <%@ include
> > file="/functionalBlocks/companyHTMLcomponent.jsf"
> %>
> > <%@ include
> > file="/functionalBlocks/buttonsHTMLcomponent.jsf"
> %>
> > 
> > 
> > 
> > 
> > NOTE that the tag html:errors is not in
> > registercompanycustominforeq.jsp page, it's in the
> > errorHTMLcomponent.jsp page (as i showed).
> > When i submit a request the hits the validate
> method,
> > it comes back, but i cannot see the error because
> the
> > html:errors tag is in another page.
> > That's why i wanted to import the Struts
> context...
> > However, if there's a Tiles way to workaround
> that,
> > please, would you explain it to me?
> > Maybe with some code... 
> > 
> > Thank you very much,
> > ltcmelo
> > 
> > 
> > 
> > 
> > 
> > > > -Original Message-
> > > > From: Michael McGrady
> > > [mailto:[EMAIL PROTECTED]
> > > > Sent: Tuesday, August 10, 2004 3:51 PM
> > > > To: Struts Users Mailing List
> > > > Subject: RE: Importing context with Struts
> > > > 
> > > > 
> > > > I thought that digester actually created
> classes
> > > out of this 
> > > > stuff, Jim.  No?
> > > 
> > > Not quite the defintiion file gets turned
> into
> > > one java bean per definition.  These java beans
> are
> > > then used to pull the parts together for the
> tags (
> > > paraphrased from SIA Chap 11.1 pg 324).
> > > Since all jsp files are converted to a servlet
> > > first, then compiled, I would tend to say that
> all
> > > the jsps being declared in a tile definition
> being
> > > in the same class couldn't happen... however I
> can't
> > > seem to find out where websphere puts it's
> working
> > > stuff *SIGH* to verify this I can't say for
> sure.
> > > 
> > > However, after digging through the tiles code I
> came
> > > across this:
> > >
> >
>
http://cvs.apache.org/viewcvs.cgi/jakarta-struts/src/share/org
> >
>
/apache/struts/tiles/TilesUtilImpl.java?rev=1.9&view=markup
> > > The part that answers the question:
> > >  public void doInclude(
> > > String uri,
> > > HttpServletRequest request,
> > > HttpServletResponse response,
> > > ServletContext servletContext)
> > > throws IOException, ServletException {
> > > 
> > >
> > >
> request.getRequestDispatcher(uri).include(request,
> > > response);
> > > }
> > > Which means no. all those jsp files are
> _NOT_
> > > compiled into one big huge class. they are
> > > individual servlets in keeping with the spec.
> > > 
> > > 
> > > > 
> > > > At 03:23 PM 8/10/2004, you wrote:
> > > > 
>

Re: Multiple image tags

2004-08-11 Thread Leandro Melo
Michael,
i think i understand your point now!
If my english let get the point correctly, i realized
that if i have an ordinary Action, and have such
method that finds out what was the value of the image
tag (using your getCommand function) and delegate
(probably with an "if") the processing of the request
to the responsible method, i'll end up doing just what
DispatchAction and LookupDispatchAction does. This way
your solution certainly works perfectly.
Is that it?

Thank you again,
ltcmelo

 
> Let me try again on this, Leandro, as much for
> myself as for you.  The 
> LookupDIspatchAction, which I don't care for, only
> gives you one thing: a 
> promise that the page author will have to use a
> particular name for the 
> parameter name to be used in the Action for deciding
> which method to 
> use.  That is it.  So, somehow the page author has
> to provide a value for 
> the parameter name you specify in your
> LookupDispatchAction action mapping 
> xml parameter attribute.  Thus, if you use
> parameter='method' in your 
> action mapping xml, then you can know that using
> 'method' in your "hidden" 
> values in the form will work.  You can also know, of
> course, that you then 
> MUST use the request parameter 'method' in your
> form.  You can do the same 
> thing without giving the parameter attribute of your
> action mapping any 
> value at all.  You merely have to coordinate the
> page hidden parameter name 
> and the parameter name mined in the Action.  The use
> of the parameter 
> attribute in the action mapping MERELY forces the
> page author to conform to 
> your requirements in the Action class, which then
> becomes the 
> DispatchAction class or LookupDispatchActino class.
> 
> The whole point of using an image tag solution is to
> (1) get out of a 
> Struts specific solution to this "age old" problem
> and to (2) provide a 
> solution to the need to make a switch in the
> processing of an action.  The 
> ".x" and ".y" in the parameter names of an image tag
> operate just like the 
> parameter attribute of the action mapping for the
> LookupDispatchAction and 
> DispatchAction.  The difference is that it is not
> Struts specific and is a 
> "worldwide" standard.  The code which follows, viz.
> 
> public final class ButtonCommand {
>private ButtonCommand() {
>}
>public final static String
> getCommand(HttpServletRequest request) {
>  Enumeration enum = request.getParameterNames();
>  String parameterName = null;
>  while(enum.hasMoreElements()) {
>parameterName = (String)enum.nextElement();
>if(parameterName.endsWith(".x")) {
>  return
>
parameterName.substring(0,parameterName.indexOf('.'));
>}
>  }
>  return parameterName;
>}
> }
> 
> simply does this using image tags instead of hidden
> parameters in the 
> form.  You can, of course, just copy the method
> getCommand into your 
> processing helper classes in the model.
> 
> Does this ring any bells?
> 
> Michael McGrady
> 
> At 08:09 PM 8/10/2004, you wrote:
> >The problem is that both solutions in a higher
> level
> >focus on getting the parameter and checking it out
> to
> >see its value.
> >
> >In my case, i got a MyLookupDispatchAction that
> >receives all the requests and forwards it to the
> >specific method. So, there's no meanwhile to get
> the
> >request parameter, check it out and forward to some
> >method.
> >
> >UNLESS,
> >i use someking of hidden field in the form with a
> name
> >that MyLookupDispatchAction expects:
> >
> >protected Map getKeyMethodMap(){
> >Map map = new HashMap();
> >map.put("hidden.field",
> "verifyParameterMethod");
> >}
> >
> >And the in the "verifyParameterMethod()", i'd use
> call
> >
> >"getCommand(HttpServletRequest request)" to check
> what
> >was the value of the real parameter i want (the one
> >from the image tag). Finally, i would compare this
> >value and forward the data to the responsible
> method.
> >Am i correct?
> >
> >
> >It just seems a little confusing...






___
Yahoo! Acesso Grátis - navegue de graça com conexão de qualidade! Acesse: 
http://br.acesso.yahoo.com/

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



Re: Importing context with Struts

2004-08-10 Thread Leandro Melo
p"/>
> > > 
> > > 
> > >
> >
>
>-
> > >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]
> > 
> > 
> 

> ATTACHMENT part 15 message/rfc822 
> Para: [EMAIL PROTECTED]
> De: Vic Cekvenich <[EMAIL PROTECTED]>
> Assunto: Re: Importing context with Struts
> Data: Tue, 10 Aug 2004 19:51:38 -0500
> 
> You can get very dynamic w/ tiles, and use
> tilesaction for each tilee 
> and put in scope what the tiles defnitions need to
> render, so each 
> request is dynamycaly assembled.
> Rember that you can use tiles-el or el anywhere in
> servlet 2.4
> 
> (If you want to use extrnal or non "jsp" source,
> check out sitemesh)
> .V
> 
> Leandro Melo wrote:
> > Suppose i got scattered pieces of code, wich
> includes
> > a lot of Struts tags.
> > These pieces are separate files, and i need to
> accesss
> > some struts attributes (or beans) from these other
> > files for each request.
> > 
> > A nice example would be the html: error tag. In my
> > case, it's located outside of the file that
> contains
> > the submitted form, and i need to get the errors
> from
> > these other file (where the html: error tag is
> > located). That's why i need to import struts
> contexts
> > so i can get it done.
> > 
> > Is there a way to do that?
> > 






___
Yahoo! Acesso Grátis - navegue de graça com conexão de qualidade! Acesse: 
http://br.acesso.yahoo.com/

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



Re: Multiple image tags

2004-08-10 Thread Leandro Melo
Hi Michael,
please correct me if i'm wrong, but none of those
solutions would work nicely in my case.

The problem is that both solutions in a higher level
focus on getting the parameter and checking it out to
see its value.
 
In my case, i got a MyLookupDispatchAction that
receives all the requests and forwards it to the
specific method. So, there's no meanwhile to get the
request parameter, check it out and forward to some
method.

UNLESS,
i use someking of hidden field in the form with a name
that MyLookupDispatchAction expects:

protected Map getKeyMethodMap(){
   Map map = new HashMap();
   map.put("hidden.field", "verifyParameterMethod");
}

And the in the "verifyParameterMethod()", i'd use call

"getCommand(HttpServletRequest request)" to check what
was the value of the real parameter i want (the one
from the image tag). Finally, i would compare this
value and forward the data to the responsible method.
Am i correct?


It just seems a little confusing...


 
> At 12:55 PM 8/10/2004, you wrote:
> >Hi, this is a big question, so probably for only
> the
> >patient ones...
> 
> 
> All the solutions with the image tag are based on
> transforming the 
> parameter name in the tag to a value.  The
> name\value pair, e.g. 
> button.submit.x=9, is useful only for the name, i.e.
> for "button.submit.x" 
> and not for the value, i.e. "9".  This is, of
> course, unusual.  So, 
> solutions must efficiently determine whether the
> name was this or that and 
> have no interest at all in the value in this case. 
> I like, after much 
> experimentation, just doing it as follows:
> 
> public final class ButtonCommand {
>private ButtonCommand() {
>}
> 
>public final static String
> getCommand(HttpServletRequest request) {
>  Enumeration enum = request.getParameterNames();
>  String parameterName = null;
>  while(enum.hasMoreElements()) {
>parameterName = (String)enum.nextElement();
>if(parameterName.endsWith(".x")) {
>  return
>
parameterName.substring(0,parameterName.indexOf('.'));
>}
>  }
>  return parameterName;
>}
> }
> 
> This works when the name attribute in  type='image' name='whatever> 
> (the property attribute in ) is whatever
> you want as the 
> "command".  (The word "command" is probably a
> misnomer here.)  So, if you 
> have  etc., this will
> be sent as something 
> like submit.x=7&submit.y=11.  You can use the
> presence of the ".x" to mine 
> the value of the name or property attribute directly
> wherever you do your 
> controller logic.
> 
> 
> There are two solutions at: 
>
http://wiki.apache.org/struts/StrutsCatalogMultipleImageButtonsWithNoJavaScript.
> 
> The one is very simple and probably is the best. 
> Ted Husted's solution, I 
> have come to think, after having done something
> similar, is just to 
> heavy.  There is no need to create all those button
> objects.  However, if 
> you read the above link and in particular the least
> favored solution using 
> CrackWillowButton as an inner class for ActionForms,
> you will see how Ted's 
> works, I think, since the ideas are similar.
> 
> 
> 
>  

=
_
Leandro Terra C. Melo
Eng. de Controle e Automação - UFMG





___
Yahoo! Acesso Grátis - navegue de graça com conexão de qualidade! Acesse: 
http://br.acesso.yahoo.com/

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



Importing context with Struts

2004-08-10 Thread Leandro Melo
Suppose i got scattered pieces of code, wich includes
a lot of Struts tags.
These pieces are separate files, and i need to accesss
some struts attributes (or beans) from these other
files for each request.

A nice example would be the html: error tag. In my
case, it's located outside of the file that contains
the submitted form, and i need to get the errors from
these other file (where the html: error tag is
located). That's why i need to import struts contexts
so i can get it done.

Is there a way to do that?

=
_
Leandro Terra C. Melo
Eng. de Controle e Automação - UFMG





___
Yahoo! Acesso Grátis - navegue de graça com conexão de qualidade! Acesse: 
http://br.acesso.yahoo.com/

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



  1   2   >