Re: Invocation of type conversion manually

2010-12-13 Thread Chris Pratt
If you just need access to the parameters from the action, you can use:

String resource =
invocation.getProxy().getConfig().getParams().get("AuthoritationInterceptor.resource");

I've used this several times to get parameters from the configuration, but I
usually put the parameters on the action instead of on the interceptor since
I consider them resources of the action invocation.  I don't know if this
would also access the interceptor params or not.  I would go with something
more like:


   [...]
   
>
>Eco
>MenuGestor
>MenuBanquero
>MenuCliente
>
> [...]
>
  (*Chris*)

On Mon, Dec 13, 2010 at 9:05 PM, JOSE L MARTINEZ-AVIAL wrote:

> I know that the inteceptor knows which action is invoked. I just don't want
> it to need to be aware of that. That's why I assigned a resource for each
> action, using a parameter in the definition of the action:
>
> [...]
>
>
>Eco
>
>MenuGestor
>MenuBanquero
>MenuCliente
>
> [...]
>
> I could implement an interface for the action, but that would require
> defining an interface for each rule(since each rule needs different
> parameters). The second options is valid, but I like the idea of just
> declaring the getXXX method in the rule, and having the framework do the
> work for me(mostly, the type-conversion). What do you think?
>
>
> 2010/12/13 Maurizio Cucchiara 
>
> > Ok, now it's definitively clear.
> > First every interceptor knows exactly which action is invoked through
> > action
> > invocation.
> > With that said your action could implement (1) your custom interface or
> (2)
> > a generic Request Aware interface in order to retrieve request
> parameters.
> > Does this answer your question?
> >
> > Maurizio Cucchiara
> >
> > Il giorno 14/dic/2010 03.27, "JOSE L MARTINEZ-AVIAL" 
> ha
> > scritto:
> > Hi Maurizio, Li,
> >  Thanks for your suggestion, but the problem with the approaches you
> > suggested is that they link the security rules too much to the actions.
> We
> > want to be as abstract as possible. For that, we have developed the
> > following implementation:
> >
> >  We created some entities called SecurityResource which represent a set
> of
> > possible user actions. For example, we can have a SecurityResource called
> > SeeCustomer, that would be applied to any request related with seeing a
> > customer, or a SecurityResource called ModifyOwnProfile, used to filter
> any
> > action related to the modification of the profile. Every Action (unless
> it
> > is public) in the system is associated to a resource.
> >
> >  We have also define some entities called SecurityAssert. A
> SecurityAssert
> > is a rule that checks some conditions, and returns true or false. They
> are
> > implemented through classes that implement a specific interface. For each
> > SecurityResource we have a list of SecurityAsserts that need to be
> > validated. So our security definition look as follows:
> >
> >> class="com.test.rules.SecurityAssertHasRole">
> >   Regla de seguridad para comprobar si un usuario
> > tiene un rol
> >   
> >
> >> class="com.test.rules.SecurityAssertDistributionList">
> >   Regla de seguridad para comprobar si un usuario
> > puede acceder a las listas de distribucion
> >   
> >
> >   
> >> character="mandatory">
> >   
> >   Role1
> >   Role2
> >   Role3
> >   
> >   
> >   
> >
> >  Some of the rules need information from the request(customer number, for
> > example). In an ideal world the interceptor should not know anything
> about
> > the action it is trying to check. It should only invoke the rules, and
> > check
> > their results. So I(the interceptor) should to be able to pass parameters
> > from the request to the rule without actually having to know anything
> about
> > the request or the rules. Maybe the approach is complex, but we are
> > planning
> > to have some hundredths of actions, and be able to be as granular and
> > modular as possible with respect to security. Any ideas?
> >
> > thanks
> >
> > JL
> >
> > 2010/12/12 Li Ying 
> >
> >
> > > I think you don't need this bothering job.
> > >
> > > You can:
> > >
> > > (1)Define some properties in your bas...
> >
>


Re: Invocation of type conversion manually

2010-12-13 Thread JOSE L MARTINEZ-AVIAL
I know that the inteceptor knows which action is invoked. I just don't want
it to need to be aware of that. That's why I assigned a resource for each
action, using a parameter in the definition of the action:

[...]


Eco

MenuGestor
MenuBanquero
MenuCliente

[...]

I could implement an interface for the action, but that would require
defining an interface for each rule(since each rule needs different
parameters). The second options is valid, but I like the idea of just
declaring the getXXX method in the rule, and having the framework do the
work for me(mostly, the type-conversion). What do you think?


2010/12/13 Maurizio Cucchiara 

> Ok, now it's definitively clear.
> First every interceptor knows exactly which action is invoked through
> action
> invocation.
> With that said your action could implement (1) your custom interface or (2)
> a generic Request Aware interface in order to retrieve request parameters.
> Does this answer your question?
>
> Maurizio Cucchiara
>
> Il giorno 14/dic/2010 03.27, "JOSE L MARTINEZ-AVIAL"  ha
> scritto:
> Hi Maurizio, Li,
>  Thanks for your suggestion, but the problem with the approaches you
> suggested is that they link the security rules too much to the actions. We
> want to be as abstract as possible. For that, we have developed the
> following implementation:
>
>  We created some entities called SecurityResource which represent a set of
> possible user actions. For example, we can have a SecurityResource called
> SeeCustomer, that would be applied to any request related with seeing a
> customer, or a SecurityResource called ModifyOwnProfile, used to filter any
> action related to the modification of the profile. Every Action (unless it
> is public) in the system is associated to a resource.
>
>  We have also define some entities called SecurityAssert. A SecurityAssert
> is a rule that checks some conditions, and returns true or false. They are
> implemented through classes that implement a specific interface. For each
> SecurityResource we have a list of SecurityAsserts that need to be
> validated. So our security definition look as follows:
>
>class="com.test.rules.SecurityAssertHasRole">
>   Regla de seguridad para comprobar si un usuario
> tiene un rol
>   
>
>class="com.test.rules.SecurityAssertDistributionList">
>   Regla de seguridad para comprobar si un usuario
> puede acceder a las listas de distribucion
>   
>
>   
>character="mandatory">
>   
>   Role1
>   Role2
>   Role3
>   
>   
>   
>
>  Some of the rules need information from the request(customer number, for
> example). In an ideal world the interceptor should not know anything about
> the action it is trying to check. It should only invoke the rules, and
> check
> their results. So I(the interceptor) should to be able to pass parameters
> from the request to the rule without actually having to know anything about
> the request or the rules. Maybe the approach is complex, but we are
> planning
> to have some hundredths of actions, and be able to be as granular and
> modular as possible with respect to security. Any ideas?
>
> thanks
>
> JL
>
> 2010/12/12 Li Ying 
>
>
> > I think you don't need this bothering job.
> >
> > You can:
> >
> > (1)Define some properties in your bas...
>


Re: Invocation of type conversion manually

2010-12-13 Thread Maurizio Cucchiara
Ok, now it's definitively clear.
First every interceptor knows exactly which action is invoked through action
invocation.
With that said your action could implement (1) your custom interface or (2)
a generic Request Aware interface in order to retrieve request parameters.
Does this answer your question?

Maurizio Cucchiara

Il giorno 14/dic/2010 03.27, "JOSE L MARTINEZ-AVIAL"  ha
scritto:
Hi Maurizio, Li,
  Thanks for your suggestion, but the problem with the approaches you
suggested is that they link the security rules too much to the actions. We
want to be as abstract as possible. For that, we have developed the
following implementation:

  We created some entities called SecurityResource which represent a set of
possible user actions. For example, we can have a SecurityResource called
SeeCustomer, that would be applied to any request related with seeing a
customer, or a SecurityResource called ModifyOwnProfile, used to filter any
action related to the modification of the profile. Every Action (unless it
is public) in the system is associated to a resource.

  We have also define some entities called SecurityAssert. A SecurityAssert
is a rule that checks some conditions, and returns true or false. They are
implemented through classes that implement a specific interface. For each
SecurityResource we have a list of SecurityAsserts that need to be
validated. So our security definition look as follows:

   
   Regla de seguridad para comprobar si un usuario
tiene un rol
   

   
   Regla de seguridad para comprobar si un usuario
puede acceder a las listas de distribucion
   

   
   
   
   Role1
   Role2
   Role3
   
   
   

  Some of the rules need information from the request(customer number, for
example). In an ideal world the interceptor should not know anything about
the action it is trying to check. It should only invoke the rules, and check
their results. So I(the interceptor) should to be able to pass parameters
from the request to the rule without actually having to know anything about
the request or the rules. Maybe the approach is complex, but we are planning
to have some hundredths of actions, and be able to be as granular and
modular as possible with respect to security. Any ideas?

thanks

JL

2010/12/12 Li Ying 


> I think you don't need this bothering job.
>
> You can:
>
> (1)Define some properties in your bas...


Re: Iterate through a List of Maps

2010-12-13 Thread JOSE L MARTINEZ-AVIAL
That was fast! The version is 2.1.8.1. I'm gonna try your suggestion right
now, and let you now.

Thanks

JL

2010/12/13 Steven Yang 

> yes try adding "#" before "record" -> "#record"
>
> and since record is a map you can iterate through it directly without
> calling entrySet()
>
> On Tue, Dec 14, 2010 at 10:36 AM, Dave Newton 
> wrote:
>
> > What version? Early versions sometimes required a "#" before the
> > variable name when referencing vars defined by things like an iterator
> > tag.
> >
> > Dave
> >
> > On Monday, December 13, 2010, JOSE L MARTINEZ-AVIAL 
> > wrote:
> > > Hello all, I'm trying to iterate through a List of Maps(I have a method
> > > "public List getRecords()" in the action) using s:iterator. I can
> > > iterate through the List without problems, but I can not get it to
> > iterate
> > > through the entries of the map. So far I've got this:
> > >
> > > [..]
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > /
> > > 
> > > 
> > > 
> > > 
> > > [..]
> > >
> > > The tag generates the
> > >
> > > 
> > >
> > > for each entry, but it is not going through the second iterator, so I
> > > suppose I'm doing something wrong with the value attribute. Can you
> help
> > me
> > > with it?
> > >
> > > Thanks
> > >
> > > Jose
> > >
> >
> > -
> > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> > For additional commands, e-mail: user-h...@struts.apache.org
> >
> >
>


Re: Iterate through a List of Maps

2010-12-13 Thread Steven Yang
yes try adding "#" before "record" -> "#record"

and since record is a map you can iterate through it directly without
calling entrySet()

On Tue, Dec 14, 2010 at 10:36 AM, Dave Newton  wrote:

> What version? Early versions sometimes required a "#" before the
> variable name when referencing vars defined by things like an iterator
> tag.
>
> Dave
>
> On Monday, December 13, 2010, JOSE L MARTINEZ-AVIAL 
> wrote:
> > Hello all, I'm trying to iterate through a List of Maps(I have a method
> > "public List getRecords()" in the action) using s:iterator. I can
> > iterate through the List without problems, but I can not get it to
> iterate
> > through the entries of the map. So far I've got this:
> >
> > [..]
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > /
> > 
> > 
> > 
> > 
> > [..]
> >
> > The tag generates the
> >
> > 
> >
> > for each entry, but it is not going through the second iterator, so I
> > suppose I'm doing something wrong with the value attribute. Can you help
> me
> > with it?
> >
> > Thanks
> >
> > Jose
> >
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>


Re: Iterate through a List of Maps

2010-12-13 Thread Dave Newton
What version? Early versions sometimes required a "#" before the
variable name when referencing vars defined by things like an iterator
tag.

Dave

On Monday, December 13, 2010, JOSE L MARTINEZ-AVIAL  wrote:
> Hello all, I'm trying to iterate through a List of Maps(I have a method
> "public List getRecords()" in the action) using s:iterator. I can
> iterate through the List without problems, but I can not get it to iterate
> through the entries of the map. So far I've got this:
>
> [..]
> 
>         
>             
>                 
>             
>         
>         
>             
>             
>                 /
>             
>             
>         
>     
> [..]
>
> The tag generates the
>
> 
>
> for each entry, but it is not going through the second iterator, so I
> suppose I'm doing something wrong with the value attribute. Can you help me
> with it?
>
> Thanks
>
> Jose
>

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Iterate through a List of Maps

2010-12-13 Thread JOSE L MARTINEZ-AVIAL
Hello all, I'm trying to iterate through a List of Maps(I have a method
"public List getRecords()" in the action) using s:iterator. I can
iterate through the List without problems, but I can not get it to iterate
through the entries of the map. So far I've got this:

[..]









/




[..]

The tag generates the



for each entry, but it is not going through the second iterator, so I
suppose I'm doing something wrong with the value attribute. Can you help me
with it?

Thanks

Jose


Re: Invocation of type conversion manually

2010-12-13 Thread JOSE L MARTINEZ-AVIAL
Hi Maurizio, Li,
   Thanks for your suggestion, but the problem with the approaches you
suggested is that they link the security rules too much to the actions. We
want to be as abstract as possible. For that, we have developed the
following implementation:

   We created some entities called SecurityResource which represent a set of
possible user actions. For example, we can have a SecurityResource called
SeeCustomer, that would be applied to any request related with seeing a
customer, or a SecurityResource called ModifyOwnProfile, used to filter any
action related to the modification of the profile. Every Action (unless it
is public) in the system is associated to a resource.

   We have also define some entities called SecurityAssert. A SecurityAssert
is a rule that checks some conditions, and returns true or false. They are
implemented through classes that implement a specific interface. For each
SecurityResource we have a list of SecurityAsserts that need to be
validated. So our security definition look as follows:


Regla de seguridad para comprobar si un usuario
tiene un rol



Regla de seguridad para comprobar si un usuario
puede acceder a las listas de distribucion





Role1
Role2
Role3




   Some of the rules need information from the request(customer number, for
example). In an ideal world the interceptor should not know anything about
the action it is trying to check. It should only invoke the rules, and check
their results. So I(the interceptor) should to be able to pass parameters
from the request to the rule without actually having to know anything about
the request or the rules. Maybe the approach is complex, but we are planning
to have some hundredths of actions, and be able to be as granular and
modular as possible with respect to security. Any ideas?

thanks

JL

2010/12/12 Li Ying 

> I think you don't need this bothering job.
>
> You can:
>
> (1)Define some properties in your base class of all your action classes.
> (2)Use these properties to capture data from the request.
> (3)Run your interceptor AFTER the interceptors of struts2.
> But BEFORE the execution of the Action class
>
> So,
> The interceptors of struts2 will do the data-conversion for you.
> Your interceptor can simply extract parameters all you need from the
> Action instance.
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>


Re: cssClass attribute with <@s.textfield> ignored when inputError happens

2010-12-13 Thread Li Ying
I read the source of [simple/text.ftl], and found nothing
looks like rendering the extra [class="inputError"] attribute.

Can you tell me where it is?

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: cssClass attribute with <@s.textfield> ignored when inputError happens

2010-12-13 Thread struts . rgm
I did try that -- but unless simple/text.ftl changes, there will *still* be an 
unwanted "class='inputError'" before my cssClass and cssErrorClass attributes 
are handled by css.ftl.  Your example produces the following broken tag:



It's closer -- but I believe that a change needs to be made in the 
simple/text.ftl template to check for existence of the "cssClass" attribute, or 
determine if it's being called from the css_xhtml theme's text.ftl, in which 
case it could decide not to handle adding the inputError error class (because 
it would know that css.ftl handled the situation).  I plan on extending 
css_xhtml myself to deal with this problem, but was hoping to verify this issue 
with someone else, and get it on the dev team's radar if it's a real problem.

On Dec 13, 2010, at 6:32 PM, Li Ying - liying.cn.2...@gmail.com wrote:

> I read the source code of [simple/css.ftl],
> it looks like trying to combine [cssClass] and [cssErrorClass].
> 
> So you can try:
> 
> <@s.textfield name="port" value=port key="service.port" maxsize="5"
> cssClass="prop-port"
> cssErrorClass="inputError"
> />
> 
> see if the result is what you want?
> 
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
> 
> 



-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: cssClass attribute with <@s.textfield> ignored when inputError happens

2010-12-13 Thread Li Ying
I read the source code of [simple/css.ftl],
it looks like trying to combine [cssClass] and [cssErrorClass].

So you can try:

<@s.textfield name="port" value=port key="service.port" maxsize="5"
cssClass="prop-port"
cssErrorClass="inputError"
/>

see if the result is what you want?

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Struts 2.2.1 and Tag Lib oddities

2010-12-13 Thread Li Ying
I think the tag-lib [/struts-tags] is defined in
[struts2-core-2.2.1.jar/META-INF/struts-tags.tld].

Can you see this file in your Eclipse, under the [Web App Libraries]?

Or, can you see the [Web App Libraries] in the [Java Build Path =>
Libraries] of your web-app?

Or, you can [refresh] your whole app, see if the errors remain.

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Struts2 2.2.1 exploring annotations with struts2-convention-plugin and struts2-json-plugin

2010-12-13 Thread Ken McWilliams
I'm experimenting with Struts2 annotations and have some observations
that I'd like clarification on.

1) When using the convention plug-in the book "Apache Struts 2 Web
application Developement states" :


The plug-in will scan ... in Java packages whose names contain "struts",
"struts2", "action", and "actions", and whose classname ends in
"Action".


What I've found is that the package must end with one of those names,
can I set it to scan for packages actually containing those names?

Also in my configuration I can omit the Action suffix.  IE:
testAction.java can be renamed test.java and everything still works.



2) Well this is not annotation related but when working with the
struts2-json-plugin-2.2.1 I find it interesting that it needs getters
and setters as demonstrated by:

(Take note of the 3 commented lines near the end)
/ START ***/

package struts2;

import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;

@ParentPackage("json-default")
@Result(type = "json")
@Action("simpleJSON")
public class JSONExmapleSimple extends ActionSupport {
public String name = "ken";

public String execute(){
return SUCCESS;
}
//If uncommented action returns {"name":"ken"}
//If commented action returns {}
//public String getName() {return name;}
}

/* END /

This is a small detail I don't mind adding getters and setters the IDE
makes it easy but I just find it interesting that this isn't consistent
with what I'd expect based on the struts OGNL access: 



3) I was wondering if it is possible to apply a struts package
automatically based on the java package name.  I wonder this because...

@ParentPackage("json-default") can be applied to the java source package
statement or the Class although when I apply it to the package statement
I receive:

"package annotations should be in file package-info.java" from my IDE
(Netbeans 6.9.1) so if anyone knows if this is a Java standard great
otherwise it's an IDE specific thing and of no further issue here.

So simply that I found @ParentPackage which by it's application to a
package statement and the earlier statement from 1) about the package
name merely needing to contain the string "struts2" (among others) I was
hoping that the last name in the package could be used to specify the
struts xml package to which it belongs? It would be pretty cool! 


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Struts2 2.2.1 exploring annotations with struts2-convention-plugin and struts2-json-plugin

2010-12-13 Thread Ken McWilliams
I'm experimenting with Struts2 annotations and have some observations
that I'd like clarification on.

1) When using the convention plug-in the book "Apache Struts 2 Web
application Developement states" :


The plug-in will scan ... in Java packages whose names contain "struts",
"struts2", "action", and "actions", and whose classname ends in
"Action".


What I've found is that the package must end with one of those names,
can I set it to scan for packages actually containing those names?

Also in my configuration I can omit the Action suffix.  IE:
testAction.java can be renamed test.java and everything still works.



2) Well this is not annotation related but when working with the
struts2-json-plugin-2.2.1 I find it interesting that it needs getters
and setters as demonstrated by:

(Take note of the 3 commented lines near the end)
/ START ***/

package struts2;

import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;

@ParentPackage("json-default")
@Result(type = "json")
@Action("simpleJSON")
public class JSONExmapleSimple extends ActionSupport {
public String name = "ken";

public String execute(){
return SUCCESS;
}
//If uncommented action returns {"name":"ken"}
//If commented action returns {}
//public String getName() {return name;}
}

/* END /

This is a small detail I don't mind adding getters and setters the IDE
makes it easy but I just find it interesting that this isn't consistent
with what I'd expect based on the struts OGNL access: 



3) I was wondering if it is possible to apply a struts package
automatically based on the java package name.  I wonder this because...

@ParentPackage("json-default") can be applied to the java source package
statement or the Class although when I apply it to the package statement
I receive:

"package annotations should be in file package-info.java" from my IDE
(Netbeans 6.9.1) so if anyone knows if this is a Java standard great
otherwise it's an IDE specific thing and of no further issue here.

So simply that I found @ParentPackage which by it's application to a
package statement and the earlier statement from 1) about the package
name merely needing to contain the string "struts2" (among others) I was
hoping that the last name in the package could be used to specify the
struts xml package to which it belongs? It would be pretty cool!


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Struts2 2.2.1 exploring annotations with struts2-convention-plugin and struts2-json-plugin

2010-12-13 Thread Ken McWilliams
My bad #1 is resolved... 
I had left my jsp's in /WEB-INF/content not realizing that the java 

package mypackage.struts2.otherpackage.MyAction

Didn't map to: /my but /otherpackage/my

The examples I'd seen had a package ending in "actions" and I'd made an
assumption. 

On Mon, 2010-12-13 at 15:37 -0700, Ken McWilliams wrote:
> I'm experimenting with Struts2 annotations and have some observations
> that I'd like clarification on.
> 
> 1) When using the convention plug-in the book "Apache Struts 2 Web
> application Developement states" :
> 
> 
> The plug-in will scan ... in Java packages whose names contain "struts",
> "struts2", "action", and "actions", and whose classname ends in
> "Action".
> 
> 
> What I've found is that the package must end with one of those names,
> can I set it to scan for packages actually containing those names?
> 
> Also in my configuration I can omit the Action suffix.  IE:
> testAction.java can be renamed test.java and everything still works.
> 
> 
> 
> 2) Well this is not annotation related but when working with the
> struts2-json-plugin-2.2.1 I find it interesting that it needs getters
> and setters as demonstrated by:
> 
> (Take note of the 3 commented lines near the end)
> / START ***/
> 
> package struts2;
> 
> import com.opensymphony.xwork2.ActionSupport;
> import org.apache.struts2.convention.annotation.Action;
> import org.apache.struts2.convention.annotation.ParentPackage;
> import org.apache.struts2.convention.annotation.Result;
> 
> @ParentPackage("json-default")
> @Result(type = "json")
> @Action("simpleJSON")
> public class JSONExmapleSimple extends ActionSupport {
> public String name = "ken";
> 
> public String execute(){
> return SUCCESS;
> }
> //If uncommented action returns {"name":"ken"}
> //If commented action returns {}
> //public String getName() {return name;}
> }
> 
> /* END /
> 
> This is a small detail I don't mind adding getters and setters the IDE
> makes it easy but I just find it interesting that this isn't consistent
> with what I'd expect based on the struts OGNL access:  value="I_Only_Need_A_Pulic_Field_Now_Which_Is_Cool"/>
> 
> 
> 
> 3) I was wondering if it is possible to apply a struts package
> automatically based on the java package name.  I wonder this because...
> 
> @ParentPackage("json-default") can be applied to the java source package
> statement or the Class although when I apply it to the package statement
> I receive:
> 
> "package annotations should be in file package-info.java" from my IDE
> (Netbeans 6.9.1) so if anyone knows if this is a Java standard great
> otherwise it's an IDE specific thing and of no further issue here.
> 
> So simply that I found @ParentPackage which by it's application to a
> package statement and the earlier statement from 1) about the package
> name merely needing to contain the string "struts2" (among others) I was
> hoping that the last name in the package could be used to specify the
> struts xml package to which it belongs? It would be pretty cool! 
> 
> 
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
> 



-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Struts2 2.2.1 exploring annotations with struts2-convention-plugin and struts2-json-plugin

2010-12-13 Thread Ken McWilliams
I'm experimenting with Struts2 annotations and have some observations
that I'd like clarification on.

1) When using the convention plug-in the book "Apache Struts 2 Web
application Developement states" :


The plug-in will scan ... in Java packages whose names contain "struts",
"struts2", "action", and "actions", and whose classname ends in
"Action".


What I've found is that the package must end with one of those names,
can I set it to scan for packages actually containing those names?

Also in my configuration I can omit the Action suffix.  IE:
testAction.java can be renamed test.java and everything still works.



2) Well this is not annotation related but when working with the
struts2-json-plugin-2.2.1 I find it interesting that it needs getters
and setters as demonstrated by:

(Take note of the 3 commented lines near the end)
/ START ***/

package struts2;

import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;

@ParentPackage("json-default")
@Result(type = "json")
@Action("simpleJSON")
public class JSONExmapleSimple extends ActionSupport {
public String name = "ken";

public String execute(){
return SUCCESS;
}
//If uncommented action returns {"name":"ken"}
//If commented action returns {}
//public String getName() {return name;}
}

/* END /

This is a small detail I don't mind adding getters and setters the IDE
makes it easy but I just find it interesting that this isn't consistent
with what I'd expect based on the struts OGNL access: 



3) I was wondering if it is possible to apply a struts package
automatically based on the java package name.  I wonder this because...

@ParentPackage("json-default") can be applied to the java source package
statement or the Class although when I apply it to the package statement
I receive:

"package annotations should be in file package-info.java" from my IDE
(Netbeans 6.9.1) so if anyone knows if this is a Java standard great
otherwise it's an IDE specific thing and of no further issue here.

So simply that I found @ParentPackage which by it's application to a
package statement and the earlier statement from 1) about the package
name merely needing to contain the string "struts2" (among others) I was
hoping that the last name in the package could be used to specify the
struts xml package to which it belongs? It would be pretty cool! 


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



cssClass attribute with <@s.textfield> ignored when inputError happens

2010-12-13 Thread struts . rgm
When a validation error occurs with the css_xhtml theme, the CSS class for a 
form input does not have the correct class attributes, if a "cssClass" has been 
supplied.   Instead of class "inputError" joining the existing "class" which is 
specified by the "cssClass" form tag attribute, two separate class attributes 
are added to the element.  Google Chrome only sees the first CSS class.

AKA:
Given the following struts2 freemarker snippet:

<@s.textfield name="port" value=port key="service.port" maxsize="5" 
cssClass="prop-port" /> 

When a validation error occurs, I end up with a form input element like:



I would expect one single class attribute containing both class values 
separated by a space, like  class="prop-port inputError"
I'm using Struts 2.2.1.  I do see code meant to handle this in simple/css.ftl, 
but I'm not sure why that isn't being used.
Instead, I seem to be getting the code from simple/text.ftl, which blindly adds 
a "class" attribute without checking about errors.

Does anyone have any suggestions?

-Roland

Re: execAndWait Interceptor

2010-12-13 Thread Zoran Avtarovski
We use the interceptor for interrogating a legacy database where we have
no control over the execution or timing of the query.

We basically have an API we call and then wait in hope.

I have to say that I've found the interceptor to be inconsistent at best.

For example we have some queries that are actually quite quick but the
interceptor insists on doing at least one page refresh before returning a
result. We've tried tweaking all the setting with absolutely no joy.

On the last project, we actually implemented an ajax solution which was
far more elegant result.

Z.

On 10/12/10 3:11 AM, "stanl...@gmail.com"  wrote:

>Does anyone actually use this interceptor?  I have a team asking me about
>it's use in production and how this solution would compare to a jQuery
>solution.  I played around with it lst night and am skeptical about it.
>For
>one thing, the documentation says
>
>"The ExecuteAndWaitInterceptor is great for running long-lived actions in
>the background while showing the user a nice progress meter. This also
>prevents the HTTP request from timing out when the action takes more than
>5
>or 10 minutes."
>
>and a request like that would get me fired!
>
>Peace,
>Scott



-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: [S2.2.1] Struts Type Converter for "sub-model" objects not working?

2010-12-13 Thread Lukasz Lenart
Did you try to user annotation @TypeConversion ?


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/
Kapituła Javarsovia http://javarsovia.pl

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: EmailValidator

2010-12-13 Thread Brian Thompson
TBF, it was a really old version of XWork.  It was addressed and made more
complicated in the most recent version at the time I looked into it (still
not *fixed*, though ... everyone knows how to validate an email address
until they actually read the RFCs!).

-Brian



On Mon, Dec 13, 2010 at 1:00 PM, Greg Akins  wrote:

> On Mon, Dec 13, 2010 at 1:50 PM, Brian Thompson 
> wrote:
> > I've looked into this before.  The email validator resolved down to some
> > really old code in XWork with a regex that looked something like this:
> >
> > [a-z0-...@[a-z0-9].[a-z]^3
>
> Thanks.. I hadn't looked at the source.. It looks like the API docs
> don't quite match the source then, either.
> --
> Greg Akins
>
> http://insomnia-consulting.org
> http://www.pghcodingdojo.org
> http://pittjug.dev.java.net
> http://twitter.com/akinsgre
> http://www.linkedin.com/in/akinsgre
>


Re: EmailValidator

2010-12-13 Thread Greg Akins
On Mon, Dec 13, 2010 at 1:50 PM, Brian Thompson  wrote:
> I've looked into this before.  The email validator resolved down to some
> really old code in XWork with a regex that looked something like this:
>
> [a-z0-...@[a-z0-9].[a-z]^3

Thanks.. I hadn't looked at the source.. It looks like the API docs
don't quite match the source then, either.
-- 
Greg Akins

http://insomnia-consulting.org
http://www.pghcodingdojo.org
http://pittjug.dev.java.net
http://twitter.com/akinsgre
http://www.linkedin.com/in/akinsgre

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: EmailValidator

2010-12-13 Thread Greg Akins
On Mon, Dec 13, 2010 at 12:20 PM, Dave Newton  wrote:
> IIRC the default email validator isn't as robust as the page- long RFC email
> regex. I'd suggest either a patch, ora custom validator.
>

Thanks.  I'll try to submit a patch after I get something more robust working

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: EmailValidator

2010-12-13 Thread Brian Thompson
I've looked into this before.  The email validator resolved down to some
really old code in XWork with a regex that looked something like this:

[a-z0-...@[a-z0-9].[a-z]^3

I strongly agree with Dave's advice.  Broken email validators are too common
on the web.

-Brian


On Mon, Dec 13, 2010 at 11:20 AM, Dave Newton  wrote:

> IIRC the default email validator isn't as robust as the page- long RFC
> email
> regex. I'd suggest either a patch, ora custom validator.
>
> Dave
>  On Dec 13, 2010 12:11 PM, "Greg Akins"  wrote:
> > I just tried to use angrygreg+...@gmail.com <
> angrygreg%2b...@gmail.com > as
> an email , and the
> > Struts EmailValidator doesn't like it (Struts 2.2.1)
> >
> > I'm not that great at reading regexp.. it looks like maybe the regexp
> > should support that email address.. but I'm not sure.
> >
> > Can anyone comment on whether EmailValidator is the best approach?
> >
> > --
> > Greg Akins
> >
> > http://insomnia-consulting.org
> > http://www.pghcodingdojo.org
> > http://pittjug.dev.java.net
> > http://twitter.com/akinsgre
> > http://www.linkedin.com/in/akinsgre
> >
> > -
> > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> > For additional commands, e-mail: user-h...@struts.apache.org
> >
>


Re: EmailValidator

2010-12-13 Thread Dave Newton
IIRC the default email validator isn't as robust as the page- long RFC email
regex. I'd suggest either a patch, ora custom validator.

Dave
 On Dec 13, 2010 12:11 PM, "Greg Akins"  wrote:
> I just tried to use angrygreg+...@gmail.com  as
an email , and the
> Struts EmailValidator doesn't like it (Struts 2.2.1)
>
> I'm not that great at reading regexp.. it looks like maybe the regexp
> should support that email address.. but I'm not sure.
>
> Can anyone comment on whether EmailValidator is the best approach?
>
> --
> Greg Akins
>
> http://insomnia-consulting.org
> http://www.pghcodingdojo.org
> http://pittjug.dev.java.net
> http://twitter.com/akinsgre
> http://www.linkedin.com/in/akinsgre
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>


EmailValidator

2010-12-13 Thread Greg Akins
I just tried to use angrygreg+...@gmail.com as an email , and the
Struts EmailValidator doesn't like it (Struts 2.2.1)

I'm not that great at reading regexp.. it looks like maybe the regexp
should support that email address.. but I'm not sure.

Can anyone comment on whether EmailValidator is the best approach?

-- 
Greg Akins

http://insomnia-consulting.org
http://www.pghcodingdojo.org
http://pittjug.dev.java.net
http://twitter.com/akinsgre
http://www.linkedin.com/in/akinsgre

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Struts 2.2.1 and Tag Lib oddities

2010-12-13 Thread RogerV

Hi

I've just upgraded to 2.2.1 from 2.1.8 and I guess I must have missed a
piece of documentation somewhere. My IDE (Eclipse Helios) is now flagging
all my .jsp files as being in error. Specifically, it complains that it
cannot find the tag library descriptor "/struts-tags" (<%@ taglib prefix="s"
uri="/struts-tags"%>)although this seems to have had no effect on deploying
them to Tomcat successfully. At first I thought I'd fsked up somewhere so I
reverted back to 2.1.8 and the problem dissappeared, going back to 2.2.1 the
problem re-appears, so it definitely struts related. I'm getting the same
problem with the sitemesh tags as well (<%@ taglib prefix="decorator"
uri="http://www.opensymphony.com/sitemesh/decorator"; %>)

Anyone got any idea as to what has changed?

Regards

-- 
View this message in context: 
http://old.nabble.com/Struts-2.2.1-and-Tag-Lib-oddities-tp30446243p30446243.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: [S2.2.1] Struts Type Converter for "sub-model" objects not working?

2010-12-13 Thread Burton Rhodes
Thanks guys for your reponses, but I think I may have been unclear in
my question.  I have a class called MyCurrencyConverter that converts
a string to a BigDecimal by stripping the "$", commas, etc. - this
works fine.  The problem arises when struts does not call
MyCurrencyConverter for the nested class "Contact -> ContactLead"
("Contact" class has a member variable "ContactLead" class all with
getters/setters).

For the code below, the first field converts just fine and I can track
this in my debugger.  But for the second field, MyCurrencyConverter is
never called by Struts.  I am wondering if this is a bug.  I would
have thought Struts would be smart enough to map the nested
ContactLead class to the conversion.properties file.

JSP snippet:





ContactCreateAction-conversion.properties:
contactLead.income=com.afs.web.converter.MyCurrencyConverter
contact.contactLead.income=com.afs.web.converter.MyCurrencyConverter

Thanks,
Burton

On Mon, Dec 13, 2010 at 1:09 AM, Lukasz Lenart
 wrote:
> 2010/12/12 Burton Rhodes :
>> I know. I don't have a setIncome(String) method. But I do have
>> setIncome(BigDecimal) method , hence the type conversion. Normally the
>> class MyCurrencyCoverter will covert the String to BigDecimal, but
>> it's never called. I am wondering what I am doing wrong that the
>> conversion class is not called.
>
> String to BigDecimal conversion is built-in functionality and looks
> like your user is entering $ at the beginning of the field Income
> that's why Sturts falling with conversion.
>
> The current converter treats an input string as whole, there is no
> parsing to extract numbers, you write your own and assign it to all
> BigDecimal types
> http://struts.apache.org/2.x/docs/type-conversion.html#TypeConversion-ApplyingaTypeConverterforanapplication
>
>
> Regards
> --
> Łukasz
> + 48 606 323 122 http://www.lenart.org.pl/
> Kapituła Javarsovia 2010 http://javarsovia.pl
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



RE: E-Commerce website using struts

2010-12-13 Thread Martin Gainty

salesforce..peoplesoft..goldmine are crm packages that work as well
if you want to drive sales for your software why not find the limitations of 
these other packages
and post how your software meets or exceeds the limitations inherent with each 
package

Not a shill for peoplesoft..salesforce..goldmine or shopizer

Viel Gluck!
Martin 
__ 
Jogi és Bizalmassági kinyilatkoztatás/Verzicht und 
Vertraulichkeitanmerkung/Note de déni et de confidentialité
 Ez az
üzenet bizalmas.  Ha nem ön az akinek szánva volt, akkor kérjük, hogy
jelentse azt nekünk vissza. Semmiféle továbbítása vagy másolatának
készítése nem megengedett.  Ez az üzenet csak ismeret cserét szolgál és
semmiféle jogi alkalmazhatósága sincs.  Mivel az electronikus üzenetek
könnyen megváltoztathatóak, ezért minket semmi felelöség nem terhelhet
ezen üzenet tartalma miatt.

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger 
sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung 
oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem 
Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. 
Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung 
fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le 
destinataire prévu, nous te demandons avec bonté que pour satisfaire informez 
l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est 
interdite. Ce message sert à l'information seulement et n'aura pas n'importe 
quel effet légalement obligatoire. Étant donné que les email peuvent facilement 
être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité 
pour le contenu fourni.




> Date: Mon, 13 Dec 2010 11:14:50 +0530
> Subject: Re: E-Commerce website using struts
> From: aum.str...@gmail.com
> To: user@struts.apache.org
> 
> if taking about struts2 here it is
> http://www.shopizer.com/
> 
> On Fri, Dec 10, 2010 at 11:40 AM, ashish chawre
> wrote:
> 
> > Hi, Is any body having any idea about the source/example of any ecommerce
> > website implementation using struts?
> > I am looking to implement a checkout using struts and I need to implement
> > shopping cart as well.
> >
> > Any help will be greatly appreciated.
> >
> > Thanks!
> > -- Ashish
> >