Re: validator type=regex : param name is regex , not expression

2013-09-19 Thread Chris
Thanks for the informations




 De : Lukasz Lenart lukaszlen...@apache.org
À : Struts Users Mailing List user@struts.apache.org 
Envoyé le : Jeudi 19 septembre 2013 7h59
Objet : Re: validator type=regex : param name is regex , not expression
 

Sometime ago ... with 2.3.12. I have renamed expression to regex as
right now you can define regexExpression as Ognl expression - there
was name clash without renaming ;-)

http://struts.apache.org/development/2.x/docs/version-notes-23120.html

2013/9/18 Chris christal...@yahoo.fr:
 Hello ,

 Do you have any idea since when ( which version ) the word expression is no
 more  avaliable ?
 In some examples on the Web or in Books, the word used is still
 expression.

 Regards

 Chris

 ---


 Done, thanks for reporting!

 https://cwiki.apache.org/confluence/display/WW/Form+Validation+Using+XML

 2013/9/16 Chris

 Hi Lukasz,

 Good example of regex in
 http://struts.apache.org/development/2.x/docs/form-validation-using-xml.html
 ,
 and choose  between JavaScript validator or Java validator will be another
 story .;-)


 but the file EditAction-validation.xml seems contain a wrong value.
 .

 I found it in testing PhoneNumber with many wrong values and it always
 worked !
 I thought maybe a jar is missing ?

 But it was the param name in the file EditAction-validation.xml
 - param name=expression should be param name=regex

 before
 validator type=regex
     param name=fieldnamepersonBean.phoneNumber/param
     param name=expression![CDATA[\d{3}-\d{3}-\d{4}]]/param
     messagePhone number must be entered as 999-999-./message
 /validator

 after
 validator type=regex
     param name=fieldnamepersonBean.phoneNumber/param
     param name=regex![CDATA[\d{3}-\d{3}-\d{4}]]/param
     messagePhone number must be entered as 999-999-./message
 /validator




 Regards,

 Chris ( christalkto )


 __



-- 
Ł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

how to use single jsp as template

2013-09-19 Thread Yaragalla Muralidhar
hi I have a jsp with a layout. it means the jsp has menu on the left and
header on the top. now for every action the center part of the jsp should
change. Is this possible?

I mean for every different action a different jsp should be included in the
center of the layout jsp. If this is possible it will be of so much help.
kindly help? if possible is there a solution without tiles?



*Thanks and Regards,*
Muralidhar Yaragalla.
*
*


Re: how to use single jsp as template

2013-09-19 Thread Chris Pratt
Apache Tiles sounds like exactly what you're looking for, and works great
with Struts2.  You could also consider a single page app (i.e. AngularJS)
approach.
  (*Chris*)


On Thu, Sep 19, 2013 at 8:23 AM, Yaragalla Muralidhar 
yaragallamur...@gmail.com wrote:

 hi I have a jsp with a layout. it means the jsp has menu on the left and
 header on the top. now for every action the center part of the jsp should
 change. Is this possible?

 I mean for every different action a different jsp should be included in the
 center of the layout jsp. If this is possible it will be of so much help.
 kindly help? if possible is there a solution without tiles?



 *Thanks and Regards,*
 Muralidhar Yaragalla.
 *
 *



Re: how to use single jsp as template

2013-09-19 Thread Yaragalla Muralidhar
ok will try. Thank you.

*Thanks and Regards,*
Muralidhar Yaragalla.
*
*


On Thu, Sep 19, 2013 at 9:07 PM, Chris Pratt thechrispr...@gmail.comwrote:

 Apache Tiles sounds like exactly what you're looking for, and works great
 with Struts2.  You could also consider a single page app (i.e. AngularJS)
 approach.
   (*Chris*)


 On Thu, Sep 19, 2013 at 8:23 AM, Yaragalla Muralidhar 
 yaragallamur...@gmail.com wrote:

  hi I have a jsp with a layout. it means the jsp has menu on the left and
  header on the top. now for every action the center part of the jsp should
  change. Is this possible?
 
  I mean for every different action a different jsp should be included in
 the
  center of the layout jsp. If this is possible it will be of so much help.
  kindly help? if possible is there a solution without tiles?
 
 
 
  *Thanks and Regards,*
  Muralidhar Yaragalla.
  *
  *
 



validation not happening

2013-09-19 Thread Yaragalla Muralidhar
Hi I am using struts2. I have craeted xx-validation.xml in the same dir of
action class xx.java. I am not sure why this is happening? kindly help?

*Thanks and Regards,*
Muralidhar Yaragalla.
*
*


Re: validation not happening

2013-09-19 Thread Yaragalla Muralidhar
I am not using struts tags.

*Thanks and Regards,*
Muralidhar Yaragalla.
*
*


On Thu, Sep 19, 2013 at 11:32 PM, Yaragalla Muralidhar 
yaragallamur...@gmail.com wrote:

 Hi I am using struts2. I have craeted xx-validation.xml in the same dir of
 action class xx.java. I am not sure why this is happening? kindly help?

 *Thanks and Regards,*
 Muralidhar Yaragalla.
 *
 *



Re: validation not happening

2013-09-19 Thread Yaragalla Muralidhar
My StudentRegistrationAction-validation.xml is as below:-

!DOCTYPE validators PUBLIC -//Apache Struts//XWork Validator 1.0.2//EN 
http://struts.apache.org/dtds/xwork-validator-1.0.2.dtd;
validators
field name=primDet.admissionNo
 field-validator type=regex
  param name=regex![CDATA[[0-9]{3,}]]/param
 !-- messageThe value of bar2 must be in the format
![CDATA[[0-9]{3,}] where x and y are between 0 and 9/message --
   message key=error.admission.noCould not find error.admission.no
!/message
 /field-validator
/field
field name=primDet.admissionDate
 field-validator type=regex
  param name=regex![CDATA[\d{2}/\d{2}/\d{4}]]/param
   message key=error.admission.dateCould not find
error.admission.date/message
 /field-validator
/field
/validators



My jsp code is as below:-

form id=form method=post action=primaryDetails.action
input type=text class=text size=15 name=primDet.admissionNo /
input type=text class=text style=color:#DDD4E7 value=dd/mm/
onclick=displayCalendar(event,this) size=15
name=primDet.admissionDate/
/form

My student-reg.xml is as below:-

?xml version=1.0 encoding=UTF-8 ?
!DOCTYPE struts PUBLIC
-//Apache Software Foundation//DTD Struts Configuration 2.3//EN
http://struts.apache.org/dtds/struts-2.3.dtd;

struts

constant name=struts.enable.DynamicMethodInvocation value=false /
constant name=struts.devMode value=true /



package name=sr namespace=/ extends=struts-default

 interceptors
 interceptor name=umsInter
class=com.ymd.ums.interceptor.UMSInterceptor/
interceptor-stack name=appDefault
  interceptor-ref name=defaultStack /
 !-- interceptor-ref name=umsInter /  --
/interceptor-stack
/interceptors

default-interceptor-ref name=appDefault /

global-results
result name=error/error.jsp/result
/global-results

global-exception-mappings
exception-mapping exception=java.lang.Exception
result=error/
/global-exception-mappings

action name=primaryDetails
class=com.ymd.ums.sm.sr.action.StudentRegistrationAction method=execute
result
name=success/jsp/StudentManage/sr_personalDetails.jsp/result
result name=input /jsp/StudentManage/sr_personalDetails.jsp/result
  /action
/package

include file=mailreader-default.xml/

/struts



This is the configaration i have. the validation is not working. please
help?

*Thanks and Regards,*
Muralidhar Yaragalla.
*
*


On Thu, Sep 19, 2013 at 11:46 PM, Dave Newton davelnew...@gmail.com wrote:

 Not enough information to help, obviously.

 Dave



 On Thu, Sep 19, 2013 at 2:06 PM, Yaragalla Muralidhar 
 yaragallamur...@gmail.com wrote:

  I am not using struts tags.
 
  *Thanks and Regards,*
  Muralidhar Yaragalla.
  *
  *
 
 
  On Thu, Sep 19, 2013 at 11:32 PM, Yaragalla Muralidhar 
  yaragallamur...@gmail.com wrote:
 
   Hi I am using struts2. I have craeted xx-validation.xml in the same dir
  of
   action class xx.java. I am not sure why this is happening? kindly help?
  
   *Thanks and Regards,*
   Muralidhar Yaragalla.
   *
   *
  
 



 --
 e: davelnew...@gmail.com
 m: 908-380-8699
 s: davelnewton_skype
 t: @dave_newton https://twitter.com/dave_newton
 b: Bucky Bits http://buckybits.blogspot.com/
 g: davelnewton https://github.com/davelnewton
 so: Dave Newton http://stackoverflow.com/users/438992/dave-newton



Re: validation not happening

2013-09-19 Thread Dave Newton
Not enough information to help, obviously.

Dave



On Thu, Sep 19, 2013 at 2:06 PM, Yaragalla Muralidhar 
yaragallamur...@gmail.com wrote:

 I am not using struts tags.

 *Thanks and Regards,*
 Muralidhar Yaragalla.
 *
 *


 On Thu, Sep 19, 2013 at 11:32 PM, Yaragalla Muralidhar 
 yaragallamur...@gmail.com wrote:

  Hi I am using struts2. I have craeted xx-validation.xml in the same dir
 of
  action class xx.java. I am not sure why this is happening? kindly help?
 
  *Thanks and Regards,*
  Muralidhar Yaragalla.
  *
  *
 




-- 
e: davelnew...@gmail.com
m: 908-380-8699
s: davelnewton_skype
t: @dave_newton https://twitter.com/dave_newton
b: Bucky Bits http://buckybits.blogspot.com/
g: davelnewton https://github.com/davelnewton
so: Dave Newton http://stackoverflow.com/users/438992/dave-newton


Re: validation not happening

2013-09-19 Thread Yaragalla Muralidhar
The validation is working fine. Thank u so much. I did a little mistake and
i found it.

*Thanks and Regards,*
Muralidhar Yaragalla.
*
*


On Thu, Sep 19, 2013 at 11:56 PM, Yaragalla Muralidhar 
yaragallamur...@gmail.com wrote:

 My StudentRegistrationAction-validation.xml is as below:-

 !DOCTYPE validators PUBLIC -//Apache Struts//XWork Validator 1.0.2//EN 
 http://struts.apache.org/dtds/xwork-validator-1.0.2.dtd;
 validators
 field name=primDet.admissionNo
  field-validator type=regex
   param name=regex![CDATA[[0-9]{3,}]]/param
  !-- messageThe value of bar2 must be in the format
 ![CDATA[[0-9]{3,}] where x and y are between 0 and 9/message --
message key=error.admission.noCould not find error.admission.no
 !/message
  /field-validator
 /field
 field name=primDet.admissionDate
  field-validator type=regex
   param name=regex![CDATA[\d{2}/\d{2}/\d{4}]]/param
message key=error.admission.dateCould not find
 error.admission.date/message
  /field-validator
 /field
 /validators



 My jsp code is as below:-

 form id=form method=post action=primaryDetails.action
 input type=text class=text size=15 name=primDet.admissionNo /
 input type=text class=text style=color:#DDD4E7 value=dd/mm/
 onclick=displayCalendar(event,this) size=15
 name=primDet.admissionDate/
 /form

 My student-reg.xml is as below:-

 ?xml version=1.0 encoding=UTF-8 ?
 !DOCTYPE struts PUBLIC
  -//Apache Software Foundation//DTD Struts Configuration 2.3//EN
 http://struts.apache.org/dtds/struts-2.3.dtd;

 struts

 constant name=struts.enable.DynamicMethodInvocation value=false /
 constant name=struts.devMode value=true /



 package name=sr namespace=/ extends=struts-default

  interceptors
  interceptor name=umsInter
 class=com.ymd.ums.interceptor.UMSInterceptor/
 interceptor-stack name=appDefault
   interceptor-ref name=defaultStack /
  !-- interceptor-ref name=umsInter /  --
 /interceptor-stack
 /interceptors

 default-interceptor-ref name=appDefault /

 global-results
 result name=error/error.jsp/result
 /global-results

 global-exception-mappings
 exception-mapping exception=java.lang.Exception
 result=error/
 /global-exception-mappings

 action name=primaryDetails
 class=com.ymd.ums.sm.sr.action.StudentRegistrationAction method=execute
 result
 name=success/jsp/StudentManage/sr_personalDetails.jsp/result
 result name=input
 /jsp/StudentManage/sr_personalDetails.jsp/result
   /action
 /package

 include file=mailreader-default.xml/

 /struts



 This is the configaration i have. the validation is not working. please
 help?

 *Thanks and Regards,*
 Muralidhar Yaragalla.
 *
 *


 On Thu, Sep 19, 2013 at 11:46 PM, Dave Newton davelnew...@gmail.comwrote:

 Not enough information to help, obviously.

 Dave



 On Thu, Sep 19, 2013 at 2:06 PM, Yaragalla Muralidhar 
 yaragallamur...@gmail.com wrote:

  I am not using struts tags.
 
  *Thanks and Regards,*
  Muralidhar Yaragalla.
  *
  *
 
 
  On Thu, Sep 19, 2013 at 11:32 PM, Yaragalla Muralidhar 
  yaragallamur...@gmail.com wrote:
 
   Hi I am using struts2. I have craeted xx-validation.xml in the same
 dir
  of
   action class xx.java. I am not sure why this is happening? kindly
 help?
  
   *Thanks and Regards,*
   Muralidhar Yaragalla.
   *
   *
  
 



 --
 e: davelnew...@gmail.com
 m: 908-380-8699
 s: davelnewton_skype
 t: @dave_newton https://twitter.com/dave_newton
 b: Bucky Bits http://buckybits.blogspot.com/
 g: davelnewton https://github.com/davelnewton
 so: Dave Newton http://stackoverflow.com/users/438992/dave-newton





getting configaration error on console. how to rectify?

2013-09-19 Thread Yaragalla Muralidhar
I am getting this error often on server console and the app gets stoped.
how to rectify?

2013-09-20 00:18:29 ERROR Dispatcher:38 - Dispatcher initialization failed
Unable to load configuration. - [unknown location]
at
com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:70)
at
org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:429)
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:473)
at
org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:74)
at
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:51)
at
org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:281)
at
org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:262)
at
org.apache.catalina.core.ApplicationFilterConfig.init(ApplicationFilterConfig.java:107)
at
org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4656)
at
org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5309)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at
org.apache.catalina.core.StandardContext.reload(StandardContext.java:3926)
at
org.apache.catalina.loader.WebappLoader.backgroundProcess(WebappLoader.java:426)
at
org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1345)
at
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1530)
at
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1540)
at
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1540)
at
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1519)
at java.lang.Thread.run(Unknown Source)
Caused by: Caught exception while loading file struts-default.xml -
[unknown location]

*Thanks and Regards,*
Muralidhar Yaragalla.
*
*


validators strange behavior

2013-09-19 Thread Yaragalla Muralidhar
I have written validators for 3 fields but only validation is happening for
one field. Out of 3 fields the validation is happening only for
primDet.admissionDate field. even though the the text fields are empty
for the other 2, the validation is not happening.

The following is the xx-validation.xml file:-

!DOCTYPE validators PUBLIC -//Apache Struts//XWork Validator 1.0.2//EN 
http://struts.apache.org/dtds/xwork-validator-1.0.2.dtd;
validators
field name=primDet.admissionNo
 field-validator type=regex
  param name=regex![CDATA[\d{3,}]]/param
   message key=error.admission.noCould not find error.admission.no
!/message
 /field-validator
/field

field name=primDet.admissionDate
 field-validator type=regex
  param name=regex![CDATA[\d{2}/\d{2}/\d{4}]]/param
   message key=error.admission.dateCould not find
error.admission.date/message
 /field-validator
/field

field name=primDet.applicationNo
 field-validator type=regex
  param name=regex![CDATA[\d{3}]]/param
   message key=error.admission.dateCould not find
error.admission.date/message
 /field-validator
/field
/validators

My jsp is as below:-

form id=form method=post action=primaryDetails.action
input type=text class=text size=15 name=primDet.admissionNo /
input type=text class=text style=color:#DDD4E7 value=dd/mm/
onclick=displayCalendar(event,this) size=15
name=primDet.admissionDate/
input type=text class=text size=15 name=primDet.applicationNo/
/form

what is the problem? why this is happening? kindly help?

*Thanks and Regards,*
Muralidhar Yaragalla.
*
*


RE: XWork injection intermittently skipped

2013-09-19 Thread Patrick Savage
2013/9/19 Lukasz Lenart [lukaszlen...@apache.org]:
2013/9/18 Patrick Savage patrick.sav...@3pillarglobal.com:
 We are using XWork's @Inject in Struts 2.3.1.2 to inject a
 DefaultObjectTypeDeterminer into a custom type converter. Since upgrading
 from Java 1.6.0_33 to 1.7.0_25, this injection does not occur about half the
 time. The other @Inject we use (injecting a ValidatorFactory into a custom
 ActionValidatorManager configured by struts.actionValidatorManager in
 struts.xml) is still always working. There are no log messages at any log
 level that indicate a problem. The container successfully creates the custom
 type converter bean as evidenced by the log message
 java.util.List:com.candyland.web.converters.CandylandCollectionConverter
 [treated as TypeConverter
 com.candyland.web.converters.CandylandCollectionConverter@245f96b0].

 Is it possible that this problem occurs because the getDeclaredMethods
 method in Java 7 no longer returns methods in a consistent order
 (http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7023180)?. Per
 https://groups.google.com/forum/#!topic/google-guice/rQD5L2O-Po8, this
 causes Guice to inject objects in an inconsistent order so presumably the
 Struts container would do the same, but I don't know if that would have any
 negative effects.

This is strange ... as @Inject is used all over the framework and works fine.

 This is the relevant code:
 xwork-conversion.properties:


 java.util.List=com.candyland.web.converters.CandylandCollectionConverter
 ...

 CandylandCollectionConverter.java:

 public class CandylandCollectionConverter extends
 XWorkBasicConverter {
 private ObjectTypeDeterminer objectTypeDeterminer;

 @Inject
 public void setObjectTypeDeterminer(ObjectTypeDeterminer
 det) {
 this.objectTypeDeterminer = det;
 super.setObjectTypeDeterminer(det);
 }
 ...
 }

 As a workaround, we lazily get the DefaultObjectTypeDeterminer by calling
 Dispatcher.getInstance().getContainer().getInstance(ObjectTypeDeterminer.cla
 ss). This seems to be a reasonable workaround, but is there a way to fix the
 injection?

Maybe direct reference to Container would be better solution? And then
lazy obtain reference to ObjectTypeDeterminer?

@Inject
public void setContainer(Container container) {
objectTypeDeterminer = container.getInstance(ObjectTypeDeterminer.class);
}

I think the problem is in setter overriding.

What version of Struts do you use? Sometime ago I have split
XWorkBasicConverter into bunch of small converters which you can
re-implement and redeclare. Or maybe instead inheritance you can use
composition?

public class CandylandCollectionConverter implements TypeConverter {

@Inject
XWorkBasicConverter

@Inject
ObjectTypeDeterminer

}

I don't think the setter overridding is the problem because I have also tried 
injecting into a different method (setObjectTypeDeterminerOverride) which 
didn't work either. Injecting the container doesn't work either because all 
injections into CandylandCollectionConverter are skipped (I have already tried 
injecting an ObjectFactory, ReflectionProvider, and a XWorkConverter). I also 
have already tried composition although the containing converter still 
inherited from XWorkBasicConverter.

I'm using Struts 2.3.1.2 so I don't have your WW-3762 change in 2.3.3 that 
split XWorkBasicConverter into smaller converters. But we are planning to 
upgrade to the latest version soon so I will try that then.

Is our current workaround which lazily calls 
Dispatcher.getInstance().getContainer().getInstance(ObjectTypeDeterminer.class) 
a reasonable long-term solution? 

Martin, I know the Struts DI container is not Guice, but it is based on an old 
version of Guice which is why I suspected that Java 7 change could be related.

--
Patrick


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



RE: how to use single jsp as template

2013-09-19 Thread Martin Gainty
Chris-


I remember with dojo.js you needed to identify DOM attach points for Struts 
Action to populate the DOM at the  specified attach points within the dojo.js

Does Angular.js have DOM Attach points?
Are there additional considerations substituting Angular.js for JS Libraries 
(like Dojo or JQuery) ?

thanks,
Martin-
  



 From: thechrispr...@gmail.com
 Date: Thu, 19 Sep 2013 08:37:04 -0700
 Subject: Re: how to use single jsp as template
 To: user@struts.apache.org
 
 Apache Tiles sounds like exactly what you're looking for, and works great
 with Struts2. You could also consider a single page app (i.e. AngularJS)
 approach.
 (*Chris*)
 
 
 On Thu, Sep 19, 2013 at 8:23 AM, Yaragalla Muralidhar 
 yaragallamur...@gmail.com wrote:
 
  hi I have a jsp with a layout. it means the jsp has menu on the left and
  header on the top. now for every action the center part of the jsp should
  change. Is this possible?
 
  I mean for every different action a different jsp should be included in the
  center of the layout jsp. If this is possible it will be of so much help.
  kindly help? if possible is there a solution without tiles?
 
 
 
  *Thanks and Regards,*
  Muralidhar Yaragalla.
  *
  *
 
  

Re: how to use single jsp as template

2013-09-19 Thread Chris Pratt
Angular makes web service requests to rest services to get its data, so
there are no struts tags or attach points to deal with, but you pretty much
develop the whole app as a single page that makes rest calls for data.
  (*Chris*)


On Thu, Sep 19, 2013 at 6:09 PM, Martin Gainty mgai...@hotmail.com wrote:

 Chris-


 I remember with dojo.js you needed to identify DOM attach points for
 Struts Action to populate the DOM at the  specified attach points within
 the dojo.js

 Does Angular.js have DOM Attach points?
 Are there additional considerations substituting Angular.js for JS
 Libraries (like Dojo or JQuery) ?

 thanks,
 Martin-




  From: thechrispr...@gmail.com
  Date: Thu, 19 Sep 2013 08:37:04 -0700
  Subject: Re: how to use single jsp as template
  To: user@struts.apache.org
 
  Apache Tiles sounds like exactly what you're looking for, and works great
  with Struts2. You could also consider a single page app (i.e. AngularJS)
  approach.
  (*Chris*)
 
 
  On Thu, Sep 19, 2013 at 8:23 AM, Yaragalla Muralidhar 
  yaragallamur...@gmail.com wrote:
 
   hi I have a jsp with a layout. it means the jsp has menu on the left
 and
   header on the top. now for every action the center part of the jsp
 should
   change. Is this possible?
  
   I mean for every different action a different jsp should be included
 in the
   center of the layout jsp. If this is possible it will be of so much
 help.
   kindly help? if possible is there a solution without tiles?
  
  
  
   *Thanks and Regards,*
   Muralidhar Yaragalla.
   *
   *