Re: Struts2 annotation with parameter when using json plugin

2012-09-14 Thread Lukasz Lenart
2012/9/14 Ken McWilliams :
> Simply I want to evaluate a property of my action and use it's value
> within an annotation. The following is exactly where I want to use it:
>
> I want to define a excludeProperties parameter at run time.
>
> Consider the following annotation which currently works on the action:
> @Result(name = "success", type = "json", params = {"root", "model",
> "excludeProperties", "myCollection"})
>
> There the actions model has a myCollection collection which I do not
> want serialized.
>
> However I would like to create an exclusion String (a string will do for now).
>
> If I create a getter setter for exclusion, I would expect the
> following annotation to work (which does not):
>
> @Result(name = "success", type = "json", params = {"root", "model",
> "excludeProperties", "${exclusion}"})
>
> Any ideas?

It isn't possible right now, only root can be an expression (and it is
treated as that)

Please register an improvement for that and will see...

https://issues.apache.org/jira/browse/WW


Kind regards
-- 
Ɓukasz
+ 48 606 323 122 http://www.lenart.org.pl/

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



Struts2 annotation with parameter when using json plugin

2012-09-13 Thread Ken McWilliams
Simply I want to evaluate a property of my action and use it's value
within an annotation. The following is exactly where I want to use it:

I want to define a excludeProperties parameter at run time.

Consider the following annotation which currently works on the action:
@Result(name = "success", type = "json", params = {"root", "model",
"excludeProperties", "myCollection"})

There the actions model has a myCollection collection which I do not
want serialized.

However I would like to create an exclusion String (a string will do for now).

If I create a getter setter for exclusion, I would expect the
following annotation to work (which does not):

@Result(name = "success", type = "json", params = {"root", "model",
"excludeProperties", "${exclusion}"})

Any ideas?

I am using the named variable pattern matcher to extract values from
the namespace if that matters, I think it should just affect request
parameters.

I really want to dynamically set the exclude properties of the result.
I have not tried with XML yet, but shouldn't think it would be
different. Is is possible to directly create and set the methods of
the result type? Because that could be another option.

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



Re: struts2 annotation

2011-12-01 Thread Dave Newton
On Thu, Dec 1, 2011 at 2:37 AM, cwalet  wrote:
> i've search the source in both xwork and struts,but not anything did i
> found how struts2 resolve the @TypeConversion and @Conversion
> annotation.

Type conversion annotations are listed here:

http://struts.apache.org/2.x/docs/annotations.html#Annotations-TypeConversionAnnotations

Dave

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



Re: struts2 annotation

2011-12-01 Thread Li Ying
I did some search, found it here:
com.opensymphony.xwork2.conversion.impl.XWorkConverter.addConverterMapping(Map, Class)

And this converter is configured in [struts-default.xml]:
http://struts.apache.org/2.x/docs/struts-defaultxml.html

The following doc describe more details:
http://struts.apache.org/2.x/docs/type-conversion.html

2011/12/1 cwalet :
> hi,all
> do struts2.2.3 supports
> com.opensymphony.xwork2.conversion.annotations.TypeConversion
> annotation?
> i've search the source in both xwork and struts,but not anything did i
> found how struts2 resolve the @TypeConversion and @Conversion
> annotation.
> any help would be great!
>
> -
> 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 annotation

2011-11-30 Thread cwalet
hi,all
do struts2.2.3 supports
com.opensymphony.xwork2.conversion.annotations.TypeConversion
annotation?
i've search the source in both xwork and struts,but not anything did i
found how struts2 resolve the @TypeConversion and @Conversion
annotation.
any help would be great!

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



Re: an odd problem about struts2 annotation

2011-10-02 Thread Jeffrey Black
Is your Tomcat configured for autodeploy=true?

tomcat.apache.org/tomcat-7.0-doc/deployer-howto.html

JB


On Sep 29, 2011, at 10:30 PM, Steven Yang  wrote:

> for one reason is that struts2 will not scan your classes in jar is that if
> someone tempered with you jar or any of your jar has class with Struts
> Annotations then your user can access these actions without you knowing it.
> I believe this is the same reason why Spring doesnt scan files in jars and
> in order to use them you have to declare them explicitly in xml files.
> 
> On Fri, Sep 30, 2011 at 10:49 AM, dan.zheng  wrote:
> 
>> I know some tricky about this problem
>> the struts convention will scan action class in the specific package
>> for example:
>> struts.convention.package.locators indicate the action class suffix
>> 
>> but when you jar the classes,I suppose that struts2 can't scan the action
>> class
>> in jar files,if this is true,I will always deploy war with class files
>> exploded,I want to find
>> a workaround,thanks
>> 
>> On Fri, Sep 30, 2011 at 10:22 AM, dan.zheng  wrote:
>> 
>>> I jar the classes and put it into WEB-INF/lib
>>> of course you know,the war will package all jars and jsp files in bundle
>>> why the struts2 can't scan classes in WEB-INF/lib?
>>> 
>>> 
>>> On Fri, Sep 30, 2011 at 10:05 AM, Steven Yang >> wrote:
>>> 
>>>> sorry just to be clear
>>>> did you "jar" the classes or did you "war" the classes?
>>>> 
>>>> if you "jar" the classes then i dont think struts 2 will scan your
>> classes
>>>> in jars.
>>>> 
>>>> On Thu, Sep 29, 2011 at 2:34 PM, dan.zheng  wrote:
>>>> 
>>>>> hi,everyone
>>>>> I meet an odd problem with struts2 annotation,Let me elaborate it
>> first
>>>>> 
>>>>> import java.util.List;
>>>>> 
>>>>> import lombok.Getter;
>>>>> import lombok.Setter;
>>>>> 
>>>>> import org.apache.commons.lang.StringUtils;
>>>>> import org.apache.struts2.ServletActionContext;
>>>>> import org.apache.struts2.convention.annotation.Action;
>>>>> import org.apache.struts2.convention.annotation.Result;
>>>>> import org.apache.struts2.convention.annotation.Results;
>>>>> import org.apache.struts2.interceptor.validation.SkipValidation;
>>>>> import org.springframework.beans.factory.annotation.Autowired;
>>>>> 
>>>>> import com.dbappsecurity.portal.model.PortalUser;
>>>>> import com.dbappsecurity.portal.service.PortalUserService;
>>>>> import com.opensymphony.xwork2.ActionSupport;
>>>>> 
>>>>> @Results({
>>>>>   @Result(name="input",location="main.jsp"),
>>>>>   @Result(name="list",location="list.jsp")
>>>>> })
>>>>> public class MainAction extends ActionSupport {
>>>>>   @Getter @Setter private PortalUser user;
>>>>>   @Autowired
>>>>>   private PortalUserService portalUserService;
>>>>>   public String execute() throws Exception {
>>>>>   return INPUT;
>>>>>   }
>>>>>   @Action("addUser")
>>>>>   public String addUser() throws Exception {
>>>>>   portalUserService.addUser(user);
>>>>>   return listUser();
>>>>>   }
>>>>>   @Action("listUser")
>>>>>   @SkipValidation
>>>>>   public String listUser() throws Exception {
>>>>>   List theUserList = portalUserService.getPortalUserList(null);
>>>>> 
>>>>> 
>> ServletActionContext.getRequest().setAttribute("userList",theUserList);
>>>>>   return "list";
>>>>>   }
>>>>>   @Action("modifyUser")
>>>>>   public String modifyUser() throws Exception {
>>>>>   List theUserList = portalUserService.getPortalUserList(null);
>>>>> 
>>>>> 
>> ServletActionContext.getRequest().setAttribute("userList",theUserList);
>>>>>   return "list";
>>>>>   }
>>>>> 
>>>>> this is the struts2 action class, I configure it correctly and type
>> the
>>>> url
>>>>> http://domain/listUser   it will list all users
>>>>> http://domain/modifyUser it can modify the users
>>>>> all things go well in tomcat with exploded class files
>>>>> 
>>>>> but when I build with the war file and deploy it into tomcat webapp
>>>> folder,
>>>>> the page report
>>>>> there is no action name listUser
>>>>> the difference between the two scenario is exploded class files and
>>>>> archived
>>>>> class files that I compile and jar the action and other class files
>> into
>>>>> it.
>>>>> I was puzzled about this phenomenon
>>>>> 
>>>>> so any suggestions and advices will be very appreciated!
>>>>> 
>>>> 
>>> 
>>> 
>> 

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



Re: an odd problem about struts2 annotation

2011-09-29 Thread Steven Yang
for one reason is that struts2 will not scan your classes in jar is that if
someone tempered with you jar or any of your jar has class with Struts
Annotations then your user can access these actions without you knowing it.
I believe this is the same reason why Spring doesnt scan files in jars and
in order to use them you have to declare them explicitly in xml files.

On Fri, Sep 30, 2011 at 10:49 AM, dan.zheng  wrote:

> I know some tricky about this problem
> the struts convention will scan action class in the specific package
> for example:
> struts.convention.package.locators indicate the action class suffix
>
> but when you jar the classes,I suppose that struts2 can't scan the action
> class
> in jar files,if this is true,I will always deploy war with class files
> exploded,I want to find
> a workaround,thanks
>
> On Fri, Sep 30, 2011 at 10:22 AM, dan.zheng  wrote:
>
> > I jar the classes and put it into WEB-INF/lib
> > of course you know,the war will package all jars and jsp files in bundle
> > why the struts2 can't scan classes in WEB-INF/lib?
> >
> >
> > On Fri, Sep 30, 2011 at 10:05 AM, Steven Yang  >wrote:
> >
> >> sorry just to be clear
> >> did you "jar" the classes or did you "war" the classes?
> >>
> >> if you "jar" the classes then i dont think struts 2 will scan your
> classes
> >> in jars.
> >>
> >> On Thu, Sep 29, 2011 at 2:34 PM, dan.zheng  wrote:
> >>
> >> > hi,everyone
> >> >  I meet an odd problem with struts2 annotation,Let me elaborate it
> first
> >> >
> >> > import java.util.List;
> >> >
> >> > import lombok.Getter;
> >> > import lombok.Setter;
> >> >
> >> > import org.apache.commons.lang.StringUtils;
> >> > import org.apache.struts2.ServletActionContext;
> >> > import org.apache.struts2.convention.annotation.Action;
> >> > import org.apache.struts2.convention.annotation.Result;
> >> > import org.apache.struts2.convention.annotation.Results;
> >> > import org.apache.struts2.interceptor.validation.SkipValidation;
> >> > import org.springframework.beans.factory.annotation.Autowired;
> >> >
> >> > import com.dbappsecurity.portal.model.PortalUser;
> >> > import com.dbappsecurity.portal.service.PortalUserService;
> >> > import com.opensymphony.xwork2.ActionSupport;
> >> >
> >> > @Results({
> >> >@Result(name="input",location="main.jsp"),
> >> >@Result(name="list",location="list.jsp")
> >> > })
> >> > public class MainAction extends ActionSupport {
> >> >@Getter @Setter private PortalUser user;
> >> >@Autowired
> >> >private PortalUserService portalUserService;
> >> >public String execute() throws Exception {
> >> >return INPUT;
> >> >}
> >> >@Action("addUser")
> >> >public String addUser() throws Exception {
> >> >portalUserService.addUser(user);
> >> >return listUser();
> >> >}
> >> >@Action("listUser")
> >> >@SkipValidation
> >> >public String listUser() throws Exception {
> >> >List theUserList = portalUserService.getPortalUserList(null);
> >> >
> >> >
>  ServletActionContext.getRequest().setAttribute("userList",theUserList);
> >> >return "list";
> >> >}
> >> >@Action("modifyUser")
> >> >public String modifyUser() throws Exception {
> >> >List theUserList = portalUserService.getPortalUserList(null);
> >> >
> >> >
>  ServletActionContext.getRequest().setAttribute("userList",theUserList);
> >> >return "list";
> >> >}
> >> >
> >> > this is the struts2 action class, I configure it correctly and type
> the
> >> url
> >> > http://domain/listUser   it will list all users
> >> > http://domain/modifyUser it can modify the users
> >> > all things go well in tomcat with exploded class files
> >> >
> >> > but when I build with the war file and deploy it into tomcat webapp
> >> folder,
> >> > the page report
> >> > there is no action name listUser
> >> > the difference between the two scenario is exploded class files and
> >> > archived
> >> > class files that I compile and jar the action and other class files
> into
> >> > it.
> >> > I was puzzled about this phenomenon
> >> >
> >> > so any suggestions and advices will be very appreciated!
> >> >
> >>
> >
> >
>


Re: an odd problem about struts2 annotation

2011-09-29 Thread dan.zheng
I know some tricky about this problem
the struts convention will scan action class in the specific package
for example:
struts.convention.package.locators indicate the action class suffix

but when you jar the classes,I suppose that struts2 can't scan the action
class
in jar files,if this is true,I will always deploy war with class files
exploded,I want to find
a workaround,thanks

On Fri, Sep 30, 2011 at 10:22 AM, dan.zheng  wrote:

> I jar the classes and put it into WEB-INF/lib
> of course you know,the war will package all jars and jsp files in bundle
> why the struts2 can't scan classes in WEB-INF/lib?
>
>
> On Fri, Sep 30, 2011 at 10:05 AM, Steven Yang wrote:
>
>> sorry just to be clear
>> did you "jar" the classes or did you "war" the classes?
>>
>> if you "jar" the classes then i dont think struts 2 will scan your classes
>> in jars.
>>
>> On Thu, Sep 29, 2011 at 2:34 PM, dan.zheng  wrote:
>>
>> > hi,everyone
>> >  I meet an odd problem with struts2 annotation,Let me elaborate it first
>> >
>> > import java.util.List;
>> >
>> > import lombok.Getter;
>> > import lombok.Setter;
>> >
>> > import org.apache.commons.lang.StringUtils;
>> > import org.apache.struts2.ServletActionContext;
>> > import org.apache.struts2.convention.annotation.Action;
>> > import org.apache.struts2.convention.annotation.Result;
>> > import org.apache.struts2.convention.annotation.Results;
>> > import org.apache.struts2.interceptor.validation.SkipValidation;
>> > import org.springframework.beans.factory.annotation.Autowired;
>> >
>> > import com.dbappsecurity.portal.model.PortalUser;
>> > import com.dbappsecurity.portal.service.PortalUserService;
>> > import com.opensymphony.xwork2.ActionSupport;
>> >
>> > @Results({
>> >@Result(name="input",location="main.jsp"),
>> >@Result(name="list",location="list.jsp")
>> > })
>> > public class MainAction extends ActionSupport {
>> >@Getter @Setter private PortalUser user;
>> >@Autowired
>> >private PortalUserService portalUserService;
>> >public String execute() throws Exception {
>> >return INPUT;
>> >}
>> >@Action("addUser")
>> >public String addUser() throws Exception {
>> >portalUserService.addUser(user);
>> >return listUser();
>> >}
>> >@Action("listUser")
>> >@SkipValidation
>> >public String listUser() throws Exception {
>> >List theUserList = portalUserService.getPortalUserList(null);
>> >
>> >  ServletActionContext.getRequest().setAttribute("userList",theUserList);
>> >return "list";
>> >}
>> >@Action("modifyUser")
>> >public String modifyUser() throws Exception {
>> >List theUserList = portalUserService.getPortalUserList(null);
>> >
>> >  ServletActionContext.getRequest().setAttribute("userList",theUserList);
>> >return "list";
>> >}
>> >
>> > this is the struts2 action class, I configure it correctly and type the
>> url
>> > http://domain/listUser   it will list all users
>> > http://domain/modifyUser it can modify the users
>> > all things go well in tomcat with exploded class files
>> >
>> > but when I build with the war file and deploy it into tomcat webapp
>> folder,
>> > the page report
>> > there is no action name listUser
>> > the difference between the two scenario is exploded class files and
>> > archived
>> > class files that I compile and jar the action and other class files into
>> > it.
>> > I was puzzled about this phenomenon
>> >
>> > so any suggestions and advices will be very appreciated!
>> >
>>
>
>


Re: an odd problem about struts2 annotation

2011-09-29 Thread dan.zheng
I jar the classes and put it into WEB-INF/lib
of course you know,the war will package all jars and jsp files in bundle
why the struts2 can't scan classes in WEB-INF/lib?

On Fri, Sep 30, 2011 at 10:05 AM, Steven Yang  wrote:

> sorry just to be clear
> did you "jar" the classes or did you "war" the classes?
>
> if you "jar" the classes then i dont think struts 2 will scan your classes
> in jars.
>
> On Thu, Sep 29, 2011 at 2:34 PM, dan.zheng  wrote:
>
> > hi,everyone
> >  I meet an odd problem with struts2 annotation,Let me elaborate it first
> >
> > import java.util.List;
> >
> > import lombok.Getter;
> > import lombok.Setter;
> >
> > import org.apache.commons.lang.StringUtils;
> > import org.apache.struts2.ServletActionContext;
> > import org.apache.struts2.convention.annotation.Action;
> > import org.apache.struts2.convention.annotation.Result;
> > import org.apache.struts2.convention.annotation.Results;
> > import org.apache.struts2.interceptor.validation.SkipValidation;
> > import org.springframework.beans.factory.annotation.Autowired;
> >
> > import com.dbappsecurity.portal.model.PortalUser;
> > import com.dbappsecurity.portal.service.PortalUserService;
> > import com.opensymphony.xwork2.ActionSupport;
> >
> > @Results({
> >@Result(name="input",location="main.jsp"),
> >@Result(name="list",location="list.jsp")
> > })
> > public class MainAction extends ActionSupport {
> >@Getter @Setter private PortalUser user;
> >@Autowired
> >private PortalUserService portalUserService;
> >public String execute() throws Exception {
> >return INPUT;
> >}
> >@Action("addUser")
> >public String addUser() throws Exception {
> >portalUserService.addUser(user);
> >return listUser();
> >}
> >@Action("listUser")
> >@SkipValidation
> >public String listUser() throws Exception {
> >List theUserList = portalUserService.getPortalUserList(null);
> >
> >  ServletActionContext.getRequest().setAttribute("userList",theUserList);
> >return "list";
> >}
> >@Action("modifyUser")
> >public String modifyUser() throws Exception {
> >List theUserList = portalUserService.getPortalUserList(null);
> >
> >  ServletActionContext.getRequest().setAttribute("userList",theUserList);
> >return "list";
> >}
> >
> > this is the struts2 action class, I configure it correctly and type the
> url
> > http://domain/listUser   it will list all users
> > http://domain/modifyUser it can modify the users
> > all things go well in tomcat with exploded class files
> >
> > but when I build with the war file and deploy it into tomcat webapp
> folder,
> > the page report
> > there is no action name listUser
> > the difference between the two scenario is exploded class files and
> > archived
> > class files that I compile and jar the action and other class files into
> > it.
> > I was puzzled about this phenomenon
> >
> > so any suggestions and advices will be very appreciated!
> >
>


Re: an odd problem about struts2 annotation

2011-09-29 Thread Steven Yang
sorry just to be clear
did you "jar" the classes or did you "war" the classes?

if you "jar" the classes then i dont think struts 2 will scan your classes
in jars.

On Thu, Sep 29, 2011 at 2:34 PM, dan.zheng  wrote:

> hi,everyone
>  I meet an odd problem with struts2 annotation,Let me elaborate it first
>
> import java.util.List;
>
> import lombok.Getter;
> import lombok.Setter;
>
> import org.apache.commons.lang.StringUtils;
> import org.apache.struts2.ServletActionContext;
> import org.apache.struts2.convention.annotation.Action;
> import org.apache.struts2.convention.annotation.Result;
> import org.apache.struts2.convention.annotation.Results;
> import org.apache.struts2.interceptor.validation.SkipValidation;
> import org.springframework.beans.factory.annotation.Autowired;
>
> import com.dbappsecurity.portal.model.PortalUser;
> import com.dbappsecurity.portal.service.PortalUserService;
> import com.opensymphony.xwork2.ActionSupport;
>
> @Results({
>@Result(name="input",location="main.jsp"),
>@Result(name="list",location="list.jsp")
> })
> public class MainAction extends ActionSupport {
>@Getter @Setter private PortalUser user;
>@Autowired
>private PortalUserService portalUserService;
>public String execute() throws Exception {
>return INPUT;
>}
>@Action("addUser")
>public String addUser() throws Exception {
>portalUserService.addUser(user);
>return listUser();
>}
>@Action("listUser")
>@SkipValidation
>public String listUser() throws Exception {
>List theUserList = portalUserService.getPortalUserList(null);
>
>  ServletActionContext.getRequest().setAttribute("userList",theUserList);
>return "list";
>}
>@Action("modifyUser")
>public String modifyUser() throws Exception {
>List theUserList = portalUserService.getPortalUserList(null);
>
>  ServletActionContext.getRequest().setAttribute("userList",theUserList);
>return "list";
>}
>
> this is the struts2 action class, I configure it correctly and type the url
> http://domain/listUser   it will list all users
> http://domain/modifyUser it can modify the users
> all things go well in tomcat with exploded class files
>
> but when I build with the war file and deploy it into tomcat webapp folder,
> the page report
> there is no action name listUser
> the difference between the two scenario is exploded class files and
> archived
> class files that I compile and jar the action and other class files into
> it.
> I was puzzled about this phenomenon
>
> so any suggestions and advices will be very appreciated!
>


an odd problem about struts2 annotation

2011-09-28 Thread dan.zheng
hi,everyone
 I meet an odd problem with struts2 annotation,Let me elaborate it first

import java.util.List;

import lombok.Getter;
import lombok.Setter;

import org.apache.commons.lang.StringUtils;
import org.apache.struts2.ServletActionContext;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Result;
import org.apache.struts2.convention.annotation.Results;
import org.apache.struts2.interceptor.validation.SkipValidation;
import org.springframework.beans.factory.annotation.Autowired;

import com.dbappsecurity.portal.model.PortalUser;
import com.dbappsecurity.portal.service.PortalUserService;
import com.opensymphony.xwork2.ActionSupport;

@Results({
@Result(name="input",location="main.jsp"),
@Result(name="list",location="list.jsp")
})
public class MainAction extends ActionSupport {
@Getter @Setter private PortalUser user;
@Autowired
private PortalUserService portalUserService;
public String execute() throws Exception {
return INPUT;
}
@Action("addUser")
public String addUser() throws Exception {
portalUserService.addUser(user);
return listUser();
}
@Action("listUser")
@SkipValidation
public String listUser() throws Exception {
List theUserList = portalUserService.getPortalUserList(null);

 ServletActionContext.getRequest().setAttribute("userList",theUserList);
return "list";
}
@Action("modifyUser")
public String modifyUser() throws Exception {
List theUserList = portalUserService.getPortalUserList(null);

 ServletActionContext.getRequest().setAttribute("userList",theUserList);
return "list";
}

this is the struts2 action class, I configure it correctly and type the url
http://domain/listUser   it will list all users
http://domain/modifyUser it can modify the users
all things go well in tomcat with exploded class files

but when I build with the war file and deploy it into tomcat webapp folder,
the page report
there is no action name listUser
the difference between the two scenario is exploded class files and archived
class files that I compile and jar the action and other class files into it.
I was puzzled about this phenomenon

so any suggestions and advices will be very appreciated!


Struts2 annotation problem

2010-04-08 Thread Miles, Chris
Within my web apps lib directory I have the convention plugin and also
the config browser plugin.

 

My code is as follows:

 

package com.example;

 

import org.apache.struts2.convention.annotation.*;

import org.apache.struts2.interceptor.SessionAware;

 

import java.util.Map;

import java.util.List;

 

BaseAction extends Action Support.

 

@ParentPackage("test")

@Namespace("/test")

public class ShippingDetailsAction extends BaseAction {

 

@Action(value = "check")

public String check() throws Exception {

return SUCCESS;

}

 

@Action(value = "fetch")

public String fetch() throws Exception {

return SUCCESS;

}

}

 

My struts xml file contains

 







 

However I get action not mapped/found when I try to connect to

 

/CONTEXT/test/fetch.action

 

Or

 

/CONTEXT/test/check.action

 

When I check the config browser it says the test namespace has no
actions within it.

 

I am deploying to glassfish 2.1

 

Thanks

 

Chris

 






Re: Struts2 annotation based TLD generation using Ant

2008-06-20 Thread Dmitriy Kuznetsov


Musachy Barroso wrote:
> 
> Get it from here:
> 
> http://repo1.maven.org/maven2/org/apache/struts/struts-annotations/
> 
> musachy
> 

I've managed to do it with following target:


















following folders should exist in ${basedir}:
- src (with source code)
- bin (with already compiled sources)
- bin/META-INF
- doc
- dest/apt

${struts-plugin.classpath} should contain struts-annotations-1.0.X.jar

apt.exe must be available under %JDK_HOME%/bin that runs ant or in %PATH%
(if not, causes trouble "Error running apt.exe compiler", e.g. if build is
started under Eclipse, which is started by JRE, not JDK).
-- 
View this message in context: 
http://www.nabble.com/Struts2-annotation-based-TLD-generation-using-Ant-tp18015219p18033588.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: Struts2 annotation based TLD generation using Ant

2008-06-19 Thread Musachy Barroso
Get it from here:

http://repo1.maven.org/maven2/org/apache/struts/struts-annotations/

musachy

On Thu, Jun 19, 2008 at 2:56 PM, Dmitriy Kuznetsov
<[EMAIL PROTECTED]> wrote:
>
>
>
> Musachy Barroso wrote:
>>
>> The Ant Apt task  would be a way:
>> http://ant.apache.org/manual/CoreTasks/apt.html
>>
>> musachy
>>
>>
>
> Thanks. Could you please explain some details:
>
> 1. I found source code of TLDAnnotationProcessorFactory and some related
> classes at
> https://issues.apache.org/struts/secure/attachment/13234/WW-1392.zip
> Is it good enough to generate TLDs? Or, maybe, you know where to get some
> "official" or "stable" or, maybe, latest available variant?
>
> 2. Are there any things i would better know before i start - like external
> dependencies, java versions and so on?
>
> Best regards,
> Dmitriy.
> --
> View this message in context: 
> http://www.nabble.com/Struts2-annotation-based-TLD-generation-using-Ant-tp18015219p18015742.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>



-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

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



Re: Struts2 annotation based TLD generation using Ant

2008-06-19 Thread Dmitriy Kuznetsov



Musachy Barroso wrote:
> 
> The Ant Apt task  would be a way:
> http://ant.apache.org/manual/CoreTasks/apt.html
> 
> musachy
> 
> 

Thanks. Could you please explain some details:

1. I found source code of TLDAnnotationProcessorFactory and some related
classes at
https://issues.apache.org/struts/secure/attachment/13234/WW-1392.zip
Is it good enough to generate TLDs? Or, maybe, you know where to get some
"official" or "stable" or, maybe, latest available variant?

2. Are there any things i would better know before i start - like external
dependencies, java versions and so on?

Best regards,
Dmitriy.
-- 
View this message in context: 
http://www.nabble.com/Struts2-annotation-based-TLD-generation-using-Ant-tp18015219p18015742.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: Struts2 annotation based TLD generation using Ant

2008-06-19 Thread Musachy Barroso
The Ant Apt task  would be a way:
http://ant.apache.org/manual/CoreTasks/apt.html

musachy

On Thu, Jun 19, 2008 at 2:28 PM, Dmitriy Kuznetsov
<[EMAIL PROTECTED]> wrote:
>
> Struts2 TLD files are generated by maven. I will not use maven on current
> project, so how to run the same task from Ant?
>
> Probably, the following part of pom.xml allows maven to do it:
>
>
>org.apache.myfaces.tobago
>maven-apt-plugin
>1.0.15
>
>
> uri=/struts-tags,tlibVersion=2.2.3,jspVersion=2.0,shortName=s,displayName="Struts
> Tags",
>
> outFile=${basedir}/target/classes/META-INF/struts-tags.tld,
>description="To make it easier to access dynamic data;
>the Apache Struts framework includes a library of custom
> tags.
>The tags interact with the framework's validation and
> internationalization features;
>to ensure that input is correct and output is localized.
>The Struts Tags can be used with JSP FreeMarker or
> Velocity.",
>outTemplatesDir=${basedir}/src/site/resources/tags
>
>target
>false
>true
>true
>true
>
> org.apache.struts.annotations.taglib.apt.TLDAnnotationProcessorFactory
>1.5
>
>**/*.java
>
>
>
>
>compile
>
>execute
>
>
>
>    
>
> I googled for a solution, or at least, docs, for a couple of days, but found
> nothing.
> --
> View this message in context: 
> http://www.nabble.com/Struts2-annotation-based-TLD-generation-using-Ant-tp18015219p18015219.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>



-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

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



Struts2 annotation based TLD generation using Ant

2008-06-19 Thread Dmitriy Kuznetsov

Struts2 TLD files are generated by maven. I will not use maven on current
project, so how to run the same task from Ant?

Probably, the following part of pom.xml allows maven to do it:


org.apache.myfaces.tobago
maven-apt-plugin
1.0.15


uri=/struts-tags,tlibVersion=2.2.3,jspVersion=2.0,shortName=s,displayName="Struts
Tags",
   
outFile=${basedir}/target/classes/META-INF/struts-tags.tld,
description="To make it easier to access dynamic data;
the Apache Struts framework includes a library of custom
tags.
The tags interact with the framework's validation and
internationalization features;
to ensure that input is correct and output is localized.
The Struts Tags can be used with JSP FreeMarker or
Velocity.",
outTemplatesDir=${basedir}/src/site/resources/tags
 
target
false
true
true
true
   
org.apache.struts.annotations.taglib.apt.TLDAnnotationProcessorFactory
1.5

**/*.java




compile

execute





I googled for a solution, or at least, docs, for a couple of days, but found
nothing.
-- 
View this message in context: 
http://www.nabble.com/Struts2-annotation-based-TLD-generation-using-Ant-tp18015219p18015219.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: Struts2 Annotation based Validation

2008-03-27 Thread Lukasz Lenart
>  > Im not sure where to place my properties file.

I almost always put my messages to file named package.properties in
the same folder as my action's classes.


Regards
-- 
Lukasz

http://www.linkedin.com/in/lukaszlenart

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



Re: Struts2 Annotation based Validation

2008-03-26 Thread Dave Newton
--- Tauri Valor <[EMAIL PROTECTED]> wrote:
> I tried as you advised. I get the default error message 'Please enter a
> value for first name ' which is in the "message" .
> 
> Im expecting the error messaage from the properties file.
> 
> I think Im placing my properties file in the wrong location. And therefore
> my validation returns me the default error message.
> 
> Im not sure where to place my properties file.

Depends. it can be in the same ackage as the action class and named
${actionClassName}.properties, for example. The localization docs [1] gives a
set of rules for locating resource files.

Dave

[1] http://struts.apache.org/2.0.11.1/docs/localization.html



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



Re: Struts2 Annotation based Validation

2008-03-26 Thread Tauri Valor

Lukasz, 

I tried as you advised. I get the default error message 'Please enter a
value for first name ' which is in the "message" .

Im expecting the error messaage from the properties file.

I think Im placing my properties file in the wrong location. And therefore
my validation returns me the default error message.

Im not sure where to place my properties file.

Thanks,
Tauri.


Lukasz Lenart wrote:
> 
> You mess too many thing, please try like this:
> 
>  @RequiredStringValidator(key = "error.required", message = "Please 
> enter a value for First name")
> 
> error.required = ${fieldName} is required!
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Struts2-Annotation-based-Validation-tp16089678p16320151.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: Struts2 Annotation based Validation

2008-03-26 Thread Lukasz Lenart
Hi,

You mess too many thing, please try like this:

 @RequiredStringValidator(key = "error.required", message = "Please
enter a value for First name")

error.required = ${fieldName} is required!



Regards
-- 
Lukasz

http://www.linkedin.com/in/lukaszlenart

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



Re: Struts2 Annotation based Validation

2008-03-26 Thread Tauri Valor

Thanks again.

I tried the following:

In my action:
@RequiredStringValidator(key = "error.message", message = "")
public String getFirstName() {
return firstName;
}


I created the properties file just under my action with the name
"MyActionName.properties" with the following contents:

error.message = ${getText(firstName)} is required.
fieldFormat = ${getText(fieldName)} is not formatted properly.

But I do not the error message as: "error.message" instead of "firstName is
required"

Where am I erring ?

Thanks,
Tauri






Lukasz Lenart wrote:
> 
>>  Is it possible for me to have multilingual Validations using Annotation
>>  Based Validations in Struts2 ?
> 
> Yes, you can, just add key = some.error.message to your annotation, like
> below
> 
> @RequiredStringValidator(key = "some.key")
> public void setFirstName(String firstName) {
> this.firstName = firstName;
> }
> 
> 
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Struts2-Annotation-based-Validation-tp16089678p16297696.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: Struts2 Annotation based Validation

2008-03-26 Thread Lukasz Lenart
>  Is it possible for me to have multilingual Validations using Annotation
>  Based Validations in Struts2 ?

Yes, you can, just add key = some.error.message to your annotation, like below

@RequiredStringValidator(key = "some.key")
public void setFirstName(String firstName) {
this.firstName = firstName;
}


Regards
-- 
Lukasz

http://www.linkedin.com/in/lukaszlenart

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



Re: Struts2 Annotation based Validation

2008-03-26 Thread Tauri Valor

Hi

Is it possible for me to have multilingual Validations using Annotation
Based Validations in Struts2 ?

Please let me know how I can achieve this .

Thanks,
Tauri.





Tauri Valor wrote:
> 
> Thanks Lukasz
> 
> 
> 
> Lukasz Lenart wrote:
>> 
>>> 
>> 
>> By default s:password tag don't shows value of your password, you can
>> change such behaviour by adding attribute showPassword=true, but you
>> should consider security issue.
>> 
>> 
>> Regards
>> -- 
>> Lukasz
>> 
>> http://www.linkedin.com/in/lukaszlenart
>> 
>> -
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>> 
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Struts2-Annotation-based-Validation-tp16089678p16296680.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: Struts2 Annotation based Validation

2008-03-26 Thread Tauri Valor

Thanks Lukasz



Lukasz Lenart wrote:
> 
>> 
> 
> By default s:password tag don't shows value of your password, you can
> change such behaviour by adding attribute showPassword=true, but you
> should consider security issue.
> 
> 
> Regards
> -- 
> Lukasz
> 
> http://www.linkedin.com/in/lukaszlenart
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Struts2-Annotation-based-Validation-tp16089678p16296676.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: Struts2 Annotation based Validation

2008-03-18 Thread Lukasz Lenart
> 

By default s:password tag don't shows value of your password, you can
change such behaviour by adding attribute showPassword=true, but you
should consider security issue.


Regards
-- 
Lukasz

http://www.linkedin.com/in/lukaszlenart

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



Re: Struts2 Annotation based Validation

2008-03-18 Thread Tauri Valor

Thanks Lukasz it worked for textfields using 

But I have the same problem when I use it for 

this is my listbox:




 



And my password fields:













Please suggest.

Thanks,
Tauri


I used

Lukasz Lenart wrote:
> 
>>  
>>  
>>
>> First Name
>>
>> >  class="form_field">
>>
>>
>> 
>>
>>
>> 
>>  
>> firstName
>>
>> 
>>
>> 
> 
> But as I see, you don't use  for your form and that's way
> you don't see values in the form. If you want to add html tags as
> above, use theme=simple and s:textfield
> 
> 
> Regards
> -- 
> Lukasz
> 
> http://www.linkedin.com/in/lukaszlenart
> 
> -----
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Struts2-Annotation-based-Validation-tp16089678p16118342.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: Struts2 Annotation based Validation

2008-03-18 Thread Lukasz Lenart
>  
>  
>  width="115">First Name
>  width="142">  class="form_field">
>
> 
>
> 
> 
>   
> firstName
> 
> 
> 

But as I see, you don't use  for your form and that's way
you don't see values in the form. If you want to add html tags as
above, use theme=simple and s:textfield


Regards
-- 
Lukasz

http://www.linkedin.com/in/lukaszlenart

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



Re: Struts2 Annotation based Validation

2008-03-18 Thread Tauri Valor

I get the following log in my console:


2008-Mar-18 16:21:17,671 - DEBUG freemarker.cache - Could not find template
in cache, creating new one;
id=[template/xhtml/fielderror.ftl[en_US,UTF-8,parsed] ]
2008-Mar-18 16:21:17,671 - DEBUG freemarker.cache -
template/simple/fielderror.ftl[en_US,UTF-8,parsed] cached copy not yet
stale; using cached.



Does it have anything to do with caching of the page?


Thanks,
Tauri.




Tauri Valor wrote:
> 
> Hi Lukasz,
> 
> Thanks for responding..
> 
> Snippet of Jsp:
> 
> 
>  
> 
> 
> 
>width="115">First Name
>width="142"> id="firstName" class="form_field">
>   
>   
>   
>   
> 
> 
> firstName
>   
> 
>   
>   
> 
> 
> My Struts-config:
> 
> 
>   MyForm
>   MyForm
>   SuccessPage
>   
> 
> 
> 
> 
> 
> Thats the snippet of my code.
> 
> 
> Thanks,
> Tauri.
> 
> 
> Lukasz Lenart wrote:
>> 
>>>  But when I enter the value in the textbox and click submit again, the
>>>  validation error for next is displayed correctly but entered value
>>>  disappears in the textbox which is abnormal .
>> 
>> Maybe you are redirecting to the next page? Could you paste snippet
>> for your struts.xml and jsp?
>> 
>> 
>> Regards
>> -- 
>> Lukasz
>> 
>> -
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>> 
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Struts2-Annotation-based-Validation-tp16089678p16116284.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: Struts2 Annotation based Validation

2008-03-18 Thread Tauri Valor

Hi Lukasz,

Thanks for responding..

Snippet of Jsp:


 



First Name






  
firstName






My Struts-config:


MyForm
MyForm
SuccessPage






Thats the snippet of my code.


Thanks,
Tauri.


Lukasz Lenart wrote:
> 
>>  But when I enter the value in the textbox and click submit again, the
>>  validation error for next is displayed correctly but entered value
>>  disappears in the textbox which is abnormal .
> 
> Maybe you are redirecting to the next page? Could you paste snippet
> for your struts.xml and jsp?
> 
> 
> Regards
> -- 
> Lukasz
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Struts2-Annotation-based-Validation-tp16089678p16116146.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: Struts2 Annotation based Validation

2008-03-18 Thread Lukasz Lenart
>  But when I enter the value in the textbox and click submit again, the
>  validation error for next is displayed correctly but entered value
>  disappears in the textbox which is abnormal .

Maybe you are redirecting to the next page? Could you paste snippet
for your struts.xml and jsp?


Regards
-- 
Lukasz

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



Re: Struts2 Annotation based Validation

2008-03-18 Thread Tauri Valor

Thanks Jeromy and Lukasz!

I could manage to get the field specific error messages using :


  
firstName




I have a new problem, when validating the page I get error messages as
desired. 

Eg: Mandatory field validation gives out message saying "Field is
mandatory".

But when I enter the value in the textbox and click submit again, the
validation error for next is displayed correctly but entered value
disappears in the textbox which is abnormal .

Why is this happening ? Please help me understand.

Thanks,
Tauri






Lukasz Lenart wrote:
> 
>> In Struts2 error messages are stored in the ValueStack in an object
> 
> Yes, I made mistake, I've mean in request scope, not in request object ;-)
> 
> 
> Regards
> -- 
> Lukasz
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Struts2-Annotation-based-Validation-tp16089678p16115634.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: Struts2 Annotation based Validation

2008-03-17 Thread Lukasz Lenart
> In Struts2 error messages are stored in the ValueStack in an object

Yes, I made mistake, I've mean in request scope, not in request object ;-)


Regards
-- 
Lukasz

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



Re: Struts2 Annotation based Validation

2008-03-17 Thread Jeromy Evans

Lukasz Lenart wrote:

Hi,

Error messages are stored in request, you have to subclass
ActionSupport and add some mechanism to store messages in session.


Regards
  


In Struts2 error messages are stored in the ValueStack in an object 
implementing ValidationAware.
If your action extends ActionSupport, then means they're available as a 
property of your action.


You can read them from any object in the ValueStack using OGNL.  Have a 
look at ValidationAware.


eg. to iterate through action errors:


They're not available in the request object. They are available in the 
session object only if something puts them there for you (which is not 
the default case).


The actionError tag applies a template.  You may be better off creating 
a custom template.


regards,
Jeromy Evans



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



Re: Struts2 Annotation based Validation

2008-03-17 Thread Tauri Valor

Thanks Lukasz!

I tried request.getAttribute("actionerror") and
request.getAttribute("fielderror") in my jsp but it did not work.

Am I doing it the wrong way ? 









Lukasz Lenart wrote:
> 
> Hi,
> 
> Error messages are stored in request, you have to subclass
> ActionSupport and add some mechanism to store messages in session.
> 
> 
> Regards
> -- 
> Lukasz
> 
> http://www.linkedin.com/in/lukaszlenart
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Struts2-Annotation-based-Validation-tp16089678p16090926.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: Struts2 Annotation based Validation

2008-03-17 Thread Lukasz Lenart
Hi,

Error messages are stored in request, you have to subclass
ActionSupport and add some mechanism to store messages in session.


Regards
-- 
Lukasz

http://www.linkedin.com/in/lukaszlenart

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



Struts2 Annotation based Validation

2008-03-17 Thread Tauri Valor

Using Annotation based Validation, I want to try the following:

The Validation Error message can be retrieved in our jsp using :


 

Do I have any alternative method of using the above tags ? 
For eg. can I retrieve the error using session.getAttribute(actionerror) ? 

Are actionerror and fielderror stored in a request or a session object ?

Please help me understand this .

Thanks,
Tauri.

-- 
View this message in context: 
http://www.nabble.com/Struts2-Annotation-based-Validation-tp16089678p16089678.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: Struts2 Annotation Based Validation

2007-08-17 Thread David Copeland
OK, that worked, in that the validators ran and error messages were
written to the log, however my execute method still executed and
nothing happened on the UI with the error message tags.

I guess the larger question here is, if I'm trying to learn Struts, is
the best strategy to dig into Struts 1, which is presumably better
documented, and wait for Struts 2 to gain more of a foothold?

Dave

On 8/16/07, j alex <[EMAIL PROTECTED]> wrote:
> try changing @RequiredFieldValidator to @RequiredStringValidator
>
> the RequiredFieldValidator only looks for "not null" and even if the
> field is not entered, but is present on the form, it'll be populated
> with "" (empty) and not a java null.
>
> -Joseph
>
> On 8/16/07, David Copeland <[EMAIL PROTECTED]> wrote:
> > Here's my struts.xml
> >
> > 
> > 
> > 
> > /Register.jsp
> > 
> > 
> > 
> >
> > my web.xml:
> >
> > 
> > NoShame
> > 
> > struts2
> > 
> > org.apache.struts2.dispatcher.FilterDispatcher
> > 
> > actionPackages
> >
> > com.naildrivin5.applications.noshame.client
> > 
> > 
> >
> > 
> > struts2
> > /*
> > 
> > 
> >
> > My JSP:
> >
> > <%@ taglib prefix="s" uri="/struts-tags" %>
> > 
> > 
> > 
> > name > required="true" name="name" label="Your Name" />
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> >
> > My Action class:
> >
> > @Results({
> > @Result(name="success", value="/Success.jsp"),
> > @Result(name="error", value="/Register.jsp")
> > })
> > @Validation()
> > public class RegisterNewAction
> > {
> > public String execute() throws Exception
> > {
> > // omittied boring logic
> > return "success";
> > }
> >
> > private String itsName;
> > @RequiredFieldValidator(type = ValidatorType.FIELD, message =
> > "Name is required")
> > public void setName(String name) { itsName = name; }
> > public String getName() { return itsName; }
> >
> > // omitted other accecssors
> > }
> >
> > The docs for doing validation via XML indicate setting up some sort of
> > interceptor (but there is no real instruction for that, either), so is
> > there some annotation way I have to do that?
> >
> > On 8/15/07, Laurie Harper <[EMAIL PROTECTED]> wrote:
> > > David Copeland wrote:
> > > > I'm a Struts newb and am trying to get up to speed on Struts 2.
> > > >
> > > > The scant documentation is throwing me a bit; I'm trying to do
> > > > everything annotation-based, and for Validation, it seems to be simply
> > > > not working at all.
> > > >
> > > > Per the docs, I have tagged my action class with @Validator and tagged
> > > > my setXXX method with @RequiredFieldValidator.
> > > >
> > > > My form's JSP contains 
> > > > XXX.
> > > >
> > > > When I submit the form with no value for XXX, my execute method
> > > > executes as it would before I added the validation stuff.
> > > >
> > > > I would really like to avoid XML files, but it seems that if I'm using
> > > > annotations, everything needs to be done that way.
> > >
> > > I'm not sure what that last paragraph means; you can certainly use XML
> > > validation for one action and annotations in another. I'm not sure to
> > > what extent it's possible to mix XML and annotation based validation in
> > > the *same* action, but there's certainly no requirement to pick one or
> > > the other for the application as a whole.
> > >
> > > It may help if you post the relevant parts of your config, JSP and
> > > action code. There are several 'moving parts' involved in making
> > > validation work, and it's hard to guess where the problem is without
> > > seeing what you have done.
> > >
> > > L.
> > >
> > >
> > > -
> > > 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]
>
>

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



Re: Struts2 Annotation Based Validation

2007-08-16 Thread j alex
Dave,

How do we use the action-alias XML approach if we've the same alias
but different methods on the same action ?

ex :



say myAction has methodA(), methodB() etc. which are invoked using
different submit buttons in the jsp




In this case, we could have myAction-abc-validation.xml , but how will
it differentiate b/n methodA and methodB?

i tried myAction-methodA-validation.xml ; but it didn't seem to work.

Thanks,
Joseph



On 8/15/07, Dave Newton <[EMAIL PROTECTED]> wrote:
> --- j alex <[EMAIL PROTECTED]> wrote:
> > ex : if an Action has multiple methods and only
> > certain fields are tied to each method, we can
> > bunch together validations for each method
> > using annotations, but this is not possible using
> > XML
>
> You can create validation XML files on an action-alias
> basis.
>
> d.
>
>
>
>
> 
> Got a little couch potato?
> Check out fun summer activities for kids.
> http://search.yahoo.com/search?fr=oni_on_mail&p=summer+activities+for+kids&cs=bz
>
> -
> 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]



[OT] Re: Struts2 Annotation Based Validation

2007-08-16 Thread Dave Newton
--- meisam sarabadani wrote:
> can somebody tell me why we need the struts.xml and
> build.xml or web.xml? what are their duties ?

Google can tell you.

struts.xml is the usual name for the Struts 2
configuration file. build.xml is for Apache Ant.
web.xml is for configuring your web application.

d.



  

Park yourself in front of a world of choices in alternative vehicles. Visit the 
Yahoo! Auto Green Center.
http://autos.yahoo.com/green_center/ 

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



Re: Struts2 Annotation Based Validation

2007-08-16 Thread meisam sarabadani
can somebody tell me why we need the struts.xml and build.xml or
web.xml?what are their duties ?


On 8/16/07, j alex <[EMAIL PROTECTED]> wrote:
>
> try changing @RequiredFieldValidator to @RequiredStringValidator
>
> the RequiredFieldValidator only looks for "not null" and even if the
> field is not entered, but is present on the form, it'll be populated
> with "" (empty) and not a java null.
>
> -Joseph
>
> On 8/16/07, David Copeland <[EMAIL PROTECTED]> wrote:
> > Here's my struts.xml
> >
> > 
> > 
> > 
> > /Register.jsp
> > 
> > 
> > 
> >
> > my web.xml:
> >
> > 
> > NoShame
> > 
> > struts2
> > org.apache.struts2.dispatcher.FilterDispatcher
> 
> > 
> > actionPackages
> >
> > com.naildrivin5.applications.noshame.client
> > 
> > 
> >
> > 
> > struts2
> > /*
> > 
> > 
> >
> > My JSP:
> >
> > <%@ taglib prefix="s" uri="/struts-tags" %>
> > 
> > 
> > 
> > name > required="true" name="name" label="Your Name" />
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> >
> > My Action class:
> >
> > @Results({
> > @Result(name="success", value="/Success.jsp"),
> > @Result(name="error", value="/Register.jsp")
> > })
> > @Validation()
> > public class RegisterNewAction
> > {
> > public String execute() throws Exception
> > {
> > // omittied boring logic
> > return "success";
> > }
> >
> > private String itsName;
> > @RequiredFieldValidator(type = ValidatorType.FIELD, message =
> > "Name is required")
> > public void setName(String name) { itsName = name; }
> > public String getName() { return itsName; }
> >
> > // omitted other accecssors
> > }
> >
> > The docs for doing validation via XML indicate setting up some sort of
> > interceptor (but there is no real instruction for that, either), so is
> > there some annotation way I have to do that?
> >
> > On 8/15/07, Laurie Harper <[EMAIL PROTECTED]> wrote:
> > > David Copeland wrote:
> > > > I'm a Struts newb and am trying to get up to speed on Struts 2.
> > > >
> > > > The scant documentation is throwing me a bit; I'm trying to do
> > > > everything annotation-based, and for Validation, it seems to be
> simply
> > > > not working at all.
> > > >
> > > > Per the docs, I have tagged my action class with @Validator and
> tagged
> > > > my setXXX method with @RequiredFieldValidator.
> > > >
> > > > My form's JSP contains
> XXX.
> > > >
> > > > When I submit the form with no value for XXX, my execute method
> > > > executes as it would before I added the validation stuff.
> > > >
> > > > I would really like to avoid XML files, but it seems that if I'm
> using
> > > > annotations, everything needs to be done that way.
> > >
> > > I'm not sure what that last paragraph means; you can certainly use XML
> > > validation for one action and annotations in another. I'm not sure to
> > > what extent it's possible to mix XML and annotation based validation
> in
> > > the *same* action, but there's certainly no requirement to pick one or
> > > the other for the application as a whole.
> > >
> > > It may help if you post the relevant parts of your config, JSP and
> > > action code. There are several 'moving parts' involved in making
> > > validation work, and it's hard to guess where the problem is without
> > > seeing what you have done.
> > >
> > > L.
> > >
> > >
> > > -
> > > 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]
>
>


-- 
Appreciated much,

Meisam Sarabadani
IBM Student Ambassador
Vice president II, IT Society
Multimedia University, Cyberjaya Capmus
--
"The day the Lord created hope was probably the same day he created
Spring."  Bern Williams.
--


Re: Struts2 Annotation Based Validation

2007-08-16 Thread j alex
try changing @RequiredFieldValidator to @RequiredStringValidator

the RequiredFieldValidator only looks for "not null" and even if the
field is not entered, but is present on the form, it'll be populated
with "" (empty) and not a java null.

-Joseph

On 8/16/07, David Copeland <[EMAIL PROTECTED]> wrote:
> Here's my struts.xml
>
> 
> 
> 
> /Register.jsp
> 
> 
> 
>
> my web.xml:
>
> 
> NoShame
> 
> struts2
> 
> org.apache.struts2.dispatcher.FilterDispatcher
> 
> actionPackages
>
> com.naildrivin5.applications.noshame.client
> 
> 
>
> 
> struts2
> /*
> 
> 
>
> My JSP:
>
> <%@ taglib prefix="s" uri="/struts-tags" %>
> 
> 
> 
> name required="true" name="name" label="Your Name" />
> 
> 
> 
> 
> 
> 
> 
>
> My Action class:
>
> @Results({
> @Result(name="success", value="/Success.jsp"),
> @Result(name="error", value="/Register.jsp")
> })
> @Validation()
> public class RegisterNewAction
> {
> public String execute() throws Exception
> {
> // omittied boring logic
> return "success";
> }
>
> private String itsName;
> @RequiredFieldValidator(type = ValidatorType.FIELD, message =
> "Name is required")
> public void setName(String name) { itsName = name; }
> public String getName() { return itsName; }
>
> // omitted other accecssors
> }
>
> The docs for doing validation via XML indicate setting up some sort of
> interceptor (but there is no real instruction for that, either), so is
> there some annotation way I have to do that?
>
> On 8/15/07, Laurie Harper <[EMAIL PROTECTED]> wrote:
> > David Copeland wrote:
> > > I'm a Struts newb and am trying to get up to speed on Struts 2.
> > >
> > > The scant documentation is throwing me a bit; I'm trying to do
> > > everything annotation-based, and for Validation, it seems to be simply
> > > not working at all.
> > >
> > > Per the docs, I have tagged my action class with @Validator and tagged
> > > my setXXX method with @RequiredFieldValidator.
> > >
> > > My form's JSP contains 
> > > XXX.
> > >
> > > When I submit the form with no value for XXX, my execute method
> > > executes as it would before I added the validation stuff.
> > >
> > > I would really like to avoid XML files, but it seems that if I'm using
> > > annotations, everything needs to be done that way.
> >
> > I'm not sure what that last paragraph means; you can certainly use XML
> > validation for one action and annotations in another. I'm not sure to
> > what extent it's possible to mix XML and annotation based validation in
> > the *same* action, but there's certainly no requirement to pick one or
> > the other for the application as a whole.
> >
> > It may help if you post the relevant parts of your config, JSP and
> > action code. There are several 'moving parts' involved in making
> > validation work, and it's hard to guess where the problem is without
> > seeing what you have done.
> >
> > L.
> >
> >
> > -
> > 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: Struts2 Annotation Based Validation

2007-08-16 Thread David Copeland
Here's my struts.xml




/Register.jsp




my web.xml:


NoShame

struts2

org.apache.struts2.dispatcher.FilterDispatcher

actionPackages

com.naildrivin5.applications.noshame.client




struts2
/*



My JSP:

<%@ taglib prefix="s" uri="/struts-tags" %>



name








My Action class:

@Results({
@Result(name="success", value="/Success.jsp"),
@Result(name="error", value="/Register.jsp")
})
@Validation()
public class RegisterNewAction
{
public String execute() throws Exception
{
// omittied boring logic
return "success";
}

private String itsName;
@RequiredFieldValidator(type = ValidatorType.FIELD, message =
"Name is required")
public void setName(String name) { itsName = name; }
public String getName() { return itsName; }

// omitted other accecssors
}

The docs for doing validation via XML indicate setting up some sort of
interceptor (but there is no real instruction for that, either), so is
there some annotation way I have to do that?

On 8/15/07, Laurie Harper <[EMAIL PROTECTED]> wrote:
> David Copeland wrote:
> > I'm a Struts newb and am trying to get up to speed on Struts 2.
> >
> > The scant documentation is throwing me a bit; I'm trying to do
> > everything annotation-based, and for Validation, it seems to be simply
> > not working at all.
> >
> > Per the docs, I have tagged my action class with @Validator and tagged
> > my setXXX method with @RequiredFieldValidator.
> >
> > My form's JSP contains XXX.
> >
> > When I submit the form with no value for XXX, my execute method
> > executes as it would before I added the validation stuff.
> >
> > I would really like to avoid XML files, but it seems that if I'm using
> > annotations, everything needs to be done that way.
>
> I'm not sure what that last paragraph means; you can certainly use XML
> validation for one action and annotations in another. I'm not sure to
> what extent it's possible to mix XML and annotation based validation in
> the *same* action, but there's certainly no requirement to pick one or
> the other for the application as a whole.
>
> It may help if you post the relevant parts of your config, JSP and
> action code. There are several 'moving parts' involved in making
> validation work, and it's hard to guess where the problem is without
> seeing what you have done.
>
> L.
>
>
> -
> 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: Struts2 Annotation Based Validation

2007-08-15 Thread Dave Newton
--- j alex <[EMAIL PROTECTED]> wrote:
> ex : if an Action has multiple methods and only
> certain fields are tied to each method, we can
> bunch together validations for each method
> using annotations, but this is not possible using
> XML

You can create validation XML files on an action-alias
basis.

d.



   

Got a little couch potato? 
Check out fun summer activities for kids.
http://search.yahoo.com/search?fr=oni_on_mail&p=summer+activities+for+kids&cs=bz
 

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



Re: Struts2 Annotation Based Validation

2007-08-15 Thread j alex
I think annotations give you more flexibility than XML .

ex : if an Action has multiple methods and only certain fields are
tied to each method, we can bunch together validations for each method
using annotations, but this is not possible using XML

On 8/15/07, Laurie Harper <[EMAIL PROTECTED]> wrote:
> David Copeland wrote:
> > I'm a Struts newb and am trying to get up to speed on Struts 2.
> >
> > The scant documentation is throwing me a bit; I'm trying to do
> > everything annotation-based, and for Validation, it seems to be simply
> > not working at all.
> >
> > Per the docs, I have tagged my action class with @Validator and tagged
> > my setXXX method with @RequiredFieldValidator.
> >
> > My form's JSP contains XXX.
> >
> > When I submit the form with no value for XXX, my execute method
> > executes as it would before I added the validation stuff.
> >
> > I would really like to avoid XML files, but it seems that if I'm using
> > annotations, everything needs to be done that way.
>
> I'm not sure what that last paragraph means; you can certainly use XML
> validation for one action and annotations in another. I'm not sure to
> what extent it's possible to mix XML and annotation based validation in
> the *same* action, but there's certainly no requirement to pick one or
> the other for the application as a whole.
>
> It may help if you post the relevant parts of your config, JSP and
> action code. There are several 'moving parts' involved in making
> validation work, and it's hard to guess where the problem is without
> seeing what you have done.
>
> L.
>
>
> -
> 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: Struts2 Annotation Based Validation

2007-08-15 Thread Laurie Harper

David Copeland wrote:

I'm a Struts newb and am trying to get up to speed on Struts 2.

The scant documentation is throwing me a bit; I'm trying to do
everything annotation-based, and for Validation, it seems to be simply
not working at all.

Per the docs, I have tagged my action class with @Validator and tagged
my setXXX method with @RequiredFieldValidator.

My form's JSP contains XXX.

When I submit the form with no value for XXX, my execute method
executes as it would before I added the validation stuff.

I would really like to avoid XML files, but it seems that if I'm using
annotations, everything needs to be done that way.


I'm not sure what that last paragraph means; you can certainly use XML 
validation for one action and annotations in another. I'm not sure to 
what extent it's possible to mix XML and annotation based validation in 
the *same* action, but there's certainly no requirement to pick one or 
the other for the application as a whole.


It may help if you post the relevant parts of your config, JSP and 
action code. There are several 'moving parts' involved in making 
validation work, and it's hard to guess where the problem is without 
seeing what you have done.


L.


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



Struts2 Annotation Based Validation

2007-08-15 Thread David Copeland
I'm a Struts newb and am trying to get up to speed on Struts 2.

The scant documentation is throwing me a bit; I'm trying to do
everything annotation-based, and for Validation, it seems to be simply
not working at all.

Per the docs, I have tagged my action class with @Validator and tagged
my setXXX method with @RequiredFieldValidator.

My form's JSP contains XXX.

When I submit the form with no value for XXX, my execute method
executes as it would before I added the validation stuff.

I would really like to avoid XML files, but it seems that if I'm using
annotations, everything needs to be done that way.

Any ideas on where to look?

Dave

I've read: http://struts.apache.org/2.x/docs/validation-annotation.html
and some other resources, none of which are clear to me.

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