Re: Submit not passing the form input to the action

2010-04-28 Thread Kartik Kumar
Hi Martin,

Thanks for replying. I loked at I am iterating through the collection to
display some the items as follows:



   









There is a submit button for every row. I want to update the value of a bean
attribute status with the value from the drop down. I have tried to change
the invocation from submit to get using . But I am not able to get status attribute to be
populated in my action class.


On Wed, Apr 28, 2010 at 5:27 PM, Martin Gainty  wrote:

>
> the list attribute defined is the variable bound from the action as seen
> here with a bound Collection variable called availableItems
>
>   name="currentEmployee.mainSkill.name"/>
> public abstract class AbstractCRUDAction extends ActionSupport {
>private Collection availableItems;
>
> the hidden field needs a value attribute and a id attribute as seen here:
> 
>
> Martin Gainty
> __
> Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
>
> 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: Wed, 28 Apr 2010 13:31:05 -0700
> > Subject: Submit not passing the form input to the action
> > From: krishnan.1...@gmail.com
> > To: user@struts.apache.org
> >
> > Hi,
> >
> > I have a use case in which we iterate through the items in the list and
> > display them on the page. We do that with s:iterator tag.
> >
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > * >  headerValue="Change Status" list="statuses" />*
> > 
> > 
> >   
> >  * *
> > 
> > 
> > 
> >
> > I have a s:submit tag that inovkes the appropriate action class and
> method.
> > For update to work, I have to to update the back end with a new pull down
> > menu value from db and is given below:
> >
> > * >  headerValue="Change Status" list="statuses" />*
> >
> > I also have a hidden field "id" that I used to identify the identity of
> the
> > bean to be updated and is given below:
> > 
> >
> > and I have a submit button for every entry in the list being iterated
> >
> > My issues is that my action class is not getting any value from "id" and
> > "actionStatus" field even though they are defined in my action class. I
> > don't know what is going wrong. The action is being invoked but these
> fields
> > have a null value.
> >
> > Any help would be appreciated.
> >
> > Thanks,
> >
> > Kartik
>
> _
> The New Busy think 9 to 5 is a cute idea. Combine multiple calendars with
> Hotmail.
>
> http://www.windowslive.com/campaign/thenewbusy?tile=multicalendar&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_5
>


RE: Submit not passing the form input to the action

2010-04-28 Thread Martin Gainty

the list attribute defined is the variable bound from the action as seen here 
with a bound Collection variable called availableItems


public abstract class AbstractCRUDAction extends ActionSupport {
private Collection availableItems;

the hidden field needs a value attribute and a id attribute as seen here:


Martin Gainty 
__ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
 
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: Wed, 28 Apr 2010 13:31:05 -0700
> Subject: Submit not passing the form input to the action
> From: krishnan.1...@gmail.com
> To: user@struts.apache.org
> 
> Hi,
> 
> I have a use case in which we iterate through the items in the list and
> display them on the page. We do that with s:iterator tag.
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> *  headerValue="Change Status" list="statuses" />*
> 
> 
>   
>  * *
> 
> 
> 
> 
> I have a s:submit tag that inovkes the appropriate action class and method.
> For update to work, I have to to update the back end with a new pull down
> menu value from db and is given below:
> 
> *  headerValue="Change Status" list="statuses" />*
> 
> I also have a hidden field "id" that I used to identify the identity of the
> bean to be updated and is given below:
> 
> 
> and I have a submit button for every entry in the list being iterated
> 
> My issues is that my action class is not getting any value from "id" and
> "actionStatus" field even though they are defined in my action class. I
> don't know what is going wrong. The action is being invoked but these fields
> have a null value.
> 
> Any help would be appreciated.
> 
> Thanks,
> 
> Kartik
  
_
The New Busy think 9 to 5 is a cute idea. Combine multiple calendars with 
Hotmail. 
http://www.windowslive.com/campaign/thenewbusy?tile=multicalendar&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_5

Submit not passing the form input to the action

2010-04-28 Thread Kartik Kumar
Hi,

I have a use case in which we iterate through the items in the list and
display them on the page. We do that with s:iterator tag.











**


  
 * *




I have a s:submit tag that inovkes the appropriate action class and method.
For update to work, I have to to update the back end with a new pull down
menu value from db and is given below:

**

I also have a hidden field "id" that I used to identify the identity of the
bean to be updated and is given below:


and I have a submit button for every entry in the list being iterated

My issues is that my action class is not getting any value from "id" and
"actionStatus" field even though they are defined in my action class. I
don't know what is going wrong. The action is being invoked but these fields
have a null value.

Any help would be appreciated.

Thanks,

Kartik


Re: Annotation Validation

2010-04-28 Thread mrsv

Did you try  something like this?

@RequiredStringValidator(
fieldName = "label.name",
key ="error.required ",
message = "Name required.")}


Alex Rodriguez Lopez wrote:
> 
> Hi struts users!
> 
> I'm on my way to change from XML based validation to annotation
> validation.
> 
> I've manage to get it working, but (probably due to my little knowledge 
> of Java annotations) there are some things I can't get to work, so I 
> apologise if this question is not entirelly Struts related.
> 
> I'm trying to get the following XML based validation to annotations at 
> method level:
> 
> 
>   
>   
>  ${getText("error.required", 
> {getText("label.name")})}
>   
>   
> ...
> 
> 
> So far this works in my action:
> 
> @Validations(
>   requiredStrings = {
>   @RequiredStringValidator(
>   fieldName = "user.name",
>   message = "Name required.")}
> )
> public String save() {
>   ...
>   return SUCCESS;
> }
> 
> But the problem is with this bit ${getText("error.required", 
> {getText("label.name")})} which retrieves a message that has 
> arguments (also retrieved from a resource bundle).
> 
> So how should I use the annotation parameters (key or message) to 
> retrieve a key with args?
> 
> I tried message = getText("error.required", new 
> String[]{getText("label.name")})
> 
> but of course values of annotation params must be constant, and I cannot 
> define a static value that depends on a getText() lookup.
> 
> Is this ever possible to do with annotations?
> 
> Any help appreciated!!
> 
> Summary: How to use i18n messages with args using annotations for field 
> validation?
> 
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
> 
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Annotation-Validation-tp28387213p28393625.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: input fields with dynamic names

2010-04-28 Thread Mitch Claborn
That works for setting parameter names, but not so well when the tags in 
the JSP need to retrieve the value for display in the page, particularly 
if there is a validation error.  If there is a static field named "fred" 
and the action has a "getFred()" method, then all is good.  But the 
field names in my case are dynamic, so I can't have a getN for all 
of the dynamic fields.


mitch


Greg Lindholm wrote:

You are probably looking for ParameterAware

http://struts.apache.org/2.x/struts2-core/apidocs/org/apache/struts2/interceptor/ParameterAware.html


On Wed, Apr 28, 2010 at 12:47 PM, Mitch Claborn  wrote:
  

I'm sure I've seen the answer to this somewhere, but darned if I can find it
now when I need it!

I have a page that allows edits of various options, the names of which are
dynamically retrieved from the database.  If I have the code in the JSP as
below, the value displayed in the text field is always that from the
database.  If there is a validation error, the user's input value is not
maintained as it would be if there were an explicit getter/setter for each
option name.  Is there a way to code the Action (or the JSP) so that the
value shown is the user's input value if there is an error?




Mitch


-
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


  


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



Re: input fields with dynamic names

2010-04-28 Thread Greg Lindholm
You are probably looking for ParameterAware

http://struts.apache.org/2.x/struts2-core/apidocs/org/apache/struts2/interceptor/ParameterAware.html


On Wed, Apr 28, 2010 at 12:47 PM, Mitch Claborn  wrote:
> I'm sure I've seen the answer to this somewhere, but darned if I can find it
> now when I need it!
>
> I have a page that allows edits of various options, the names of which are
> dynamically retrieved from the database.  If I have the code in the JSP as
> below, the value displayed in the text field is always that from the
> database.  If there is a validation error, the user's input value is not
> maintained as it would be if there were an explicit getter/setter for each
> option name.  Is there a way to code the Action (or the JSP) so that the
> value shown is the user's input value if there is an error?
>
>         
>                  id="${o.optionName}" value="${o.valueInt}" />
>
> Mitch
>
>
> -
> 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



input fields with dynamic names

2010-04-28 Thread Mitch Claborn
I'm sure I've seen the answer to this somewhere, but darned if I can 
find it now when I need it!


I have a page that allows edits of various options, the names of which 
are dynamically retrieved from the database.  If I have the code in the 
JSP as below, the value displayed in the text field is always that from 
the database.  If there is a validation error, the user's input value is 
not maintained as it would be if there were an explicit getter/setter 
for each option name.  Is there a way to code the Action (or the JSP) so 
that the value shown is the user's input value if there is an error?


 
 id="${o.optionName}" value="${o.valueInt}" />


Mitch


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



Re: S2 validation without API ties

2010-04-28 Thread Wes Wannemacher
Chris,

There are a few non-struts/xwork-validation plugins that integrate
with general purpose validation mechanisms. Off the top of my head, I
remember this -

https://cwiki.apache.org/confluence/display/WW/OVal+Plugin

But, I think there are two distinctly different things you are
considering here. If you want to validate class instances that aren't
linked in any way against struts/xwork libraries, then you should
simply separate your validateable objects from your struts actions...
For instance -

public class YourAction extends ActionSupport {
private YourValidateableBean propName ;
// getters/setters/etc.

public String execute() {
return propName.execute();
}
}

I can understand your desire to remove the dependency of struts,
making your actions reusable. But at the same time, without the helper
methods that ActionSupport provides, implementing a mechanism for
displaying validation failure error messages in the struts tags
becomes extremely difficult. I will add, ActionSupport is linked only
against classes provided by the JDK. And, that extending ActionSupport
isn't a requirement, but not extending it means you will lose mostly
the integration with the tags on the frontend.

Even if you still don't want struts/xwork classes in your validation,
i would suggest the OVal plugin, combined with a delegatory setup for
executing your beans.

-Wes

On Wed, Apr 28, 2010 at 11:32 AM, Christopher Schultz
 wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> Rahul,
>
> On 4/27/2010 1:09 AM, Rahul Mohan wrote:
>> I think the fundamental mechanism of S2 is the configurable interceptor
>> stack where each interceptor applies itself to the current action based on
>> the interfaces the action implements. You can still reuse this mechanism
>> by defining your own interceptor stack with your own interfaces. Lets S2 (
>> or rather xwork ) take care of the wiring. Essentially, building your
>> framework using the underlying configurable interceptor stack mechanism.
>> Does that answer your question?
>
> Not really what I'm trying to do is build an action that does not
> depend upon the S2/xwork APIs, but can still work with them.
>
> Specifically, I'd rather have:
>
> public class MyAction
>   extends (nothing)
>   implements (Nothing)
> {
>  public void addFieldError(String field, String message) { ... };
> }
>
> rather than this:
>
> public class MyAction
>  extends ActionSupport
>  and/or
>  implements ValidationAware
> {
>  // addError declared in ValidationAware
>  public void addFieldError(String field, String message) { ... };
> }
>
> I believe the ValidationInterceptor has code that looks something like this:
>
> if(action instanceof ValidationAware)
> {
>   foreach field {
>     validate field
>
>     if(error)
>       action.addFieldError(fieldName, errorMessage);
>   }
> }
>
> I was wondering if there was any interest in an alternative
> implementation that did something more like this:
>
> if(declaresValidationMethods(action.getClass())
> {
>   foreach field {
>     validate field
>
>     if(error)
>       action.addFieldError(fieldName, errorMessage);
>   }
> }
>
> I could certainly implement this myself, but I'm wondering if there is
> wider interest in such an interceptor.
>
> Thanks,
> - -chris
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.10 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iEYEARECAAYFAkvYVScACgkQ9CaO5/Lv0PBmaQCfRGHa7iD3rOUkukq9mRbiNW/F
> d7MAmwfYI3P0iUhD3lnZs0U7jv+qHj5h
> =Y6iv
> -END PGP SIGNATURE-
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>



-- 
Wes Wannemacher

Head Engineer, WanTii, Inc.
Need Training? Struts, Spring, Maven, Tomcat...
Ask me for a quote!

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



Re: Multiple forms in single action class

2010-04-28 Thread Kartik Kumar
Yes It is possible to assign the same action class but different action
methods to handle different tasks. The example below should work for you.




On Wed, Apr 28, 2010 at 7:08 AM, Manoj Singh wrote:

> Hi,
>
> I am a newbie to struts. Please co-operate.
>
> I am using the dispatch action to create my action class. Here I am
> providing the facility the users to add, update and delete the blogs. I
> want
> to use two form beans for this single action. One for add and update and
> another for delete.
>
> Is it possible to assign multiple form beans for the same action for the
> different dispatch action parameters?
>
> Please suggest.
>
> Regards,
> Manoj
>


Re: S2 validation without API ties

2010-04-28 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Rahul,

On 4/27/2010 1:09 AM, Rahul Mohan wrote:
> I think the fundamental mechanism of S2 is the configurable interceptor 
> stack where each interceptor applies itself to the current action based on 
> the interfaces the action implements. You can still reuse this mechanism 
> by defining your own interceptor stack with your own interfaces. Lets S2 ( 
> or rather xwork ) take care of the wiring. Essentially, building your 
> framework using the underlying configurable interceptor stack mechanism. 
> Does that answer your question?

Not really what I'm trying to do is build an action that does not
depend upon the S2/xwork APIs, but can still work with them.

Specifically, I'd rather have:

public class MyAction
   extends (nothing)
   implements (Nothing)
{
  public void addFieldError(String field, String message) { ... };
}

rather than this:

public class MyAction
  extends ActionSupport
  and/or
  implements ValidationAware
{
  // addError declared in ValidationAware
  public void addFieldError(String field, String message) { ... };
}

I believe the ValidationInterceptor has code that looks something like this:

if(action instanceof ValidationAware)
{
   foreach field {
 validate field

 if(error)
   action.addFieldError(fieldName, errorMessage);
   }
}

I was wondering if there was any interest in an alternative
implementation that did something more like this:

if(declaresValidationMethods(action.getClass())
{
   foreach field {
 validate field

 if(error)
   action.addFieldError(fieldName, errorMessage);
   }
}

I could certainly implement this myself, but I'm wondering if there is
wider interest in such an interceptor.

Thanks,
- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkvYVScACgkQ9CaO5/Lv0PBmaQCfRGHa7iD3rOUkukq9mRbiNW/F
d7MAmwfYI3P0iUhD3lnZs0U7jv+qHj5h
=Y6iv
-END PGP SIGNATURE-

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



Re: Odd Interceptor Behaviour with Spring Plugin (possibly)

2010-04-28 Thread Wes Wannemacher
Without looking at the blog entry you posted, I would suggest looking
at your interceptor stack configuration for the action. The most
likely case is that some other interceptor is interrupting execution
(likely for a legitimate reason). For instance, the workflow (or is it
validation) interceptor might have detected that validation failed and
returned "input" before executing your action. If your interceptor is
configured further down the stack, then it won't be reached.

As for why it is behaving differently in an app that has the spring
plugin vs. non-spring app... I would first assume that's a red herring
and you should check first what I mentioned above.

-Wes

On Wed, Apr 28, 2010 at 10:29 AM, RogerV  wrote:
>
> I'm using the RedirectMessageInterceptor from
> http://glindholm.wordpress.com/2008/07/02/preserving-messages-across-a-redirect-in-struts-2.
> In the first application I used it in, which is a "standard out of the box"
> struts 2 application it works as expected.
>
> I'm now using it in a project that uses the Spring plugin for some of my
> class instantiation and the interceptor never fires.
>
> I've added logging to the code in the Constructor and in the doIntercept
> method. In the first instance I see the constructor message and for every
> action called I see the doIntercept() messages.
>
> In the second case, I see the Constructor messages logged, so Struts/Spring
> is seeing it, but the doIntercept() method never fires.
>
> Has anyone seen anything like this before who could suggest what to check
> next?
>
> Regards
> --
> View this message in context: 
> http://old.nabble.com/Odd-Interceptor-Behaviour-with-Spring-Plugin-%28possibly%29-tp28387977p28387977.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
>
>



-- 
Wes Wannemacher

Head Engineer, WanTii, Inc.
Need Training? Struts, Spring, Maven, Tomcat...
Ask me for a quote!

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



Odd Interceptor Behaviour with Spring Plugin (possibly)

2010-04-28 Thread RogerV

I'm using the RedirectMessageInterceptor from
http://glindholm.wordpress.com/2008/07/02/preserving-messages-across-a-redirect-in-struts-2.
In the first application I used it in, which is a "standard out of the box"
struts 2 application it works as expected.

I'm now using it in a project that uses the Spring plugin for some of my
class instantiation and the interceptor never fires.

I've added logging to the code in the Constructor and in the doIntercept
method. In the first instance I see the constructor message and for every
action called I see the doIntercept() messages.

In the second case, I see the Constructor messages logged, so Struts/Spring
is seeing it, but the doIntercept() method never fires. 

Has anyone seen anything like this before who could suggest what to check
next?

Regards
-- 
View this message in context: 
http://old.nabble.com/Odd-Interceptor-Behaviour-with-Spring-Plugin-%28possibly%29-tp28387977p28387977.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: struts if tag related help

2010-04-28 Thread Upasana Sharma
thanks a lot it worked out...

On Wed, Apr 28, 2010 at 7:46 PM, Wes Wannemacher  wrote:

> 
>
> (assuming that #session.UserList evaluates to some form of java.util.Set)
>
> -Wes
>
> On Wed, Apr 28, 2010 at 9:54 AM, Upasana Sharma 
> wrote:
> > Hi
> >
> > is something like this possible in struts2
> >
> > 
> >
> > I am aware of  tag but is it possibel to achive the same
> > result using  tag..
> >
> >
> > --
> > Thanks and Regards
> > Upasana Sharma
> >
>
>
>
> --
> Wes Wannemacher
>
> Head Engineer, WanTii, Inc.
> Need Training? Struts, Spring, Maven, Tomcat...
> Ask me for a quote!
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>


Re: struts if tag related help

2010-04-28 Thread Wes Wannemacher


(assuming that #session.UserList evaluates to some form of java.util.Set)

-Wes

On Wed, Apr 28, 2010 at 9:54 AM, Upasana Sharma  wrote:
> Hi
>
> is something like this possible in struts2
>
> 
>
> I am aware of  tag but is it possibel to achive the same
> result using  tag..
>
>
> --
> Thanks and Regards
> Upasana Sharma
>



-- 
Wes Wannemacher

Head Engineer, WanTii, Inc.
Need Training? Struts, Spring, Maven, Tomcat...
Ask me for a quote!

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



Multiple forms in single action class

2010-04-28 Thread Manoj Singh
Hi,

I am a newbie to struts. Please co-operate.

I am using the dispatch action to create my action class. Here I am
providing the facility the users to add, update and delete the blogs. I want
to use two form beans for this single action. One for add and update and
another for delete.

Is it possible to assign multiple form beans for the same action for the
different dispatch action parameters?

Please suggest.

Regards,
Manoj


struts if tag related help

2010-04-28 Thread Upasana Sharma
Hi

is something like this possible in struts2



I am aware of  tag but is it possibel to achive the same
result using  tag..


-- 
Thanks and Regards
Upasana Sharma


Re: Partial Validation

2010-04-28 Thread Wes Wannemacher
I'm sure that other people would be interested... The best way to
share your enhancement would be to set it up as a standalone project
that operates as a struts2-plugin. Make the project available through
googlecode, sourceforge or java.net. Then, register it as a
struts2-plugin over here -

https://cwiki.apache.org/confluence/display/S2PLUGINS/Home

-Wes

On Wed, Apr 28, 2010 at 1:58 AM, Rahul Mohan  wrote:
> Thanks for your comments Wes.
>
> I do have different action methods which I am invoking through wild-card
> mappings. But I do not want to repeat the same validations in page level
> submits and partial submits. I have implemented another solution with a
> little bit of S2 customization.
>
> - Introduced a new annotation to group fields on the action class. For
> example:
>         @Group("CustomerAddress") private int cityCode;
>
> - Introduced a group validation annotation to validate fields of only one
> group from the class. Example:
>       �...@validate("CustomerAddres")
>        public String saveAddress() {
>                
>        }
>
> - Implemented a GroupValidatorManager extends
> AnnotationActionValidatorManager (S2 internal) and introduced that instead
> of the AnnotationValidationManager in struts xml as the default bean:
>  "com.opensymphony.xwork2.validator.ActionValidatorManager"
>                class="com.tcs.gui.arch.validation.GroupValidatorManager"
> />
>
> - GroupValidatorManager overrides the getValidator to return only the
> applicable validators for the current method by processing the
> annotations.
>
> I can share this code if anyone is interested.
>
> - Rahul
>
>
>
> From:
> Wes Wannemacher 
> To:
> Struts Users Mailing List 
> Date:
> 27-04-2010 21:12
> Subject:
> Re: Partial Validation
>
>
>
> When you submit the fieldset through ajax, are you submitting to a
> different action mapping? If the ajax submit and the full form submit,
> you could setup a validation for the action mapping that corresponds
> to the ajax submit. Handling ajax validation is a bit tricky, but
> somewhere in the wiki, there is a document that describes it.
>
> -Wes
>
> On Wed, Apr 21, 2010 at 3:35 AM, Rahul Mohan  wrote:
>> Hi,
>>
>> Is there any way I can do a partial validation in Struts 2? I have a
> page
>> with two fieldsets, where I can either submit the entire page or submit
>> only the fieldset (through Ajax). In the latter case, I wish to validate
>> only the fieldset's properties, but in the former case I want the entire
>> page to be validated. I am using annotation for validation.
>>
>> Regards,
>> Rahul
>> =-=-=
>> Notice: The information contained in this e-mail
>> message and/or attachments to it may contain
>> confidential or privileged information. If you are
>> not the intended recipient, any dissemination, use,
>> review, distribution, printing or copying of the
>> information contained in this e-mail message
>> and/or attachments to it are strictly prohibited. If
>> you have received this communication in error,
>> please notify us by reply e-mail or telephone and
>> immediately and permanently delete the message
>> and any attachments. Thank you
>>
>>
>>
>
>
>
> --
> Wes Wannemacher
>
> Head Engineer, WanTii, Inc.
> Need Training? Struts, Spring, Maven, Tomcat...
> Ask me for a quote!
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>
>
> =-=-=
> Notice: The information contained in this e-mail
> message and/or attachments to it may contain
> confidential or privileged information. If you are
> not the intended recipient, any dissemination, use,
> review, distribution, printing or copying of the
> information contained in this e-mail message
> and/or attachments to it are strictly prohibited. If
> you have received this communication in error,
> please notify us by reply e-mail or telephone and
> immediately and permanently delete the message
> and any attachments. Thank you
>
>
>



-- 
Wes Wannemacher

Head Engineer, WanTii, Inc.
Need Training? Struts, Spring, Maven, Tomcat...
Ask me for a quote!

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



Annotation Validation

2010-04-28 Thread Alex Rodriguez Lopez

Hi struts users!

I'm on my way to change from XML based validation to annotation validation.

I've manage to get it working, but (probably due to my little knowledge 
of Java annotations) there are some things I can't get to work, so I 
apologise if this question is not entirelly Struts related.


I'm trying to get the following XML based validation to annotations at 
method level:





		   ${getText("error.required", 
{getText("label.name")})}



...


So far this works in my action:

@Validations(
requiredStrings = {
@RequiredStringValidator(
fieldName = "user.name",
message = "Name required.")}
)
public String save() {
...
return SUCCESS;
}

But the problem is with this bit ${getText("error.required", 
{getText("label.name")})} which retrieves a message that has 
arguments (also retrieved from a resource bundle).


So how should I use the annotation parameters (key or message) to 
retrieve a key with args?


I tried message = getText("error.required", new 
String[]{getText("label.name")})


but of course values of annotation params must be constant, and I cannot 
define a static value that depends on a getText() lookup.


Is this ever possible to do with annotations?

Any help appreciated!!

Summary: How to use i18n messages with args using annotations for field 
validation?


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



Re: use servletcontext in typeconvert

2010-04-28 Thread yunaki

Thanks all you answer. I am new in spring and I found the class that
implements ApplicationContextAware,But I want to get attributes from Object
Stack or the Context Map(session or applcation). Sorry question did not make
sense.

yunaki wrote:
> 
> in the convertFromString method, I hope to use servletcontext to get a
> applcation context property. Is it possible?thx
> 

-- 
View this message in context: 
http://old.nabble.com/use-servletcontext-in-typeconvert-tp28382360p28387037.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