Re: seeking advice on authorization and authentication

2005-04-25 Thread delbd
Here we have application using struts and giving priviledges to some users or 
some roles. We rely on container security to handle login. We simply put a 
link to /jsp/admin which redirects to the / and, in web.xml, we ask for 
everything under /jsp/admin to require authentification. This way 
request.getUserPrincipal() does now and for as long as session goes contains 
the authentified user. This has the advantage of being easy to put in place. 
I like to think 'As long as the container can do the job for you, let the 
container do it, it's faster to code' :)

Regards,
-- 
David Delbecq
Royal Meteorological Institute of Belgium

Le Lundi 25 Avril 2005 20:21, Dave Newton a écrit :
> Scott Purcell wrote:
> >I am creating a shopping-cart type application using struts and have a
> > question. The site itself does not have any authentication on it, as
> > people just browse and add stuff to the cart.
> >
> >But the site does require some data manipulation into the database. Upon
> > thinking about this, I would like to be able to have "certain" users
> > click a administration link and be able to administer some product
> > details, quantities, colors, etc.
> >
> >I am trying to lay out a way to achieve this, and be secure at the same
> > time. I had thought about using the web-server authentication mechanism,
> > or form-based, and got confused. Most sites I have done use form-based,
> > where we pull out name, password from database, but I also believe some
> > may use the containers authentication scheme.
> >
> >Can anyone give me some advice, pros-cons, examples, links of how to move
> > foward with this.
>
> There were a few recent threads about the pros and cons of writing a
> custom request processor vs. filters vs. a combination of the two vs.
> container-managed etc; the archive might be of high value.
>
> My own take on it is that if everything is done in Struts I like the
> custom request processor coupled with a filter to make sure the
> appropriate objects are always in session, but I already had fairly
> general-purpose filters in place.
>
> If not everything on the site is in Struts then a filter approach might
> work better, if it's all Struts then you could (should?) do it all in a
> request processor: this allows very easy declarative role-based security
> in the struts config file. One possible caveat is that the struts tags
> that take role parameters do not know anything about a custom role
> processor (is that still true???) so if you want role-based
> content-level decision making you might need to write your own tags,
> customize existing tags, etc.
>
> But check out the recent threads to get more input.
>
> Dave
>
>
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

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



Re: Displaying Formatted Vector Data

2005-04-25 Thread Andrew Thorell
I've been trying this segment of code, but it seems to be failing and
no errors are being reported in the log file for me to use to help
debug, any ideas?

commcenter is the attribute defined in struts-config.xml in the action
listing. callto is the name of the Vector / getter / setter methods.

I'm assuming 'id' is the reassignment of the variable that the iterate
tags are moving through.
If I were using a String[] array. callto[0], callto[1], etc.. no i
need to explicitly define an index variable? Or is it ok to leave it
out and assuming the framework does the iteration for me?





Andrew

Thanks again in advance!

On 4/25/05, Fogleson, Allen <[EMAIL PROTECTED]> wrote:
> You could use logic:iterate to iterate through the collection.
> 
> Al
> 
>

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



Re: graphics

2005-04-25 Thread Michael Jouravlev
Remember, that you can do a lot with client-side javascript. Send raw
data to the browser, and render chart there. Seems more logical,
because it takes the load off the server and off the network (the
latter may be not true for huge data set...).

Check this out, for example:
http://www.javascriptkit.com/script/script2/graphit.shtml

On 4/25/05, Lucas Bern <[EMAIL PROTECTED]> wrote:
> Hi guys!
> anything better than jFreeChart?... or at least "free" documented?
> Thanks!
> Lucas

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



RE: Displaying Formatted Vector Data

2005-04-25 Thread Fogleson, Allen
You could use logic:iterate to iterate through the collection.

Al


-Original Message-
From: Andrew Thorell [mailto:[EMAIL PROTECTED] 
Sent: Monday, April 25, 2005 4:51 PM
To: Struts Mailing List
Subject: Displaying Formatted Vector Data

Greetings all,

I was wondering if anyone had any ideas on the best way to display
data from a Vector in a table column where it doesn't dump out like
the following:

[800-555-1212, 800-555-1212, 800-555-1212, ... ]



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



Ssl+validator give me problems

2005-04-25 Thread kurt
Hi

I'm trying to make a Struts project under Tomcat. I use ssl and it
works. I use Validator too. Both works - but not together.
Fx the index.jsp page has a  and the
action is "invoked" but the form has already been validated by the
Validator - probably because some kind of redirection is done in order
to switch to the https protocol.
How can I avoid that the form bean is validated before the user
has seen it?

Thanks in advance
Kurt



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



Displaying Formatted Vector Data

2005-04-25 Thread Andrew Thorell
Greetings all,

I was wondering if anyone had any ideas on the best way to display
data from a Vector in a table column where it doesn't dump out like
the following:

[800-555-1212, 800-555-1212, 800-555-1212, ... ]

I'm using the following tag to get that information out, but I need
each number on a new line, no commas or brackets, like so:

800-555-1212
800-555-1212
800-555-1212
...



Any ideas? Web Tutorials? Pages? Anything?

Thanks in advance!

Andrew

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



2 modules, cannot retrieve mapping?

2005-04-25 Thread Scott Purcell
I am trying to use two modules for struts. 1 for a developer to work on the 
main section, and another for the admin section for another developer.
 
I am getting an error when trying to add a form tag to a jsp page that lives 
under the second module:
/Admin/mypage.jsp (jsp location from docroot)
   (form tag that throws error:
 cannot find mapping foobar
// actual error: javax.servlet.ServletException: Cannot retrieve mapping for 
action /foobar

org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:846)

In my /web-xml/admin/struts-config.xml file the entry for foobar exists:

  






Any idea why this occurs? I cannot seem to find any information on how to 
configure this.


Here is web.xml file:
  
unique
org.apache.struts.action.ActionServlet


  config
  /WEB-INF/struts-config.xml



  config/admin
  /WEB-INF/admin/struts-config.xml



Thanks


Scott K Purcell | Developer | VERTIS |
555 Washington Ave. 4th Floor | St. Louis, MO 63101 |
314.588.0720 Ext:1320 | [EMAIL PROTECTED] | http://www.vertisinc.com

Vertis is the premier provider of targeted advertising, media, and 
marketing services that drive consumers to marketers more effectively. 
 

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



Re: graphics

2005-04-25 Thread Lucas Bern
before someone anwser me! ; - )
 
i found something that seems to be great! 
and it is free documented!!!
 
http://cewolf.sourceforge.net/new/index.html
 
joy it!
Lucas

Lucas Bern <[EMAIL PROTECTED]> wrote:
Hi guys!
anything better than jFreeChart?... or at least "free" documented?
Thanks!
Lucas

Greg Pelly wrote:
Is it possible to use or to look up a key that is
not known until runtime (ie, stored in the request)?

I have a results screen that will display a message that varies depending on
the query performed. I would like this message to be retrieved from the
bundle in the struts-config.xml. 

For example, my Action will have logic:

if (isFriend) {
request.setAttribute("friendText", "key.friend");
} else if (isEnemy) {
request.setAttribute("friendText", "key.enemy");
} else {
request.setAttribute("friendText", "key.unknown");
}

I would like my JSP to get the value of the Request Attribute "friendText",
then lookup that key in the MessageResources file:

key.friend = 
Hello friend. I like you.
key.enemy = 
Hello enemy. I hate you.
key.unknown = 
Hello.

I checked the API for bean:write and c:out and looking to see if struts-el
provided this functionality. I didn't see any indication that it does,
though I have not used struts-el in the past.

Any ideas?

Thanks!
Greg

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




-
250MB gratis, Antivirus y Antispam
Correo Yahoo!, el mejor correo web del mundo
Abrí tu cuenta aquí

-
 250MB gratis, Antivirus y Antispam
 Correo Yahoo!, el mejor correo web del mundo
 Abrí tu cuenta aquí

Re: Passing in key to or at runtime

2005-04-25 Thread Jeff Beal
Have you looked at  and ?

-- Jeff

On 4/25/05, Greg Pelly <[EMAIL PROTECTED]> wrote:
> Is it possible to use  or  to look up a key that is
> not known until runtime (ie, stored in the request)?
> 
> I have a results screen that will display a message that varies depending on
> the query performed.  I would like this message to be retrieved from the
>  bundle in the struts-config.xml.
> 
> For example, my Action will have logic:
> 
> if (isFriend) {
>   request.setAttribute("friendText", "key.friend");
> } else if (isEnemy) {
>   request.setAttribute("friendText", "key.enemy");
> } else {
>   request.setAttribute("friendText", "key.unknown");
> }
> 
> I would like my JSP to get the value of the Request Attribute "friendText",
> then lookup that key in the MessageResources file:
> 
> key.friend = Hello friend. I like you.
> key.enemy = Hello enemy. I hate you.
> key.unknown = Hello.
> 
> I checked the API for bean:write and c:out and looking to see if struts-el
> provided this functionality. I didn't see any indication that it does,
> though I have not used struts-el in the past.
> 
> Any ideas?
> 
> Thanks!
> Greg
> 
> -
> 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]



graphics

2005-04-25 Thread Lucas Bern
Hi guys!
anything better than jFreeChart?... or at least "free" documented?
Thanks!
Lucas

Greg Pelly <[EMAIL PROTECTED]> wrote:
Is it possible to use or to look up a key that is
not known until runtime (ie, stored in the request)?

I have a results screen that will display a message that varies depending on
the query performed. I would like this message to be retrieved from the
bundle in the struts-config.xml. 

For example, my Action will have logic:

if (isFriend) {
request.setAttribute("friendText", "key.friend");
} else if (isEnemy) {
request.setAttribute("friendText", "key.enemy");
} else {
request.setAttribute("friendText", "key.unknown");
}

I would like my JSP to get the value of the Request Attribute "friendText",
then lookup that key in the MessageResources file:

key.friend = 
Hello friend. I like you.
key.enemy = 
Hello enemy. I hate you.
key.unknown = 
Hello.

I checked the API for bean:write and c:out and looking to see if struts-el
provided this functionality. I didn't see any indication that it does,
though I have not used struts-el in the past.

Any ideas?

Thanks!
Greg

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




-
 250MB gratis, Antivirus y Antispam
 Correo Yahoo!, el mejor correo web del mundo
 Abrí tu cuenta aquí

Passing in key to or at runtime

2005-04-25 Thread Greg Pelly
Is it possible to use  or  to look up a key that is
not known until runtime (ie, stored in the request)?

I have a results screen that will display a message that varies depending on
the query performed.  I would like this message to be retrieved from the
 bundle in the struts-config.xml.  

For example, my Action will have logic:

if (isFriend) {
  request.setAttribute("friendText", "key.friend");
} else if (isEnemy) {
  request.setAttribute("friendText", "key.enemy");
} else {
  request.setAttribute("friendText", "key.unknown");
}

I would like my JSP to get the value of the Request Attribute "friendText",
then lookup that key in the MessageResources file:

key.friend = Hello friend. I like you.
key.enemy = Hello enemy. I hate you.
key.unknown = Hello.

I checked the API for bean:write and c:out and looking to see if struts-el
provided this functionality. I didn't see any indication that it does,
though I have not used struts-el in the past.

Any ideas?

Thanks!
Greg

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



Re: Action call another action?

2005-04-25 Thread Michael Jouravlev
Of course an orphaned item will sit for a while in the session. But
does not this work the same in desktop apps too? Even worse, in
pessimistic systems when you start editing you lock the record. Then
you go have your coffee to piss off colleague who needed the same
record ;-)

In my case only one item sits in the session. If it makes user
experience better and my programming easier, let it sit there. The
good thing is that this is only a memory object, a new one, database
was not called yet. And if the user won't store changes, database
never will be called (well, maybe to generate PK, yes, it will). Also,
if you "exit" from item editing to the item list, item is invalidated
and disposed. So, the only chance to leave it hanging is if the user
wanders off while "Edit Item" window is opened.

Also, I create only one instance of a "current item" for create/edit
process (per session), so at most I will have one item in the session.
No biggie. Microsoft uses extensive approach all the time and it pays.
Who remebers that Win95 needed only 4 megs?

Michael.

On 4/25/05, Adam Hardy <[EMAIL PROTECTED]> wrote:
> On 25/04/05 17:03 Michael Jouravlev wrote:
> > On 4/25/05, Ted Husted <[EMAIL PROTECTED]> wrote:
> >
> >>>in my sample CRUD application i have editAction, which displays an
> >>>item in HTML form. It takes item ID as parameter. This action is
> >>>mapped, it can be called directly from a page using link, like
> >>>editAction.do?ID=1234. Another way to call it is to call it from
> >>>createAction, which creates new item, assigns in ID to it, and
> >>>redirects to editItem with ID attached to the URL as query parameter.
> >>>Is this chaining?
> 
> One disadvantage of this approach is that your app will create orphaned
> items whenever a user abandons the create process after hitting the
> create menu option. Your app will create a new item immediately, but the
> user may wander off and go to lunch without actually using it.
> 
> Well, I might. ;)
> 
> Adam

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



RE: MessageTag set specific Local

2005-04-25 Thread =?iso-8859-1?Q?Marcel_St=F6r?=
vinod perla  wrote:
> vinod wrote:
> u can set to a specific Locale in the Action Class by
> calling the method setLocale(HttpServletRequest
> request,java.util.Locale locale).The default scope of this is session.

So, what you're saying is, that one cannot set the specific Locale in the
JSP where the tag is employed?

Regards,
Marcel


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



Re: Managing exceptions

2005-04-25 Thread Mark Shifman
I am using struts 1.2.6 and I tried what Joe Germuska said however I am 
missing something.
The message shows up so that  displays it.

Or to put it another way

   ${message}

displays it while

   ${message}

doesn't.  So it looks like the exception is generating an ActionErrors 
object.

I generated an sql error for testing which throws a RuntimeException.
What am I missing??
mas

Joe Germuska wrote:
At 3:11 PM +0200 4/24/05, Sébastien GALLET wrote:
Hello,
I'm looking for a good way to manage exceptions in struts.
Any links in your bookmarks ?

That's a pretty general question!
I usually start by having a single global exception handler defined 
which catches anything thrown by Struts:




This ensures that any exceptions get handled by my app instead of the 
servlet container.  The value for "key" points to a message key in 
your message resources; mine usually says something like "An 
unexpected error occurred."

When it catches exceptions, he default Struts ExceptionHandler (as 
configured above) does three things:

* Puts the exception into the request scope under they key 
"org.apache.struts.action.EXCEPTION"
* puts an ActionMessages object into the request scope (by default) or 
the session scope (if the "scope" attribute of  is set to 
"session").  This ActionMessages contains a single ActionMessage which 
is created in one of two ways:
- If the caught exception extends o.a.s.util.ModuleException, that 
type's getActionMessage method is called
- otherwise, a new ActionMessage is created using the "key" 
attribute of the  config and passing the exception in as 
the single
* Forwards control to a view renderer in one of two ways:
- If the "path" attribute of  is specified, the forward 
goes there
- otherwise, the "input forward" for the current request is used.

and forwards control to the path specified in the exception-config 
(above, "/ErrorPage.jsp")  If the Exception which is caught extends 
org.apache.struts.util.ModuleException, then that class's 
"getActionMessage" method is used to populate the ActionMessages which 
is going into the request; otherwise, the "key" from the 
exception-config mapping is used to create a new ActionMessage, and 
the thrown exception is included as a message format argument.

So, this basic approach covers at least a way to present users with a 
page which looks like it belongs in your application, as opposed to a 
generic container error page; then if you want to provide multiple 
mappings (either global or per-action-mapping), you can refine this 
general strategy.  You can also extend ExceptionHandler and introduce 
your own error logging behavior or other specialized operations.

Hope this helps,
Joe

--
Mark Shifman MD. Ph.D.
Yale Center for Medical Informatics
Phone (203)737-5219
[EMAIL PROTECTED]
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Action call another action?

2005-04-25 Thread Adam Hardy
On 25/04/05 17:03 Michael Jouravlev wrote:
On 4/25/05, Ted Husted <[EMAIL PROTECTED]> wrote:
in my sample CRUD application i have editAction, which displays an
item in HTML form. It takes item ID as parameter. This action is
mapped, it can be called directly from a page using link, like
editAction.do?ID=1234. Another way to call it is to call it from
createAction, which creates new item, assigns in ID to it, and
redirects to editItem with ID attached to the URL as query parameter.
Is this chaining?
One disadvantage of this approach is that your app will create orphaned 
items whenever a user abandons the create process after hitting the 
create menu option. Your app will create a new item immediately, but the 
user may wander off and go to lunch without actually using it.

Well, I might. ;)
Adam
--
struts 1.2 + tomcat 5.0.19 + java 1.4.2
Linux 2.4.20 Debian
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: seeking advice on authorization and authentication

2005-04-25 Thread Dave Newton
Scott Purcell wrote:
I am creating a shopping-cart type application using struts and have a question. The site itself does not have any authentication on it, as people just browse and add stuff to the cart. 

But the site does require some data manipulation into the database. Upon thinking about 
this, I would like to be able to have "certain" users click a administration 
link and be able to administer some product details, quantities, colors, etc.
I am trying to lay out a way to achieve this, and be secure at the same time. I 
had thought about using the web-server authentication mechanism, or form-based, 
and got confused. Most sites I have done use form-based, where we pull out 
name, password from database, but I also believe some may use the containers 
authentication scheme.
Can anyone give me some advice, pros-cons, examples, links of how to move foward with this.
 

There were a few recent threads about the pros and cons of writing a 
custom request processor vs. filters vs. a combination of the two vs. 
container-managed etc; the archive might be of high value.

My own take on it is that if everything is done in Struts I like the 
custom request processor coupled with a filter to make sure the 
appropriate objects are always in session, but I already had fairly 
general-purpose filters in place.

If not everything on the site is in Struts then a filter approach might 
work better, if it's all Struts then you could (should?) do it all in a 
request processor: this allows very easy declarative role-based security 
in the struts config file. One possible caveat is that the struts tags 
that take role parameters do not know anything about a custom role 
processor (is that still true???) so if you want role-based 
content-level decision making you might need to write your own tags, 
customize existing tags, etc.

But check out the recent threads to get more input.
Dave

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


Re: seeking advice on authorization and authentication

2005-04-25 Thread Michael Jouravlev
In our application we used what we called "guard tag". It is a simple
custom tag, which contains something like this:

  HttpSession session = pageContext.getSession();
  String userID = (String)session.getAttribute(Constants.USERID_KEY);

We put this tag in the beginning of a page:
  

If there is no userID in the session, that the user is a guest. If
userID exists, his credentials are verified. Different pages can have
different tags, so it is not very flexible role-wize, but allows to
create simple "guest"/"not guest" system. Pages marked with "not
guest" are not shown to guests, as control is immediately dispatched
by the tag to guard.do action, which shows login page.

Your case is a little different, but maybe you will find our approach
worth considering.

Michael.

On 4/25/05, Scott Purcell <[EMAIL PROTECTED]> wrote:
> I am creating a shopping-cart type application using struts and have a 
> question. The site itself does not have any authentication on it, as people 
> just browse and add stuff to the cart.
> 
> But the site does require some data manipulation into the database. Upon 
> thinking about this, I would like to be able to have "certain" users click a 
> administration link and be able to administer some product details, 
> quantities, colors, etc.
> 
> I am trying to lay out a way to achieve this, and be secure at the same time. 
> I had thought about using the web-server authentication mechanism, or 
> form-based, and got confused. Most sites I have done use form-based, where we 
> pull out name, password from database, but I also believe some may use the 
> containers authentication scheme.
> 
> Can anyone give me some advice, pros-cons, examples, links of how to move 
> foward with this.
> 
> Thanks,
> 
> Scott

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



Re: seeking advice on authorization and authentication

2005-04-25 Thread Erik Weber
http://java.sun.com/j2ee/1.4/docs/tutorial/doc/
Chapter 32: Security
Should help.
Erik
Scott Purcell wrote:
I am creating a shopping-cart type application using struts and have a question. The site itself does not have any authentication on it, as people just browse and add stuff to the cart. 

But the site does require some data manipulation into the database. Upon thinking about 
this, I would like to be able to have "certain" users click a administration 
link and be able to administer some product details, quantities, colors, etc.
I am trying to lay out a way to achieve this, and be secure at the same time. I 
had thought about using the web-server authentication mechanism, or form-based, 
and got confused. Most sites I have done use form-based, where we pull out 
name, password from database, but I also believe some may use the containers 
authentication scheme.
Can anyone give me some advice, pros-cons, examples, links of how to move 
foward with this.
Thanks,
Scott
-
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]


getting certain properties from message resources to the jsp's

2005-04-25 Thread Robert Sanheim
I want to do something fairly simple which I haven't seen a good
example for yet:  iterate through all messages from my default
application.resources file that match a certain pattern, and display
them on a jsp.  The use case here is a navigational page that I want
to have generated dynamically from the titles that are defined in the
msg resources.  So in app resources I have:

title.welcome=Welcome
title.error=General Error Page
title.login=Login
title.whatever=Some Page...
// about 6 more titles, plus any other app wide properties

So the psuedo code is like this:

for every key in msg resources
   if key matches "title.*"
  put value for key into map

put map onto the request or session

I've looked through the archives, the wiki, the MessageResources API
and see no way of doing this short of just loading the resource file a
second time as java.util.Properties instance - which I'd like to avoid
as it violates DRY.

Am I missing something here?

thanks,
Rob
-- 
http://www.robsanheim.com/

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



seeking advice on authorization and authentication

2005-04-25 Thread Scott Purcell
I am creating a shopping-cart type application using struts and have a 
question. The site itself does not have any authentication on it, as people 
just browse and add stuff to the cart. 

But the site does require some data manipulation into the database. Upon 
thinking about this, I would like to be able to have "certain" users click a 
administration link and be able to administer some product details, quantities, 
colors, etc.

I am trying to lay out a way to achieve this, and be secure at the same time. I 
had thought about using the web-server authentication mechanism, or form-based, 
and got confused. Most sites I have done use form-based, where we pull out 
name, password from database, but I also believe some may use the containers 
authentication scheme.

Can anyone give me some advice, pros-cons, examples, links of how to move 
foward with this.

Thanks,

Scott


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



Re: Can you make Tomcat 5 create multiple JSESSIONID cookies in Firefox?

2005-04-25 Thread Ted Husted
On 4/22/05, Dick Starr <[EMAIL PROTECTED]> wrote:
> I am new to both Struts and web applications and in fact am writing my
> very first web application, so I may not understand how this all works.
> In the app it's possible for more than one user to be on the same PC
> (e.g. a user needs their supervisor to log on to the app as a higher
> security user to do something that the user can't do).

So, as a client story, the key issue is that: 

"Sometimes, a user needs their supervisor to authorize an unusual transaction." 

Most of us have probably seen this happen at the grocery story. The
clerk needs to credit something and turns on the flashing light. The
front end manager strolls over, inserts a key into the register, or
taps in a code, so that the clerk can issue the credit.

If we are writing the application with the servlet API, we might be
tempted to piggy-back the authorization by having the supervisor login
to a separate window, so that the clerk can complete the transaction
using the supervisor's credentials. If we are writing the application
*into* the servlet API, we might instead issue our own override code
and make it an expected element of the request.

If this is the case, then the simplest thing would be to add a table
to the database (or map to application scope) that could store
authorization keys and the other salient details about the
transaction. When such a transaction is needed, the clerk steps
through a wizard that asks for a supervisor ID. But the ID is not used
for a login, but to obtain a GUID. one copy of the GUID is stored in
the database, and the other is stored as a hidden field in the
request. Later, when the transaction is submitted, the business logic
compares the authorization code (GUID) against the table. If it
matches, then the transaction can continue, and the code can be marked
as used.

This is the same pattern that Struts uses to foil double-submits. 

HTH, Ted.

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



Re: Caching Java Objects

2005-04-25 Thread Erik Weber
temp temp,
If you are going to cache:
Use request scope for objects that should be cached for the duration of 
a single request servicing.

Use session scope for objects that should be cached for the duration of 
a user's session (more than one request) and that represent data unique 
to the user, or that represent common data that the user can modify, 
thus creating data that is then unique to the user.

Use application scope or static scope for everything else (remembering 
caveats of concurrent access -- typically this will be read-only data). 
If 100 users' shopping carts will contain the same Furby item and the 
Furby item is used for read only access, each session should (ideally) 
contain a reference to the same Furby instance -- there is no need for 
100 identical Furbies to be instantiated (this suggests application 
scope caching, not session scope caching, though actually you may be 
accessing attributes in both scopes to accomplish this). When you use 
String literals as your cached values, this happens automatically 
(String class pooling), but if your cached objects are not String 
literals (or basically just wrappers for String literals), somewhere 
your code should see if Furby No. 13876 already has been instantiated 
before instantiating it (unless the Furby class is small and/or you 
don't care about such memory inefficiencies). It helps if you are 
caching in the middle tier rather than in the view tier.

A simple way to use session caching in the view tier is to associate a 
timestamp with the cached property (you might write a bass class 
"Cacheable", to be used as an attribute, that contains a data field and 
a timestamp field and that implements java.io.Serializable). Your view 
helper (or Action) checks the session for the object first. If it finds 
the object, it also checks the timestamp. If the object is missing or 
the timestamp is too old, you go and fetch the object from the middle 
tier, set/reset the timestamp and cache it. This is a simple way, and 
not necessarily a bad way, but probably not the best way. It might be 
the best way though if you are truly talking about data that is unique 
to each user (shopping cart, large inventory) and/or if you want 
something that is easy to understand and implement.

A lot of middleware products (such as iBatis, Hibernate) use caching in 
the middle/back end tiers, which frees your view helpers from having to 
worry about it. It's pretty easy to implement the caching strategy I 
mentioned in your own middle tier. Then not only will your view helpers 
be freed from it, but they can remain unchanged if you later decide to 
go to one of these middleware products. Typically the strategy here is 
to associate a data store query with a cached result.

Even better, if you like to roll your own, I recommend learning how to 
write an MRU cache (use a List and a Map, in cooperation, wrapped in a 
single class and instantiate as a singleton) and then let your middle 
tier manager components make Cacheables out of stuff that gets asked for 
repeatedly (good for things like stock quotes and news headlines). You 
can figure this out in a day or two, and now you can adjust your memory 
consumption/query frequency tradeoff. Compare that to however long it 
takes to learn iBatis or Hibernate. But if you don't feel comfortable 
with Threads, concurrency and Collections then I would say don't mess 
with this approach (again it's typically not difficult to implement if 
your data is read-only).

Everyone has a different opinion on this, so just take mine as one of 
them. But, on the question of whether you should cache at all, I would 
lean toward no until/unless you have a clear understanding of where it's 
going to improve the performance of your application. If your user keeps 
refreshing views of a shopping cart with the same contents (product 
descriptions), or something similar, then your scenario might be a good 
candidate for a caching strategy.

Hope that helps,
Erik
temp temp wrote:
 
Is it  similar to sessions ie each  user will have 
his own cached Object or all the users share the same
Cached object .

I have a jsp with multiple submit buttons .Each submit
buttoncalls database to get data. Its like I have
3 submit buttons 
 1st  gets User comments .
 2nd gets some results  of a type
 3rd gets  some results  of a different  type

when user clicks on comments 1st submit button  I have
to call 2nd and 3rd to get result  data  .I want to
avoid this  by caching  the results data  .This
results data is different for different users.  User I
mean a client(Browser)  accessing my website.  

Should I use sessions to store this data or use Cahced
objects in case cached object what to use.
thanks & regards


		
__ 
Do you Yahoo!? 
Yahoo! Mail - Helps protect you from nasty viruses. 
http://promotions.yahoo.com/new_mail

-
To unsubscribe, e-mail: [EMA

Re: How can I get people to look at my contribution? [was: Re: Action ...

2005-04-25 Thread Dakota Jack
James has been and will continue to be, no doubt, a great asset to
Struts.  What that has to do with his misconception discussed in this
thread is beyond me.  But, as an aside, James, you have my "atta boy"
too.

Jack

On 4/25/05, Ted Husted <[EMAIL PROTECTED]> wrote:
> The plain truth is that an ASF project is not a democracy. It a
> meritocracy. People earn merit and credibility by doing things that
> matter and avoiding things that don't matter.
> 
> One way to earn merit and credibility is to make helpful posts. But
> hurtful, unhelpful posts destroy merit just as easily. One step
> forward, three steps back.
> 
> Like all open source projects, Struts doesn't need critics, we need
> models. What we need most is people like James, who create extensions,
> and contribute to the codebase, and volunteer the time and energy it
> takes to keep this project running, day after day.
> 
> James Mtichell is a Committer and a member of the Struts PMC. Over the
> years, through his many contributions, he's earned a lot of merit with
> this community. Most recently, James did the work of fixing our
> nightly builds. If he did not do that work, then we might not have
> nightly builds right now. James didn't do it because someone paid him
> to do it. James did it because he wanted to make a difference (in a
> good way).
> 
> When James speaks, I listen. Why? because James has earned a lot of
> merit and credibility in my eyes.
> 
> Anyone with an email account can post to this list. But, not everyone
> takes the time and energy to do the work of this project, the way
> James does, and Martin does, and Don does, and Joe does, and Niall
> does, and Hubert does.
> 
> Not because anyone pays them to do it (no one does), but because they
> simply want to make the Struts project a better place. Not by
> criticizing, but by making it so.
> 
> -Ted.
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


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

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



Re: Action call another action?

2005-04-25 Thread Michael Jouravlev
On 4/25/05, Frank W. Zammetti <[EMAIL PROTECTED]> wrote:
> On the subject of one Action calling another, one option that is often
> overlooked is to simply instantiate another Action yourself and call
> process() on it manually.  I.e., in Action A do:
> 
> Action ab = new ActionB();
> ab.process(m f, r, r);
> 
> The benefit to this is that you don't need to go through the request
> processing chain again, and you can determine whether you want to use the
> forward returned by the called Action (Action B above) or the one
> generated by the Action doing the calling (Action A above).

This does not work for me since redirection is a key part of my
approach to chaining. I do chaining in order to provide more robust
and friendly UI, not because I just want to reuse some business code.

Michael.

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



Re: Action call another action?

2005-04-25 Thread Michael Jouravlev
On 4/25/05, Ted Husted <[EMAIL PROTECTED]> wrote:
> > in my sample CRUD application i have editAction, which displays an
> > item in HTML form. It takes item ID as parameter. This action is
> > mapped, it can be called directly from a page using link, like
> > editAction.do?ID=1234. Another way to call it is to call it from
> > createAction, which creates new item, assigns in ID to it, and
> > redirects to editItem with ID attached to the URL as query parameter.
> > Is this chaining?
> 
> The question is whether you are
> 
> * going from one to the another because you need to redirect anyway, or

yes 

> * because you don't want to cut-and-paste business logic between the
> Action classes.

and yes... no, this is not entirely correct. It is not that I did not
want to cut-and-paste business logic, I did not want to cut-and-paste
UI logic. Also, because Struts action can have only one associated
form bean, it seemed natural to split one action into input (setup)
action and output action.

The understanding that redirection can provide better user experience
came later. But now I think this is a natural fit, and I develop all
my future Struts apps in the same manner. So far it works.

> If the latter, then the business API is underdeveloped and the
> application is on a slipperly slope.
> 
> The key point is: Could you call the editAction business logic from
> another Action class if need be?

Umm... Not "from". I can call it anytime, before or after other action.

> The main reason that Action Chaining is bad is because it implies
> people are not creating their own business APIs: The Action classes
> are becoming the API rather than an adaptor to the API. 

No, I am not chaining actions to load this, create that, update that
and then output that. I input data in the first action, update the
model (all business create/delete/update stuff happens here), and in
the output action I simply load business object into form bean and
display it.

> Another reason
> is simply because Struts was not designed to support Action Chaining
> and, out of the box, can't distinguish between a new request and a
> "chained" request.

This works for me, since I use redirection and I want actions to be as
independent as possible.

> The danger is allowing the Actions to become the unit of reuse. The
> business facade should be the unit of reuse.

With all due respect ;) I cannot agree with that. I reuse actions as
UI units, not business units.

> The Actions should be an
> adapter between HTTP and your application's API. There should be a
> very clear line where Struts ends and your business logic begins. As
> Steve McConnell would say: Program into Struts, not with Struts.

Right, but then again, I modularize UI units, not Struts wrappers for
my business processes.

> In this case, it should boil down to a method call on a business
> object that takes an ID and returns the value object we want to edit.
> If that is what the heart of the Action does, then the application is
> on the right road.

That what editAction does, because everything was set up before it is
called. The point is, it does not care where the object comes from. If
it is not in the memory yet, editAction loads the object from the
database.

> > This works great and allows to add a level of abstraction, so editItem
> > does not know where the data comes from. This modularized approach
> > allows to create application with high level of reuse.
> 
> As mentioned, the focus should be on the business object that editItem
> calls, not the editItem Action. The business objects should be the
> unit of reuse, and Actions merely adaptors.

As I said, I respectfully disagree. If a particular action does not
depend on exact sequence, in what other actions were called before it
to set things up, then modularizing actions can be safe and efficient.

I myself found my confession, but I would not want others to follow
commandments blindly only because they express Creator's will ;)

Michael.

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



Re: How can I get people to look at my contribution? [was: Re: Action ...

2005-04-25 Thread Dave Newton
Ted Husted wrote:
Anyone with an email account can post to this list. 

That'll teach 'em to give me an email account.
Muahahahahaha!
All your Struts are belong to us.
Dave "I thought something weird was going on" Newton

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


Caching Java Objects

2005-04-25 Thread temp temp
  
Is it  similar to sessions ie each  user will have 
his own cached Object or all the users share the same
Cached object .

I have a jsp with multiple submit buttons .Each submit
buttoncalls database to get data. Its like I have
3 submit buttons 
  1st  gets User comments .
  2nd gets some results  of a type
  3rd gets  some results  of a different  type


when user clicks on comments 1st submit button  I have
to call 2nd and 3rd to get result  data  .I want to
avoid this  by caching  the results data  .This
results data is different for different users.  User I
mean a client(Browser)  accessing my website.  


Should I use sessions to store this data or use Cahced
objects in case cached object what to use.

thanks & regards






__ 
Do you Yahoo!? 
Yahoo! Mail - Helps protect you from nasty viruses. 
http://promotions.yahoo.com/new_mail

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



Re: Action call another action?

2005-04-25 Thread Frank W. Zammetti
On the subject of one Action calling another, one option that is often
overlooked is to simply instantiate another Action yourself and call
process() on it manually.  I.e., in Action A do:

Action ab = new ActionB();
ab.process(m f, r, r);

The benefit to this is that you don't need to go through the request
processing chain again, and you can determine whether you want to use the
forward returned by the called Action (Action B above) or the one
generated by the Action doing the calling (Action A above).

Don't take this as an endorsement of this approach though, merely as an
FYI on another option.  What Ted eloquently says about a proper business
API facade should make this option irrelevent as well as the others.  But
if you have it in your head that you need/want to chain Actions, this is
another way to do it, one with some benefits that might be important to
you.  I've done this myself on occassion to no ill effect (although I
fight myself when I think of doing it now!)

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

On Mon, April 25, 2005 7:09 am, Ted Husted said:
>> in my sample CRUD application i have editAction, which displays an
>> item in HTML form. It takes item ID as parameter. This action is
>> mapped, it can be called directly from a page using link, like
>> editAction.do?ID=1234. Another way to call it is to call it from
>> createAction, which creates new item, assigns in ID to it, and
>> redirects to editItem with ID attached to the URL as query parameter.
>> Is this chaining?
>
> The question is whether you are
>
> * going from one to the another because you need to redirect anyway, or
> * because you don't want to cut-and-paste business logic between the
> Action classes.
>
> If the latter, then the business API is underdeveloped and the
> application is on a slipperly slope.
>
> The key point is: Could you call the editAction business logic from
> another Action class if need be?
>
> The main reason that Action Chaining is bad is because it implies
> people are not creating their own business APIs: The Action classes
> are becoming the API rather than an adaptor to the API. Another reason
> is simply because Struts was not designed to support Action Chaining
> and, out of the box, can't distinguish between a new request and a
> "chained" request.
>
> The danger is allowing the Actions to become the unit of reuse. The
> business facade should be the unit of reuse. The Actions should be an
> adapter between HTTP and your application's API. There should be a
> very clear line where Struts ends and your business logic begins. As
> Steve McConnell would say: Program into Struts, not with Struts.
>
> In this case, it should boil down to a method call on a business
> object that takes an ID and returns the value object we want to edit.
> If that is what the heart of the Action does, then the application is
> on the right road. If the Action goes through several lines of setup
> and teardown code, that you would not want to maintain elsewhere, then
> the application is on the road to ruin :)
>
> If it's a short road, then there may be little or no harm. But, if it
> is a long road, then there will be problems along the way.
>
>> This works great and allows to add a level of abstraction, so editItem
>> does not know where the data comes from. This modularized approach
>> allows to create application with high level of reuse.
>
> As mentioned, the focus should be on the business object that editItem
> calls, not the editItem Action. The business objects should be the
> unit of reuse, and Actions merely adaptors.
>
>
>>
>> Michael.
>>
>> -
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>
> --
> HTH, Ted.
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


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



Re: Action call another action?

2005-04-25 Thread Frank W. Zammetti
On the subject of one Action calling another, one option that is often
overlooked is to simply instantiate another Action yourself and call
process() on it manually.  I.e., in Action A do:

Action ab = new ActionB();
ab.process(m f, r, r);

The benefit to this is that you don't need to go through the request
processing chain again, and you can determine whether you want to use the
forward returned by the called Action (Action B above) or the one
generated by the Action doing the calling (Action A above).

Don't take this as an endorsement of this approach though, merely as an
FYI on another option.  What Ted eloquently says about a proper business
API facade should make this option irrelevent as well as the others.  But
if you have it in your head that you need/want to chain Actions, this is
another way to do it, one with some benefits that might be important to
you.  I've done this myself on occassion to no ill effect (although I
fight myself when I think of doing it now!)

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

On Mon, April 25, 2005 7:09 am, Ted Husted said:
>> in my sample CRUD application i have editAction, which displays an
>> item in HTML form. It takes item ID as parameter. This action is
>> mapped, it can be called directly from a page using link, like
>> editAction.do?ID=1234. Another way to call it is to call it from
>> createAction, which creates new item, assigns in ID to it, and
>> redirects to editItem with ID attached to the URL as query parameter.
>> Is this chaining?
>
> The question is whether you are
>
> * going from one to the another because you need to redirect anyway, or
> * because you don't want to cut-and-paste business logic between the
> Action classes.
>
> If the latter, then the business API is underdeveloped and the
> application is on a slipperly slope.
>
> The key point is: Could you call the editAction business logic from
> another Action class if need be?
>
> The main reason that Action Chaining is bad is because it implies
> people are not creating their own business APIs: The Action classes
> are becoming the API rather than an adaptor to the API. Another reason
> is simply because Struts was not designed to support Action Chaining
> and, out of the box, can't distinguish between a new request and a
> "chained" request.
>
> The danger is allowing the Actions to become the unit of reuse. The
> business facade should be the unit of reuse. The Actions should be an
> adapter between HTTP and your application's API. There should be a
> very clear line where Struts ends and your business logic begins. As
> Steve McConnell would say: Program into Struts, not with Struts.
>
> In this case, it should boil down to a method call on a business
> object that takes an ID and returns the value object we want to edit.
> If that is what the heart of the Action does, then the application is
> on the right road. If the Action goes through several lines of setup
> and teardown code, that you would not want to maintain elsewhere, then
> the application is on the road to ruin :)
>
> If it's a short road, then there may be little or no harm. But, if it
> is a long road, then there will be problems along the way.
>
>> This works great and allows to add a level of abstraction, so editItem
>> does not know where the data comes from. This modularized approach
>> allows to create application with high level of reuse.
>
> As mentioned, the focus should be on the business object that editItem
> calls, not the editItem Action. The business objects should be the
> unit of reuse, and Actions merely adaptors.
>
>
>>
>> Michael.
>>
>> -
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>
> --
> HTH, Ted.
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


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



Re: MessageTag set specific Local

2005-04-25 Thread vinod perla
vinod wrote:
u can set to a specific Locale in the Action Class by
calling the method setLocale(HttpServletRequest
request,java.util.Locale locale).The default scope of this is session.
regards
vinod

On 4/25/05, Marcel Stör <[EMAIL PROTECTED]> wrote:
> Hi all,
> 
> Had my first Struts experiences yesterday...
> MessageTag uses the browser's language settings to determin the Locale,
> which is being used to retrieve language-specific messages. So far so good.
> How can I force MessageTag to use a particular Locale for a request? The API
> suggests to use the tag's "locale" attribute. However, the Struts source
> code doesn't seem to backup this assumption.
> What's the solution here?
> 
> --
> Marcel Stör
> http://www.frightanic.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]



MessageTag set specific Local

2005-04-25 Thread Marcel Stör
Hi all,

Had my first Struts experiences yesterday...
MessageTag uses the browser's language settings to determin the Locale,
which is being used to retrieve language-specific messages. So far so good.
How can I force MessageTag to use a particular Locale for a request? The API
suggests to use the tag's "locale" attribute. However, the Struts source
code doesn't seem to backup this assumption.
What's the solution here?

-- 
Marcel Stör
http://www.frightanic.com



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



Re: How can I get people to look at my contribution? [was: Re: Action ...

2005-04-25 Thread Ted Husted
The plain truth is that an ASF project is not a democracy. It a
meritocracy. People earn merit and credibility by doing things that
matter and avoiding things that don't matter.

One way to earn merit and credibility is to make helpful posts. But
hurtful, unhelpful posts destroy merit just as easily. One step
forward, three steps back.

Like all open source projects, Struts doesn't need critics, we need
models. What we need most is people like James, who create extensions,
and contribute to the codebase, and volunteer the time and energy it
takes to keep this project running, day after day.

James Mtichell is a Committer and a member of the Struts PMC. Over the
years, through his many contributions, he's earned a lot of merit with
this community. Most recently, James did the work of fixing our
nightly builds. If he did not do that work, then we might not have
nightly builds right now. James didn't do it because someone paid him
to do it. James did it because he wanted to make a difference (in a
good way).

When James speaks, I listen. Why? because James has earned a lot of
merit and credibility in my eyes.

Anyone with an email account can post to this list. But, not everyone
takes the time and energy to do the work of this project, the way
James does, and Martin does, and Don does, and Joe does, and Niall
does, and Hubert does.

Not because anyone pays them to do it (no one does), but because they
simply want to make the Struts project a better place. Not by
criticizing, but by making it so.

-Ted.

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



Re: Action call another action?

2005-04-25 Thread Ted Husted
> in my sample CRUD application i have editAction, which displays an
> item in HTML form. It takes item ID as parameter. This action is
> mapped, it can be called directly from a page using link, like
> editAction.do?ID=1234. Another way to call it is to call it from
> createAction, which creates new item, assigns in ID to it, and
> redirects to editItem with ID attached to the URL as query parameter.
> Is this chaining?

The question is whether you are 

* going from one to the another because you need to redirect anyway, or 
* because you don't want to cut-and-paste business logic between the
Action classes.

If the latter, then the business API is underdeveloped and the
application is on a slipperly slope.

The key point is: Could you call the editAction business logic from
another Action class if need be?

The main reason that Action Chaining is bad is because it implies
people are not creating their own business APIs: The Action classes
are becoming the API rather than an adaptor to the API. Another reason
is simply because Struts was not designed to support Action Chaining
and, out of the box, can't distinguish between a new request and a
"chained" request.

The danger is allowing the Actions to become the unit of reuse. The
business facade should be the unit of reuse. The Actions should be an
adapter between HTTP and your application's API. There should be a
very clear line where Struts ends and your business logic begins. As
Steve McConnell would say: Program into Struts, not with Struts.

In this case, it should boil down to a method call on a business
object that takes an ID and returns the value object we want to edit.
If that is what the heart of the Action does, then the application is
on the right road. If the Action goes through several lines of setup
and teardown code, that you would not want to maintain elsewhere, then
the application is on the road to ruin :)
 
If it's a short road, then there may be little or no harm. But, if it
is a long road, then there will be problems along the way.

> This works great and allows to add a level of abstraction, so editItem
> does not know where the data comes from. This modularized approach
> allows to create application with high level of reuse.

As mentioned, the focus should be on the business object that editItem
calls, not the editItem Action. The business objects should be the
unit of reuse, and Actions merely adaptors.


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

-- 
HTH, Ted.

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



Re: Problems with Struts 1.2.4 - ActionMessage vs ActionError

2005-04-25 Thread Les Dunaway
OK, I have gotten to where I know what is happening.  Now, I hope 
someone can help me to understand why.
The ActionMessage is getting properly saved in the request and the 

Further, the error has a valid key into the current application resouces 
.  Other tags 


My conclusion: for some reason, the message is not being retrieved from 
the resources file

Anybody got  a clue?
--

L.W.(Les) Dunaway
GL Services
770-974-4289 / 888-243-9886
[EMAIL PROTECTED]
"Great minds discuss ideas. Average minds discuss events. Small minds 
discuss people." - Admiral Hyman Rickover


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


Re: Cannot find bean org.apache.struts.taglib.html.BEAN in any scope

2005-04-25 Thread John Moore
I should also point out that if I treat the whole page as a JSP 2.0 tag 
(which I'm currently doing, until I resolve the JSP/Struts issue), it 
works. That is, if instead of having:


   
   
   

I have:

   
   
   

Then the html:input tags contained within the body (provided by 
jsp:doBody) are perfectly able to find the form bean of the parent 
html:form, unlike in the JSP version. I can't determine what the 
difference might be, unless it is to do with scope.

John
--
==
John Moore  -  Norwich, UK  -  [EMAIL PROTECTED]
==
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: How to Known if there error for a property

2005-04-25 Thread Rodolfo =?iso-8859-1?Q?Garc=EDa_Esteban=2FCYII?=
Thanks, this works very well


Rodolfo García Esteban
Canal Isabel II
División de Aplicaciones Técnicas
C/ Santa Engracia, 125
Edificio 8
Tel. 91 545 10 00 - Ext. 2128
Fax. 91 545 14 41
___




Erik Weber <[EMAIL PROTECTED]>
25/04/2005 09:33
Por favor, responda a "Struts Users Mailing List"

 
Para:   Struts Users Mailing List 
cc: (cco: Rodolfo García Esteban/CYII)
Asunto: Re: How to Known if there error for a property


Rodolfo, I attached two posts from Joe, which you can see are from last 
November. I am making some assumptions about your question (perhaps you 
want to display the error message right on top of the input field in 
addition to/rather than in a bulleted list at the top of the page), so I 
apologize if I am on the wrong track.

If I recall, Niall has done a bunch of work in this area since that 
time. Sorry but I haven't kept up with it very well. I think you should 
wait for a post from Niall or Joe on this matter for a definitive answer 
then. But this works. This subject comes up a lot, and I also am 
interested in a nice solution. Right now I have a lot of JSPs with 
logical switches for every field that include the line of code below or 
something similar.

Hope this helps,
Erik


Rodolfo García Esteban/CYII wrote:

>Hi,
>
>I´m using struts 1.2.4, after validate a form. I need to know if there is 

>a message for a property before print, how can I do?
>
>Thanks in advance,
>
>Rodolfo
>
> 
>

At 3:49 PM -0600 11/8/04, Struts User wrote:

> Hello,
>
> Currently, I am using struts validator to validate the fields in my 
> ActionForm.
>
> Before I updated to struts 1.2.4, I could add an error this way - 
> errors.add(
> "username", new ActionError("error.username.required"));
>
> If the validation failed, the error message for username will be
> displayed right beside the user name text field if I use Username:
> .
>
> Can someone tell me how to display error message beside an input field
> using struts validator?


I've never seen any automatic message placement.  You can access 
messages like this:



html:messages is effectively a combination logic/iterator tag.  If there 
are any "username" messages in the ActionMessages object saved as the 
"errors" messages, the body of html:messages will be evaluated once for 
each, with a scripting variable of type String defined with the name 
specified in the "id" attribute.  You can use c:out or bean:write to 
display this value, wrapped with span, div, or other tags which format 
your messages correctly.

I kind of think someone talked on the list once about making something 
which rendered an HTML "label" tag and which was also "smart" about the 
presence of errors.  I like the idea of something like that in general, 
but wonder if you'd be able to specify something suitably general for 
inclusion in Struts.  Seems like it might be better left for local 
development.

Joe

. . .


At 5:10 PM -0500 11/8/04, Erik Weber wrote:

> Here is a way to do it that works with 1.1:
>
>  property="username">
> 
> 
> Username: 


Omitting the "name" attribute in this would have the same effect as 
including it - it's the default.  It's suggested that if you are storing 
messages in your actions using "saveErrors" or "saveMessages" (or 
dealing with validation errors, which are stored as if using 
"saveErrors") then you shouldn't specify "name" literally; instead, you 
can either rely on the default (to get errors) or use the "message" 
attribute with a value of "true" (to get saveMessages messages) or 
"false" (to get errors -- that is, the default behavior).  This helps to 
"encapsulate" the logic of how Struts handles those messages, and makes 
your JSP a bit less verbose also.

Additionally, your code above assumes that the nature of the error 
message is such that you know that the user should be shown the 
"error.username.required" message -- it's probably more flexible to let 
the validation/error handling framework create an ActionMessage object 
with that key itself, and then you would use the messages object; this 
way if any other error should come up (say you add a max-length 
restriction, or forbidden characters), then you don't have to change 
your JSP.

In another response I demonstrated how html:messages can be used to 
achieve the same result you had above, plus this added flexibility I 
mention.

Some people still like to use "html:errors", which predates 
html:messages and which has a slightly different syntax for providing 
any HTML which might "wrap" your messages.  Personally, I prefer 
html:messages.

None of this changed from Struts 1.1 to Struts 1.2.

Hope this helps,
Joe


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





Re: How to Known if there error for a property

2005-04-25 Thread Erik Weber
Rodolfo, I attached two posts from Joe, which you can see are from last 
November. I am making some assumptions about your question (perhaps you 
want to display the error message right on top of the input field in 
addition to/rather than in a bulleted list at the top of the page), so I 
apologize if I am on the wrong track.

If I recall, Niall has done a bunch of work in this area since that 
time. Sorry but I haven't kept up with it very well. I think you should 
wait for a post from Niall or Joe on this matter for a definitive answer 
then. But this works. This subject comes up a lot, and I also am 
interested in a nice solution. Right now I have a lot of JSPs with 
logical switches for every field that include the line of code below or 
something similar.

Hope this helps,
Erik
Rodolfo García Esteban/CYII wrote:
Hi,
I´m using struts 1.2.4, after validate a form. I need to know if there is 
a message for a property before print, how can I do?

Thanks in advance,
Rodolfo
 

At 3:49 PM -0600 11/8/04, Struts User wrote:
Hello,
Currently, I am using struts validator to validate the fields in my 
ActionForm.

Before I updated to struts 1.2.4, I could add an error this way - 
errors.add(
"username", new ActionError("error.username.required"));

If the validation failed, the error message for username will be
displayed right beside the user name text field if I use Username:
.
Can someone tell me how to display error message beside an input field
using struts validator?

I've never seen any automatic message placement.  You can access 
messages like this:


html:messages is effectively a combination logic/iterator tag.  If there 
are any "username" messages in the ActionMessages object saved as the 
"errors" messages, the body of html:messages will be evaluated once for 
each, with a scripting variable of type String defined with the name 
specified in the "id" attribute.  You can use c:out or bean:write to 
display this value, wrapped with span, div, or other tags which format 
your messages correctly.

I kind of think someone talked on the list once about making something 
which rendered an HTML "label" tag and which was also "smart" about the 
presence of errors.  I like the idea of something like that in general, 
but wonder if you'd be able to specify something suitably general for 
inclusion in Struts.  Seems like it might be better left for local 
development.

Joe
. . .
At 5:10 PM -0500 11/8/04, Erik Weber wrote:
Here is a way to do it that works with 1.1:



Username: 

Omitting the "name" attribute in this would have the same effect as 
including it - it's the default.  It's suggested that if you are storing 
messages in your actions using "saveErrors" or "saveMessages" (or 
dealing with validation errors, which are stored as if using 
"saveErrors") then you shouldn't specify "name" literally; instead, you 
can either rely on the default (to get errors) or use the "message" 
attribute with a value of "true" (to get saveMessages messages) or 
"false" (to get errors -- that is, the default behavior).  This helps to 
"encapsulate" the logic of how Struts handles those messages, and makes 
your JSP a bit less verbose also.

Additionally, your code above assumes that the nature of the error 
message is such that you know that the user should be shown the 
"error.username.required" message -- it's probably more flexible to let 
the validation/error handling framework create an ActionMessage object 
with that key itself, and then you would use the messages object; this 
way if any other error should come up (say you add a max-length 
restriction, or forbidden characters), then you don't have to change 
your JSP.

In another response I demonstrated how html:messages can be used to 
achieve the same result you had above, plus this added flexibility I 
mention.

Some people still like to use "html:errors", which predates 
html:messages and which has a slightly different syntax for providing 
any HTML which might "wrap" your messages.  Personally, I prefer 
html:messages.

None of this changed from Struts 1.1 to Struts 1.2.
Hope this helps,
   Joe
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


How to Known if there error for a property

2005-04-25 Thread Rodolfo =?iso-8859-1?Q?Garc=EDa_Esteban=2FCYII?=
Hi,

I´m using struts 1.2.4, after validate a form. I need to know if there is 
a message for a property before print, how can I do?

Thanks in advance,

Rodolfo


Re: PropertyUtils

2005-04-25 Thread Erik Weber
I could be mistaken, but I think what you want to look at is 
BeanUtils.copyProperties.

Erik
tarek.nabil wrote:
Hi everyone,
I have some insert and update actions where I copy the data the user
entered from the ActionForm to a DTO object which I send as a parameter
to my business method.
Since I can not conform the validity of the entered data before
validation, all the attributes in my ActionForm are of type String. My
DTO on the other hand has type safe fields. In my Action class, since I
know validation has been done successfully, I start copying the values
from type String fields to the type safe fields.
Someone once advised me that I don't have to do this manually, and that
I can use the PropertyUtils class from the org.apache.commons.beanutils
package to do this. I just tried that and it failed. I looked at the
documentation and I found several statements that say that type
conversion is not supported. So, the properties either have to be both
Strings or both Integers for example.
Can someone please advise me if constraint is true. Or is there another
way to automate this task?
Any help is appreciated.
Tarek Nabil
-
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]