Re: Checkling Security

2006-06-18 Thread Adam Samere
You can use the standard Servlet authorization/authentication mechanism, 
or use a Servlet filter, or use a custom ActionMappings class or common 
base Action subclass if you're bent on handling it within Struts.


-Adam

chamal desilva wrote:

Hi,

How should we test wether a user has permission for an
action. Can we do it in action class or do we have to
do it in EJB tier.

Thanking You,
Chamal.

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



Re: How to set size of submit button

2006-06-18 Thread Adam Samere
Frank and Eddie are right about not being able to read the css property 
unless you have set it ahead of time. The javascript Element Object 
(from which buttons etc are derived) has properties called clientWidth 
and clientHeight. This will give you the width and height of the element 
in pixels as rendered on the client. Hopefully that helps!


document.getElementById('b').clientWidth

-Adam

Eddie Bush wrote:

Frank,

I don't think you could extract the width from the control's style 
unless you'd set it.  I'd have to agree with you on that one.  Isn't 
there a property on the control (width?) you could determine the width 
from?  Maybe I answered too quick and should have done some research 
first.  I was thinking I had done something similar before, but as I 
dig deeper into my memory I realize that it was the height of an 
iframe I set, and that was based off the contained document's height 
(scroll height or some such thing).


I suppose it seemed intuitive to me that the button should have a 
width. I'll dig into my JavaScript book while at the office tomorrow 
and see if there isn't a property that a person can determine the 
width of a button with.  There's got to be a way to do it.  I'm 
curious now, too!  I have been wrong before though.


I'll try to pop-in at lunch and drop my findings ;-)

Eddie

- Original Message - From: "Frank W. Zammetti" 
<[EMAIL PROTECTED]>

To: "Struts Users Mailing List" 
Sent: Sunday, June 18, 2006 4:50 PM
Subject: Re: How to set size of submit button


Would that even work Eddie?  I seem to remember that if you didn't 
explicitly set the width of an element yourself, you can't retrieve 
it. Indeed, this quick test:








..results in a blank alert in both IE and FF.

This only matters of course if you have to make all the buttons the 
same width dynamically, but now I'm just curious!  Is there a way to 
do it I wonder?


Frank 



-
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: Organizing action classes

2006-06-07 Thread Adam Samere
Depending on what version of Struts you are using, you could check out 
org.apache.struts.actions.DispatchAction and it's subclasses. For the 
sake of maintainability and readability though I generally prefer to 
keep a 1 to 1 between action subclasses and path mappings, factoring 
common functionality into base action classes or helpers. Just personal 
opinion though.


-Adam

chamal desilva wrote:

Hi,

I have few action mapings.

/get_admin_tasks
/add_task
/ass_user
   etc.

/get_add_data
  /save_customer_data
  /save_account_data
  etc.

Is it necessary to write Action classes for each of
these actions or can we group several actions in to
one Action class.

What is the best way to organize actions in to action
classes.

Thanking You,
Chamal.

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



Re: displaying ActionMessages.GLOBAL_MESSAGE messages only

2006-06-07 Thread Adam Samere

Niall Pemberton wrote:

On 6/7/06, Adam Samere <[EMAIL PROTECTED]> wrote:

Niall Pemberton wrote:
> On 6/7/06, Joe Germuska <[EMAIL PROTECTED]> wrote:
>> At 12:47 PM -0700 6/7/06, Chris Cheshire wrote:
>> >In my actions I have messages stored in the session either under
>> >ActionMessages.GLOBAL_MESSAGE, or my own key (eg 'search').
>> >
>> >In my jsp I have a section to display the search specific messages.
>> >
>> >
>> >
>> >
>> >I also need to display the global messages at the top of the page,
>> >however this displays everything, including the search messages:
>> >
>> >
>> >...
>> >
>> >
>> >What do I set for the property to ONLY display the messages keyed by
>> >ActionMessages.GLOBAL_MESSAGE?
>>
>> technically, you would use
>>
>> > property="org.apache.struts.action.GLOBAL_MESSAGE">
>> 
>> 
>>
>> It has been observed that this is kind of cumbersome.  A nice
>> enhancement (that just about any willing volunteer could do, hint
>> hint :-) ) would be to enhance the logic:messagesPresent,
>> logic:messagesNotPresent, and html:messages and html:errors tags to
>> have another attribute, "global" which if it had the value"true"
>> would save you from needing to know that verbose property name.
>
> AFAIK there is no actual processing related to
> ActionMessages.GLOBAL_MESSAGE in Struts and it just means its a far
> more cumbersome key to use than something simple like a property name
> of "global" and IMO property="global" is not much different than
> global="true". I also think adding another attribute just adds
> confusion with global="true" being an alias for
> property="org.apache.struts.action.GLOBAL_MESSAGE"
>
>
> AFAIK there is no actual processing related to
> ActionMessages.GLOBAL_MESSAGE in Struts and adding another attribute
> just adds confusion with global="true" being an alias for
> property="org.apache.struts.action.GLOBAL_MESSAGE". Better for people
> to just use their own simpler property names to achieve the same thing
> - for example property="global" works just as well?
>
> Niall
>
This works fine if you handle it in the manner you described previously,
but does not account for any messages added by the framework, other
developers, etc. and forces developers to either implement their own
solution for "Give me all messages that have not been stored under a
custom property", hard code the org.apache.struts.action.GLOBAL_MESSAGE
key, or use scriptlets to grab the value. No?


Not sure I understand this - to my knowledge the framework doesn't add
any "global" messages. Also how does implementing a key of
"org.apache.struts.action.GLOBAL_MESSAGE" differ from implementing
your "own solution" of another key value - except that the other key
value doesn't have to be as cumbersome? Whatever you and "other
developers" do you have to agree to handshake on these things -
whether its with this value of the key or your own.

My sense of reading your comment is that you think that Struts is
providing you with some sort of solution - when in reality it isn't
actually doing anything wrt to this constant.

Niall

getActionMessages in org.apache.struts.taglib.TagUtils converts String 
and String[] to ActionMessage instances and stores them under 
ActionMessages.GLOBAL_MESSAGE.


My reason for jumping in on this thread was that it was suggested to use 
the literal key org.apache.struts.action.GLOBAL_MESSAGE in the messages 
tag, where my general intuition tells me it is a bad idea to resolve the 
value of a constant inside a 3rd party framework and plug it in as 
literal text. What happens to everyone who took this approach if the key 
is ever changed, or as Joe mentioned deprecated/removed? It just adds up 
to another task during a future upgrade. Your solution of storing the 
messages under your own less cumbersome key is probably the best one, 
but with the ActionMessages.GLOBAL_MESSAGE constant out there many 
people will continue to use it when manually creating and storing 
messages, forcing the use of either scriptlet expressions, direct 
reference to the literal, or additional code maintenance in order to 
achieve the relatively simple concept of "get me all the messages stored 
under the GLOBAL_MESSAGE key, but none of the others".


-Adam

>> Joe
>>
>> --
>> Joe Germuska
>> [EMAIL PROTECTED] * http://blog.germuska.com


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






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



Re: displaying ActionMessages.GLOBAL_MESSAGE messages only

2006-06-07 Thread Adam Samere

Niall Pemberton wrote:

On 6/7/06, Joe Germuska <[EMAIL PROTECTED]> wrote:

At 12:47 PM -0700 6/7/06, Chris Cheshire wrote:
>In my actions I have messages stored in the session either under
>ActionMessages.GLOBAL_MESSAGE, or my own key (eg 'search').
>
>In my jsp I have a section to display the search specific messages.
>
>
>
>
>I also need to display the global messages at the top of the page,
>however this displays everything, including the search messages:
>
>
>...
>
>
>What do I set for the property to ONLY display the messages keyed by
>ActionMessages.GLOBAL_MESSAGE?

technically, you would use





It has been observed that this is kind of cumbersome.  A nice
enhancement (that just about any willing volunteer could do, hint
hint :-) ) would be to enhance the logic:messagesPresent,
logic:messagesNotPresent, and html:messages and html:errors tags to
have another attribute, "global" which if it had the value"true"
would save you from needing to know that verbose property name.


AFAIK there is no actual processing related to
ActionMessages.GLOBAL_MESSAGE in Struts and it just means its a far
more cumbersome key to use than something simple like a property name
of "global" and IMO property="global" is not much different than
global="true". I also think adding another attribute just adds
confusion with global="true" being an alias for
property="org.apache.struts.action.GLOBAL_MESSAGE"


AFAIK there is no actual processing related to
ActionMessages.GLOBAL_MESSAGE in Struts and adding another attribute
just adds confusion with global="true" being an alias for
property="org.apache.struts.action.GLOBAL_MESSAGE". Better for people
to just use their own simpler property names to achieve the same thing
- for example property="global" works just as well?

Niall

This works fine if you handle it in the manner you described previously, 
but does not account for any messages added by the framework, other 
developers, etc. and forces developers to either implement their own 
solution for "Give me all messages that have not been stored under a 
custom property", hard code the org.apache.struts.action.GLOBAL_MESSAGE 
key, or use scriptlets to grab the value. No?

Joe

--
Joe Germuska
[EMAIL PROTECTED] * http://blog.germuska.com


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






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



Re: displaying ActionMessages.GLOBAL_MESSAGE messages only

2006-06-07 Thread Adam Samere
I agree that scriptlets are undesirable, but IMHO when compared with the 
consequences of having to track down and modify the key in every page 
that referenced it directly it's the lesser of two evils.


So the goal of the new attribute on the tags would be to display/test 
for only messages stored under the globals key? Which takes precedence 
then, name/property or global?


Joe Germuska wrote:

At 4:37 PM -0400 6/7/06, Samere, Adam J wrote:

How about just:


.


You don't want to tie your code to the actual key since that is an
implementation detail, that's what the public constant is for.


Another rationale for making the tags smart enough to handle that for 
you, while keeping scriptlet expressions out of your page!


Joe




-Original Message-
From: Joe Germuska [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 07, 2006 3:55 PM
To: Chris Cheshire; Struts Users Mailing List
Subject: Re: displaying ActionMessages.GLOBAL_MESSAGE messages only

At 12:47 PM -0700 6/7/06, Chris Cheshire wrote:

In my actions I have messages stored in the session either under
ActionMessages.GLOBAL_MESSAGE, or my own key (eg 'search').

In my jsp I have a section to display the search specific messages.
 


I also need to display the global messages at the top of the page,
however this displays everything, including the search messages:


...


What do I set for the property to ONLY display the messages keyed by
ActionMessages.GLOBAL_MESSAGE?


technically, you would use


.


It has been observed that this is kind of cumbersome.  A nice
enhancement (that just about any willing volunteer could do, hint hint
:-) ) would be to enhance the logic:messagesPresent,
logic:messagesNotPresent, and html:messages and html:errors tags to have
another attribute, "global" which if it had the value"true"
would save you from needing to know that verbose property name.

Joe

--
Joe Germuska
[EMAIL PROTECTED] * http://blog.germuska.com  
"You really can't burn anything out by trying something new, and

even if you can burn it out, it can be fixed.  Try something new."
-- Robert Moog

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


-
The information contained in this message may be privileged,
confidential, and protected from disclosure. If the reader of this
message is not the intended recipient, or any employee or agent
responsible for delivering this message to the intended recipient,
you are hereby notified that any dissemination, distribution, or
copying of this communication is strictly prohibited. If you have
received this communication in error, please notify us immediately
by replying to the message and deleting it from your computer.

Thank you. Paychex, Inc.


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







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



Re: How to pass request parameters through a waiting page?

2006-05-24 Thread Adam Samere

Starki,

I assume you have a form or a link on a page that the user submits. Here 
is a sample of a simple link with parameters:





Do 
Something


I'm making use of the set tag from the JSTL core tag library to set the 
parameters into a HashMap, then linking the the action.


The Action subclass I'm using is just a ForwardAction, which forwards to 
"wait.jsp"

From struts-config.xml:


Then, in the wait.jsp page, I pull the request parameters from the 
request instance (I'm using the runtime expression value version of the 
set tag here) and store them in a page scope variable called 
"parameters". Then I just set the url in the content attribute of the 
meta http-equiv tag to the value rendered by the html rewrite tag, 
passing the parameters map.




   scope="page"/>
   ">

   Untitled Document





Hope that helps!


starki78 wrote:

Hi Adam, an example
would be great!

This is really a great problem to us!
Especially then the post method is called!

Thanks a lot in advance
Starky


------ Initial Header ---

>From  : "Adam Samere" [EMAIL PROTECTED]
To  : "user" user@struts.apache.org
Cc  : 
Date  : Tue, 23 May 2006 22:16:44 -0400

Subject : Re: How to pass request parameters through a waiting page?







  

Hi Starki!

You should easily be able to grab the request parameters on your waiting page, then use them in the generated target URL. I'm assuming your waiting page 
then redirects the user to the target page using meta tags or javascript, right? I'll be happy to provide an example if you'd like.


Adam

Hi!

I set request-paramteres within an jsp
but introduced a waiting page to the next action.
Now the request parameter cannot be found anymore!
How can I achieve that the waiting jsp, recopies the
request-attributes? Is this possible in any way?
I don't want to write it to the session!

Thanks a lot!
Starki



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






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


  




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



Re: Ajax and MVC pattern

2006-05-24 Thread Adam Samere
I've recently used AJAX in some existing Struts applications making use 
of AjaxTags http://ajaxtags.sourceforge.net/. The Struts controller is 
still very much applicable, in that the Ajax requests are made to struts 
action urls, the action subclasses then delegate processing to business 
objects in the same way as we're used to, and finally forward to a JSP 
for generating the output. The major difference is the JSP's generate 
XML responses, rather than HTML/XHTML. Essentially they return either a 
page fragment or an XML item list of some type which is then parsed and 
stuffed into the client side DOM using javascript for immediate display.


Adam Hardy wrote:
I have only a small knowledge of the Ajax frameworks out there and I 
am trying to work out how much an Ajax app would depend on Struts.


I assume the view in an Ajax app is handled at the initial request by 
a JSP with HTML and that afterwards every request from the browser is 
XHR, ideally broken down on a per-data-item/list basis. The view HTML 
is from there on in handled by Ajax. In that case the Controller part 
of MVC would be managed entirely client-side.
Therefore all that struts would have to offer the app would be 
Validator and perhaps a couple of other services.
Or am I totally wrong? Can struts offer the ability to manage the 
Controller part of the app in such a way that the project could have 
two views - one in Ajax and one in JSPs?


I'm aware of much discussion of enhancing Struts Action 2 to 
facilitate Ajax development. It seems I'm missing something though. 
Can anyone elaborate a little on what it is facilitating?


Thanks
Adam

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






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



Re: How to pass request parameters through a waiting page?

2006-05-23 Thread Adam Samere

Hi Starki!

You should easily be able to grab the request parameters on your waiting page, then use them in the generated target URL. I'm assuming your waiting page 
then redirects the user to the target page using meta tags or javascript, right? I'll be happy to provide an example if you'd like.


Adam

Hi!

I set request-paramteres within an jsp
but introduced a waiting page to the next action.
Now the request parameter cannot be found anymore!
How can I achieve that the waiting jsp, recopies the
request-attributes? Is this possible in any way?
I don't want to write it to the session!

Thanks a lot!
Starki



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