Re: please unsubscribe me from this list.

2007-08-10 Thread Antonio Petrelli
2007/8/10, Mr. nitin [EMAIL PROTECTED]:
 please unsubscribe my id from this user mail group.
 i had tried lot but its not working.

Send a mail to:
[EMAIL PROTECTED]

Antonio

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



Re: [OT] Question about performance with last array

2007-08-10 Thread Antonio Petrelli
2007/8/10, Ashish Kulkarni [EMAIL PROTECTED]:
 Hi
 I have a program which creates permutations for 10 letters, so the values i
 get is 10 ^10 which is more then 3 million

Do you mean permutations (the same letters ordered in different ways)
or dispositions with repetition (the 10-letter group can be taken from
the 26 letters of the alphabet, can be repeated and can stay in any
order)?
Permutations: 10! possibilities
Dispositions with repetition: 26^10

 Now i have to go through all 3 million records and do some calculations to
 determine the best possible combination .

 Any ideas what i should use, LinkedList, ArrayList, HashMap,
 what would be the best way performance wise

 should i use primitive or objects for calculations.
 Any suggestions on approaching this problem.

IMHO it's better not to do it! :-) AFAICT, either way you are using
permutations or dispositions with repetition, it is a O(e^n) problem,
i.e. exponential complexity.
I think that you need to change the problem, or solve it in another
way, to go down to polynomial complexity.
The answer, then, is that the complexity does not depend on the
array-like structure you are using.

Just my 0.02 euros.
Antonio

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



RE: S2 : Validation per Action method - ideas?

2007-08-10 Thread beto

Hi again, and thank you for your answer.

I've tried using @Validations at the method level as you point out. I'll try
to illustrate:

I have an action, not annotated with @Validation, with three action methods;
input, execute and confirm (custom action method).

The input method has no annotations and is not validated as expected.

The execute method is annotated with @Validations:

@Validations(requiredStrings={  @RequiredStringValidator(fieldName=amount,
message=Amount is required, key=amount.required) }, regexFields={
@RegexFieldValidator(fieldName=amount, expression=^\\d+$,
message=Amount has to be numeric, key=amount.numeric) })
public String execute() throws Exception {
  ...
}

The confirm method is also annotated with @Validations:

@Validations(expressions={ @ExpressionValidator(expression=confirm ==
true, message=test) })
public String confirm() throws Exception {
  ...
}

And here comes the confusing part. When I call my action with no method name
indicator (say MyAction, not MyAction_confirm), both fields (amount and
confirm) is validated. I just want to validate amount when execute is
called and only the field confirm when the confirm method is called.

What am I doing wrong?

beto


Arno wrote:
 
 This is the Validations (with a 's' at the end :-) ) that can be put on a
 method. The syntax is pretty confusing but the functionality quite neat.
 
 http://struts.apache.org/2.x/struts2-core/apidocs/com/opensymphony/xwork2/va
 lidator/annotations/Validations.html
 
 -Message d'origine-
 De : beto [mailto:[EMAIL PROTECTED] 
 Envoyé : vendredi 10 août 2007 10:57
 À : user@struts.apache.org
 Objet : RE: S2 : Validation per Action method - ideas?
 
 
 Hi.
 
 I've tried using validation annotation (which works great) and ran into
 the
 scenario mentioned by Joseph. I have different action methods which
 requires
 different set of validation rules. I can not find out how to set up
 validation annotation to differentiate the validation rules based on which
 action method that is called. I do not wish to use validation xml-files if
 I
 can avoid it, and will probably end up creating separate action classes in
 these scenarios if not anybody can point out a solution to this problem.
 
 Am I missing something?
 
 Do you have the solution Arno? :-) 
 
 
 Arno wrote:
 
 You should check the Javadoc of the
 com.opensymphony.xwork2.validator.annotations.Validation annotation.
 
 Syntax example:
 
 @Validations(
  requiredFields =
  [EMAIL PROTECTED](type =
 ValidatorType.SIMPLE,
 fieldName = customfield, message = You must enter a value for
 field.)},
  requiredStrings =
  [EMAIL PROTECTED](type =
 ValidatorType.SIMPLE,
 fieldName = stringisrequired, message = You must enter a value for
 string.)}
  
  )
  public String execute() throws Exception {
  return SUCCESS;
  }
 
 -Message d'origine-
 De : j alex [mailto:[EMAIL PROTECTED] 
 Envoyé : jeudi 9 août 2007 15:38
 À : Struts Users Mailing List
 Objet : S2 : Validation per Action method - ideas?
 
 Hi,
 
 Is there a way to declaratively restrict validations depending on the
 method
 within the Action? - this could be useful for wizard-like forms where
 each
 step of the wizard has a set of fields ; corresponds to a different
 method
 but all of them share the same Action.
 
 I can think of having an expression validator based on currentstep added
 to
 every field short-circuited ; but that's more of a workaround rather than
 the right way to do it.
 
 Thanks,
 Joseph
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 
 -- 
 View this message in context:
 http://www.nabble.com/S2-%3A-Validation-per-Action-method---ideas--tf4242670
 .html#a12087696
 Sent from the Struts - User mailing list archive at Nabble.com.
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/S2-%3A-Validation-per-Action-method---ideas--tf4242670.html#a12088476
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: S2 : Validation per Action method - ideas?

2007-08-10 Thread beto

Yes, I removed the annotations from the setters. I might be overlooking
something, but I'm not sure where to start looking at this moment. Is there
any more details I could provide to help you see the clear picture?


Arno wrote:
 
 Pretty strange indeed. Did you remove all the validation annotations on
 the
 field setters?
 
 -Message d'origine-
 De : beto [mailto:[EMAIL PROTECTED] 
 Envoyé : vendredi 10 août 2007 11:56
 À : user@struts.apache.org
 Objet : RE: S2 : Validation per Action method - ideas?
 
 
 Hi again, and thank you for your answer.
 
 I've tried using @Validations at the method level as you point out. I'll
 try
 to illustrate:
 
 I have an action, not annotated with @Validation, with three action
 methods;
 input, execute and confirm (custom action method).
 
 The input method has no annotations and is not validated as expected.
 
 The execute method is annotated with @Validations:
 
 @Validations(requiredStrings={
 @RequiredStringValidator(fieldName=amount,
 message=Amount is required, key=amount.required) }, regexFields={
 @RegexFieldValidator(fieldName=amount, expression=^\\d+$,
 message=Amount has to be numeric, key=amount.numeric) })
 public String execute() throws Exception {
   ...
 }
 
 The confirm method is also annotated with @Validations:
 
 @Validations(expressions={ @ExpressionValidator(expression=confirm ==
 true, message=test) })
 public String confirm() throws Exception {
   ...
 }
 
 And here comes the confusing part. When I call my action with no method
 name
 indicator (say MyAction, not MyAction_confirm), both fields (amount and
 confirm) is validated. I just want to validate amount when execute is
 called and only the field confirm when the confirm method is called.
 
 What am I doing wrong?
 
 beto
 
 
 Arno wrote:
 
 This is the Validations (with a 's' at the end :-) ) that can be put on a
 method. The syntax is pretty confusing but the functionality quite neat.
 

 http://struts.apache.org/2.x/struts2-core/apidocs/com/opensymphony/xwork2/va
 lidator/annotations/Validations.html
 
 -Message d'origine-
 De : beto [mailto:[EMAIL PROTECTED] 
 Envoyé : vendredi 10 août 2007 10:57
 À : user@struts.apache.org
 Objet : RE: S2 : Validation per Action method - ideas?
 
 
 Hi.
 
 I've tried using validation annotation (which works great) and ran into
 the
 scenario mentioned by Joseph. I have different action methods which
 requires
 different set of validation rules. I can not find out how to set up
 validation annotation to differentiate the validation rules based on
 which
 action method that is called. I do not wish to use validation xml-files
 if
 I
 can avoid it, and will probably end up creating separate action classes
 in
 these scenarios if not anybody can point out a solution to this problem.
 
 Am I missing something?
 
 Do you have the solution Arno? :-) 
 
 
 Arno wrote:
 
 You should check the Javadoc of the
 com.opensymphony.xwork2.validator.annotations.Validation annotation.
 
 Syntax example:
 
 @Validations(
  requiredFields =
  [EMAIL PROTECTED](type =
 ValidatorType.SIMPLE,
 fieldName = customfield, message = You must enter a value for
 field.)},
  requiredStrings =
  [EMAIL PROTECTED](type =
 ValidatorType.SIMPLE,
 fieldName = stringisrequired, message = You must enter a value for
 string.)}
  
  )
  public String execute() throws Exception {
  return SUCCESS;
  }
 
 -Message d'origine-
 De : j alex [mailto:[EMAIL PROTECTED] 
 Envoyé : jeudi 9 août 2007 15:38
 À : Struts Users Mailing List
 Objet : S2 : Validation per Action method - ideas?
 
 Hi,
 
 Is there a way to declaratively restrict validations depending on the
 method
 within the Action? - this could be useful for wizard-like forms where
 each
 step of the wizard has a set of fields ; corresponds to a different
 method
 but all of them share the same Action.
 
 I can think of having an expression validator based on currentstep added
 to
 every field short-circuited ; but that's more of a workaround rather
 than
 the right way to do it.
 
 Thanks,
 Joseph
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 
 -- 
 View this message in context:

 http://www.nabble.com/S2-%3A-Validation-per-Action-method---ideas--tf4242670
 .html#a12087696
 Sent from the Struts - User mailing list archive at Nabble.com.
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 
 -- 
 View this message in context:
 http://www.nabble.com/S2-%3A-Validation-per-Action-method---ideas--tf4242670
 

RE: struts1 or struts 2?

2007-08-10 Thread Asthana, Rahul
Hi Ted/Frank,
Well, The first project I did in the industry,(I was a trainee then) in 2000 
was a full scale ajax(of course,we called it something else) project. Ajax was 
used out of compulsion.We had a gigantic user entry form with around 100 
controls;which was divided into 5 tabs, which were actually layers/divs. It 
could not be one single page\form due to constraints of user experience; and it 
could not be five different jsps because the tabs had inter-related field 
validation rules.
We used ajax for populating dependendent combo boxes and showing error messages 
based on server side validations.It did not make sense to post the whole 
gigantic form for showing an error message.I still dont see how we could have 
done that without ajax.The challenges were kind of similar to DOJO users of 
today.Large javascript files made the pages heavier to load.
Otherwise, it worked out quite well.
By the way, have any of you done any performance metrics on an ajax based 
implementation vs a non ajax based one?
rgds
Rahul

-Original Message-
From: Frank W. Zammetti [mailto:[EMAIL PROTECTED]
Sent: Thursday, August 09, 2007 10:25 AM
To: Struts Users Mailing List
Cc: Struts Users Mailing List
Subject: Re: struts1 or struts 2?


On Thu, August 9, 2007 8:24 am, Ted Husted wrote:
 IMHO, if we had today's JavaScript/CSS/HTML environment available to
 us in 1998, then JSP, ASP, JSF, PHP, and all the rest of it, would not
 exist. We did all these things to make up for the shortcomings of the
 client-side environment, and, since then, the key shortcomings have
 been addressed.

Great observation IMO, and it couldn't be more true.

I always like to tell the story of a Java users group I was at maybe two
years ago now... the speaker was talking about AJAX and he said that the
people who know what AJAX is at that point are the same people who are
pissed about it because frankly it hasn't been anything new for them for
some time!

I have one app that was put in production in 1998 ironically, the year you
picked here Ted, that you'd look at today and say it was AJAX, an RIA, but
it didn't use what we'd call AJAX now (hidden iFrame that got Javascript
back which executed upon return and automatically updated and hide and
showed a variety of DIVs on the page... in fact, this is the extreme case
because absolutely every view the user can ever see in the app is loaded
up front and never generated server-side, it's only data being plugged
into fields after startup).  If I'd have thought for one second that what
I was doing was any big deal, unusual in some way, it could have been my
name going down in history as having invented AJAX instead of Jesse James
Garrett!  And the worse part is I know I'm not the only one that can say
that! LOL

I've had the interesting experience of witnessing an evolution here at
work... in 1998, I was the only one building apps in that fashion at this
company, everyone else was very much at the other extreme, the whole let
the server do everything approach as you described, thin pages, etc. 
Everyone thought I was nuts (I only got away with it because my projects
are always successful, something not everyone here can claim), I got into
some really heated dehates with folks over the years about it too.  Now,
things are very much swinging the other way... apps are being built now in
much more RIA ways, it's much more mainstream thinking.

I think that evolution is playing itself out across many organizations
now, and that's my point: there's a critical mass now, and the mindset is
starting to change, and Ted's right, many of the technologies we're
saddled with today would never have needed inventing if everyone had
listened to me (or the others that were doing what I did in various
orgamizations) back in 1998! LOL

 -Ted.

Frank


-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
AIM/Yahoo: fzammetti
MSN: [EMAIL PROTECTED]
Author of Practical Ajax Projects With Java Technology
 (2006, Apress, ISBN 1-59059-695-1)
and JavaScript, DOM Scripting and Ajax Projects
 (2007, Apress, ISBN 1-59059-816-4)
Java Web Parts - http://javawebparts.sourceforge.net
 Supplying the wheel, so you don't have to reinvent it!

-
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: WARNings from OgnlUtil during normal use of redirect-action result

2007-08-10 Thread stanlick
This really doesn't answer the question, does it?  My car engine makes a
noise, but if I turn on the iPod, everything seems okay!

On 8/10/07, Mike Baroukh [EMAIL PROTECTED] wrote:


 I think that this exception occur only if you have struts.devMode=true
 in struts.properties ...


 Marco Carnevale a écrit :
  I am have the same question.  Does anyone have any thoughts about this?
 
  On 8/9/07, Cameron, David [EMAIL PROTECTED] wrote:
  Hi
 
  I believe I'm using the redirect-action result type in the recommended
  way, but I'm seeing warnings from OgnlUtil in my log4j logs. Is there a
  way to avoid the warnings, short of adjusting log4j.xml? The stack
  traces are very deep, so they spam the logs. But I don't really want to
  exclude all warnings from OgnlUtil from my logs, because I want the
  application to be as easy to maintain as possible.
 
  The current exception is correct: there is no property 'pageName' on
  'org.apache.struts2.dispatcher.ServletActionRedirectResult'. I want the
  'pageName' parameter passed as a parameter to the next action. The
  struts documentation at
  http://struts.apache.org/2.x/docs/redirect-action-result.html suggests
  that my struts config file is following the correct usage to achieve
  this effect.
 
  Here's a snippet from my struts.xml:
  action name=savePagePart5
 class=com.zzz.actions.SaveApplicationAction
 result name=success type=redirect-action
 param name=actionNameviewPage.action/param
 param name=pageName${page.nextPage}/param
 /result
  /action
 
  And an excerpt from the resulting stack trace:
  [2007-08-09 12:41:40,246] WARN  [SocketListener0-0]
  com.opensymphony.xwork2.util.OgnlUtil:369 - Caught OgnlException while
  setting property 'pageName' on type
  'org.apache.struts2.dispatcher.ServletActionRedirectResult'.
  ognl.NoSuchPropertyException:
  org.apache.struts2.dispatcher.ServletActionRedirectResult.pageName
 at
  ognl.ObjectPropertyAccessor.setProperty(ObjectPropertyAccessor.java
 :132)
 at
  com.opensymphony.xwork2.util.OgnlValueStack$ObjectAccessor.setProperty
 (O
  gnlValueStack.java:68)
 at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:1656)
 at ognl.ASTProperty.setValueBody(ASTProperty.java:101)
 at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:177)
 at ognl.SimpleNode.setValue(SimpleNode.java:246)
 at ognl.Ognl.setValue(Ognl.java:476)
 at
  com.opensymphony.xwork2.util.OgnlUtil.setValue(OgnlUtil.java:186)
 at
  com.opensymphony.xwork2.util.OgnlUtil.internalSetProperty(OgnlUtil.java
 :
  360)
 at
  com.opensymphony.xwork2.util.OgnlUtil.setProperties(OgnlUtil.java:76)
 at
  com.opensymphony.xwork2.util.OgnlUtil.setProperties(OgnlUtil.java:49)
 at
  org.apache.struts2.impl.StrutsObjectFactory.buildResult
 (StrutsObjectFact
  ory.java:95)
 at
  com.opensymphony.xwork2.DefaultActionInvocation.createResult
 (DefaultActi
  onInvocation.java:195)
 at
  com.opensymphony.xwork2.DefaultActionInvocation.executeResult
 (DefaultAct
  ionInvocation.java:342)
 at
  com.opensymphony.xwork2.DefaultActionInvocation.invoke
 (DefaultActionInvo
  cation.java:253)
 ..
 at
  org.mortbay.http.HttpConnection.handle(HttpConnection.java:837)
 at
  org.mortbay.http.SocketListener.handleConnection(SocketListener.java
 :245
  )
 at
  org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:357)
 at
  org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534)
 
 
  Cheers!
  Dave
 
 
  This e-mail and any attachments to it (the Communication) is, unless
  otherwise stated, confidential,  may contain copyright material and is
 for
  the use only of the intended recipient. If you receive the
 Communication in
  error, please notify the sender immediately by return e-mail, delete
 the
  Communication and the return e-mail, and do not read, copy, retransmit
 or
  otherwise deal with it. Any views expressed in the Communication are
 those
  of the individual sender only, unless expressly stated to be those of
  Australia and New Zealand Banking Group Limited ABN 11 005 357 522, or
 any
  of its related entities including ANZ National Bank Limited (together
  ANZ). ANZ does not accept liability in connection with the integrity
 of or
  errors in the Communication, computer virus, data corruption,
 interference
  or delay arising from or in respect of the Communication.
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

 --

 Mike Baroukh

 ---
 Cardiweb  - 31 Rue de Mogador Paris IXeme
 06 63 57 27 22 - 01 53 21 82 63 - Jabber: [EMAIL PROTECTED]
 http://www.cardiweb.com
 ---


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




-- 

Dynamic Tree Example

2007-08-10 Thread stanlick
I'm studying the dynamic tree example in the showcase, and there are a
couple problems.  First, when you view sources, the configuration for the
dynamicTreeSelectAction is not visible.  Also, as I inspect this action, I'm
discovering that its dynamicTreeSelect.jsp never displays the node
selected!  Is this example not finished?

-- 
Scott
[EMAIL PROTECTED]


Re: struts 2.0.8 problem implementing filter

2007-08-10 Thread Toni Lyytikäinen
Sorry, but why go the hard way when you can achieve the same with a simple
interceptor? You can return a global result from a interceptor (f.ex. return
errorPage) which is lot simpler than getting tangled with the
RequestDispatcher stuff.

On 8/10/07, Toni Lyytikäinen [EMAIL PROTECTED] wrote:

 Sorry, but why go the hard way when you can achieve the same with a simple
 interceptor? You can return a global result from a filter (f.ex. return
 errorPage) which is lot simpler than getting tangled with the
 RequestDispatcher stuff.

 On 8/10/07, Eugen Stoianovici [EMAIL PROTECTED] wrote:
 
  i'm trying to use a custom filter to implement authorization and i can't
  get the damned thing to work (i'm an absolute beginner, be warned).
  i'm using struts2.0.8 with tomcat 5.5
 
  my doFilter method looks like this
  public class AuthorizationFilter implements Filter {
  public void doFilter(ServletRequest request, ServletResponse response,
 FilterChain chain) throws IOException, ServletException {
 
 HttpServletRequest req = (HttpServletRequest) request;
 HttpServletResponse res = (HttpServletResponse) response;
 
 HttpSession session = req.getSession();
 Employee employee = (Employee) session.getAttribute(user);
 boolean hasRole = false;
   if(employee!=null){
 for (int i = 0; i  roleNames.length; i++) {
 if (employee.hasRole(roleNames[i])) {
 hasRole = true;
 break;
 }
 }
 }
 if (hasRole) {
 chain.doFilter(request, response);
 } else {
 req.getRequestDispatcher(onErrorUrl).forward(req, res);
 }
  }
  }
 
  the browser reports: (line 47 is
  req.getRequestDispatcher(onErrorUrl).forward(req, res); )
 
  *type* Exception report
 
  *message*
 
  *description* _The server encountered an internal error () that
  prevented it from fulfilling this request._
 
  *exception*
 
  org.apache.jasper.JasperException
  org.apache.jasper.servlet.JspServletWrapper.handleJspException(
  JspServletWrapper.java:476)
 
  org.apache.jasper.servlet.JspServletWrapper.service (
  JspServletWrapper.java:389)
 
  org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java
  :315)
 
  org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
  javax.servlet.http.HttpServlet.service (HttpServlet.java:803)
  security.AuthorizationFilter.doFilter(AuthorizationFilter.java:47)
 
  *root cause*
 
  java.lang.NullPointerException
  org.apache.struts2.views.jsp.TagUtils.getStack(TagUtils.java :58)
  org.apache.struts2.views.jsp.StrutsBodyTagSupport.getStack(
  StrutsBodyTagSupport.java:52)
 
  org.apache.struts2.views.jsp.ComponentTagSupport.doStartTag(
  ComponentTagSupport.java:49)
 
  org.apache.jsp.index_jsp._jspx_meth_s_005furl_005f0(index_jsp.java:102)
  org.apache.jsp.index_jsp._jspService(index_jsp.java:62)
  org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
  javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
  org.apache.jasper.servlet.JspServletWrapper.service(
  JspServletWrapper.java:328)
 
  org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java
  :315)
 
  org.apache.jasper.servlet.JspServlet.service (JspServlet.java:265)
  javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
  security.AuthorizationFilter.doFilter(AuthorizationFilter.java:47)
 
  *
  *__
 
 
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 



Re: struts 2.0.8 problem implementing filter

2007-08-10 Thread Toni Lyytikäinen
Sorry, but why go the hard way when you can achieve the same with a simple
interceptor? You can return a global result from a filter (f.ex. return
errorPage) which is lot simpler than getting tangled with the
RequestDispatcher stuff.

On 8/10/07, Eugen Stoianovici [EMAIL PROTECTED] wrote:

 i'm trying to use a custom filter to implement authorization and i can't
 get the damned thing to work (i'm an absolute beginner, be warned).
 i'm using struts2.0.8 with tomcat 5.5

 my doFilter method looks like this
 public class AuthorizationFilter implements Filter {
 public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {

HttpServletRequest req = (HttpServletRequest) request;
HttpServletResponse res = (HttpServletResponse) response;

HttpSession session = req.getSession();
Employee employee = (Employee) session.getAttribute(user);
boolean hasRole = false;
  if(employee!=null){
for (int i = 0; i  roleNames.length; i++) {
if (employee.hasRole(roleNames[i])) {
hasRole = true;
break;
}
}
}
if (hasRole) {
chain.doFilter(request, response);
} else {
req.getRequestDispatcher(onErrorUrl).forward(req, res);
}
 }
 }

 the browser reports: (line 47 is
 req.getRequestDispatcher(onErrorUrl).forward(req, res); )

 *type* Exception report

 *message*

 *description* _The server encountered an internal error () that
 prevented it from fulfilling this request._

 *exception*

 org.apache.jasper.JasperException
 org.apache.jasper.servlet.JspServletWrapper.handleJspException(
 JspServletWrapper.java:476)

 org.apache.jasper.servlet.JspServletWrapper.service(
 JspServletWrapper.java:389)

 org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java
 :315)

 org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
 security.AuthorizationFilter.doFilter(AuthorizationFilter.java:47)

 *root cause*

 java.lang.NullPointerException
 org.apache.struts2.views.jsp.TagUtils.getStack(TagUtils.java:58)
 org.apache.struts2.views.jsp.StrutsBodyTagSupport.getStack(
 StrutsBodyTagSupport.java:52)

 org.apache.struts2.views.jsp.ComponentTagSupport.doStartTag(
 ComponentTagSupport.java:49)

 org.apache.jsp.index_jsp._jspx_meth_s_005furl_005f0
 (index_jsp.java:102)
 org.apache.jsp.index_jsp._jspService(index_jsp.java:62)
 org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
 org.apache.jasper.servlet.JspServletWrapper.service(
 JspServletWrapper.java:328)

 org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java
 :315)

 org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
 security.AuthorizationFilter.doFilter(AuthorizationFilter.java:47)

 *
 *__




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




struts 2.0.8 problem implementing filter

2007-08-10 Thread Eugen Stoianovici
i'm trying to use a custom filter to implement authorization and i can't 
get the damned thing to work (i'm an absolute beginner, be warned).

i'm using struts2.0.8 with tomcat 5.5

my doFilter method looks like this
public class AuthorizationFilter implements Filter {
public void doFilter(ServletRequest request, ServletResponse response,
  FilterChain chain) throws IOException, ServletException {

  HttpServletRequest req = (HttpServletRequest) request;
  HttpServletResponse res = (HttpServletResponse) response;

  HttpSession session = req.getSession();
  Employee employee = (Employee) session.getAttribute(user);
  boolean hasRole = false;
if(employee!=null){
  for (int i = 0; i  roleNames.length; i++) {
  if (employee.hasRole(roleNames[i])) {
  hasRole = true;
  break;
  }
  }
  }
  if (hasRole) {
  chain.doFilter(request, response);
  } else {
  req.getRequestDispatcher(onErrorUrl).forward(req, res);
  }
}
}

the browser reports: (line 47 is
req.getRequestDispatcher(onErrorUrl).forward(req, res); )


*type* Exception report

*message*

*description* _The server encountered an internal error () that 
prevented it from fulfilling this request._


*exception*

org.apache.jasper.JasperException
   org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:476) 

   org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:389) 

   org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:315) 


   org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
   javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
   security.AuthorizationFilter.doFilter(AuthorizationFilter.java:47)

*root cause*

java.lang.NullPointerException
   org.apache.struts2.views.jsp.TagUtils.getStack(TagUtils.java:58)
   org.apache.struts2.views.jsp.StrutsBodyTagSupport.getStack(StrutsBodyTagSupport.java:52) 

   org.apache.struts2.views.jsp.ComponentTagSupport.doStartTag(ComponentTagSupport.java:49) 


   org.apache.jsp.index_jsp._jspx_meth_s_005furl_005f0(index_jsp.java:102)
   org.apache.jsp.index_jsp._jspService(index_jsp.java:62)
   org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
   javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
   org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:328) 

   org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:315) 


   org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
   javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
   security.AuthorizationFilter.doFilter(AuthorizationFilter.java:47)

*
*__




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



Re: WARNings from OgnlUtil during normal use of redirect-action result

2007-08-10 Thread Mike Baroukh


I think that this exception occur only if you have struts.devMode=true 
in struts.properties ...



Marco Carnevale a écrit :

I am have the same question.  Does anyone have any thoughts about this?

On 8/9/07, Cameron, David [EMAIL PROTECTED] wrote:

Hi

I believe I'm using the redirect-action result type in the recommended
way, but I'm seeing warnings from OgnlUtil in my log4j logs. Is there a
way to avoid the warnings, short of adjusting log4j.xml? The stack
traces are very deep, so they spam the logs. But I don't really want to
exclude all warnings from OgnlUtil from my logs, because I want the
application to be as easy to maintain as possible.

The current exception is correct: there is no property 'pageName' on
'org.apache.struts2.dispatcher.ServletActionRedirectResult'. I want the
'pageName' parameter passed as a parameter to the next action. The
struts documentation at
http://struts.apache.org/2.x/docs/redirect-action-result.html suggests
that my struts config file is following the correct usage to achieve
this effect.

Here's a snippet from my struts.xml:
action name=savePagePart5
   class=com.zzz.actions.SaveApplicationAction
   result name=success type=redirect-action
   param name=actionNameviewPage.action/param
   param name=pageName${page.nextPage}/param
   /result
/action

And an excerpt from the resulting stack trace:
[2007-08-09 12:41:40,246] WARN  [SocketListener0-0]
com.opensymphony.xwork2.util.OgnlUtil:369 - Caught OgnlException while
setting property 'pageName' on type
'org.apache.struts2.dispatcher.ServletActionRedirectResult'.
ognl.NoSuchPropertyException:
org.apache.struts2.dispatcher.ServletActionRedirectResult.pageName
   at
ognl.ObjectPropertyAccessor.setProperty(ObjectPropertyAccessor.java:132)
   at
com.opensymphony.xwork2.util.OgnlValueStack$ObjectAccessor.setProperty(O
gnlValueStack.java:68)
   at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:1656)
   at ognl.ASTProperty.setValueBody(ASTProperty.java:101)
   at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:177)
   at ognl.SimpleNode.setValue(SimpleNode.java:246)
   at ognl.Ognl.setValue(Ognl.java:476)
   at
com.opensymphony.xwork2.util.OgnlUtil.setValue(OgnlUtil.java:186)
   at
com.opensymphony.xwork2.util.OgnlUtil.internalSetProperty(OgnlUtil.java:
360)
   at
com.opensymphony.xwork2.util.OgnlUtil.setProperties(OgnlUtil.java:76)
   at
com.opensymphony.xwork2.util.OgnlUtil.setProperties(OgnlUtil.java:49)
   at
org.apache.struts2.impl.StrutsObjectFactory.buildResult(StrutsObjectFact
ory.java:95)
   at
com.opensymphony.xwork2.DefaultActionInvocation.createResult(DefaultActi
onInvocation.java:195)
   at
com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultAct
ionInvocation.java:342)
   at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvo
cation.java:253)
   ..
   at
org.mortbay.http.HttpConnection.handle(HttpConnection.java:837)
   at
org.mortbay.http.SocketListener.handleConnection(SocketListener.java:245
)
   at
org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:357)
   at
org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534)


Cheers!
Dave


This e-mail and any attachments to it (the Communication) is, unless
otherwise stated, confidential,  may contain copyright material and is for
the use only of the intended recipient. If you receive the Communication in
error, please notify the sender immediately by return e-mail, delete the
Communication and the return e-mail, and do not read, copy, retransmit or
otherwise deal with it. Any views expressed in the Communication are those
of the individual sender only, unless expressly stated to be those of
Australia and New Zealand Banking Group Limited ABN 11 005 357 522, or any
of its related entities including ANZ National Bank Limited (together
ANZ). ANZ does not accept liability in connection with the integrity of or
errors in the Communication, computer virus, data corruption, interference
or delay arising from or in respect of the Communication.

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






--

Mike Baroukh

---
Cardiweb  - 31 Rue de Mogador Paris IXeme
06 63 57 27 22 - 01 53 21 82 63 - Jabber: [EMAIL PROTECTED]
http://www.cardiweb.com
---


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



Re: Doubled requests in TabbedPane

2007-08-10 Thread Marco Carnevale
I had the same problem when I was using 2.0.6.  Upgrading to 2.0.8 \
2.0.9resolved the issue.

On 8/9/07, Sebastian Kolbe [EMAIL PROTECTED] wrote:

 Hello

 Hope someone can help me with this:
 I have a TabbedPane with some tabs in it, each calling an url for
 their content.
 Now I have several problems:
 - I noticed that the selected tab calls the url two times before
 displaying.
 - I reload a specific tab by publishing a dojo-topic. In this
 situation the div calls the
 url two times.

 Since especially some older browser need a lot of time to display the
 tabs content
 I need to correct this.
 Is there a way to circumvent this behaviour? Maybe I did anything wrong?

 Another question:
 Is there an easy way to catch the event (something like 'onclick') when
 a different tab is selected?

 Here is my code for reference:
 s:tabbedPanel id=resultTabPanel
 selectedTab=resultPanelTab_%{maxTabId}
s:url id=infoActionUrl
 action=SearchAction_fetchResultTable/s:url

s:div id=resultPanelTab_1 cssClass=panelTab
 label=tab1 theme=ajax labelposition=top
 href=%{infoActionUrl}
 errorText=Loading error on tab1
 refreshOnShow=false listenTopics=searchTab_0_Topic
 loadingText=Loading...
 showLoadingText=false autoStart=false executeScripts=true
div id=indicator1 align=center style=display:block;
   img  src=../pics/spinning_wheel_throbber.gif width=64
 height=64 alt=Loading...border=0 title=Loading.../
  /div
/s:div
 /s:tabbelPanel


 Thanks,
 Sebastian

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




Re: WARNings from OgnlUtil during normal use of redirect-action result

2007-08-10 Thread Marco Carnevale
I am have the same question.  Does anyone have any thoughts about this?

On 8/9/07, Cameron, David [EMAIL PROTECTED] wrote:

 Hi

 I believe I'm using the redirect-action result type in the recommended
 way, but I'm seeing warnings from OgnlUtil in my log4j logs. Is there a
 way to avoid the warnings, short of adjusting log4j.xml? The stack
 traces are very deep, so they spam the logs. But I don't really want to
 exclude all warnings from OgnlUtil from my logs, because I want the
 application to be as easy to maintain as possible.

 The current exception is correct: there is no property 'pageName' on
 'org.apache.struts2.dispatcher.ServletActionRedirectResult'. I want the
 'pageName' parameter passed as a parameter to the next action. The
 struts documentation at
 http://struts.apache.org/2.x/docs/redirect-action-result.html suggests
 that my struts config file is following the correct usage to achieve
 this effect.

 Here's a snippet from my struts.xml:
 action name=savePagePart5
class=com.zzz.actions.SaveApplicationAction
result name=success type=redirect-action
param name=actionNameviewPage.action/param
param name=pageName${page.nextPage}/param
/result
 /action

 And an excerpt from the resulting stack trace:
 [2007-08-09 12:41:40,246] WARN  [SocketListener0-0]
 com.opensymphony.xwork2.util.OgnlUtil:369 - Caught OgnlException while
 setting property 'pageName' on type
 'org.apache.struts2.dispatcher.ServletActionRedirectResult'.
 ognl.NoSuchPropertyException:
 org.apache.struts2.dispatcher.ServletActionRedirectResult.pageName
at
 ognl.ObjectPropertyAccessor.setProperty(ObjectPropertyAccessor.java:132)
at
 com.opensymphony.xwork2.util.OgnlValueStack$ObjectAccessor.setProperty(O
 gnlValueStack.java:68)
at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:1656)
at ognl.ASTProperty.setValueBody(ASTProperty.java:101)
at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:177)
at ognl.SimpleNode.setValue(SimpleNode.java:246)
at ognl.Ognl.setValue(Ognl.java:476)
at
 com.opensymphony.xwork2.util.OgnlUtil.setValue(OgnlUtil.java:186)
at
 com.opensymphony.xwork2.util.OgnlUtil.internalSetProperty(OgnlUtil.java:
 360)
at
 com.opensymphony.xwork2.util.OgnlUtil.setProperties(OgnlUtil.java:76)
at
 com.opensymphony.xwork2.util.OgnlUtil.setProperties(OgnlUtil.java:49)
at
 org.apache.struts2.impl.StrutsObjectFactory.buildResult(StrutsObjectFact
 ory.java:95)
at
 com.opensymphony.xwork2.DefaultActionInvocation.createResult(DefaultActi
 onInvocation.java:195)
at
 com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultAct
 ionInvocation.java:342)
at
 com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvo
 cation.java:253)
..
at
 org.mortbay.http.HttpConnection.handle(HttpConnection.java:837)
at
 org.mortbay.http.SocketListener.handleConnection(SocketListener.java:245
 )
at
 org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:357)
at
 org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534)


 Cheers!
 Dave


 This e-mail and any attachments to it (the Communication) is, unless
 otherwise stated, confidential,  may contain copyright material and is for
 the use only of the intended recipient. If you receive the Communication in
 error, please notify the sender immediately by return e-mail, delete the
 Communication and the return e-mail, and do not read, copy, retransmit or
 otherwise deal with it. Any views expressed in the Communication are those
 of the individual sender only, unless expressly stated to be those of
 Australia and New Zealand Banking Group Limited ABN 11 005 357 522, or any
 of its related entities including ANZ National Bank Limited (together
 ANZ). ANZ does not accept liability in connection with the integrity of or
 errors in the Communication, computer virus, data corruption, interference
 or delay arising from or in respect of the Communication.

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




Re: MultiPartRequest bean for File Upload missing?

2007-08-10 Thread yitzle
On 8/9/07, Dave Newton [EMAIL PROTECTED] wrote:
 --- yitzle [EMAIL PROTECTED] wrote:
  I had
  s:form action=CertificateImport method=POST
  enctype=multipart/form-data 
  and tried with
  form action=CertificateImport.action
  method=POST
  enctype=multipart/form-data 
  When I tried
  html:form ...  I got
  No tag form defined in tag library imported with
  prefix html
  even though I have
  %@ taglib prefix=html tagdir=/WEB-INF/tags %

 I can't imagine that mixing S1 tags into an S2 app
 would work particularly well. Perhaps extrapolating
 from the response as using the enctype in the S2 form
 tag would be a better idea.

 d.

Ah... would you mind repeating that in more words?

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



Re: MultiPartRequest bean for File Upload missing?

2007-08-10 Thread yitzle
Solved. Found it here:
http://www.jroller.com/yokeping/entry/file_upload_with_struts_2

I had to add two libraries:
commons-fileupload-1.2.jar and commons-io-1.3.jar

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



Re: struts1 or struts 2?

2007-08-10 Thread Frank W. Zammetti

Asthana, Rahul wrote:

By the way, have any of you done any performance metrics on an ajax based 
implementation vs a non ajax based one?


Early on we did a proof-of-concept that did exactly this... what we 
found was that the AJAX version was universally perceived as being 
faster, even when a few cases actually weren't (i.e., client-side 
processing took longer than the equivalent server-side version).


The conclusions we drew were:

1. You have to strive to minimize the amount of Javascript executing as 
a result of each AJAX call.  There is a line that when crossed means the 
server can actually render the whole page fresh and the browser can 
display it faster than AJAX+Javascript updates.


2. There is a balance you need to strike between the number of AJAX 
calls and size of each AJAX response... there is again a line that when 
crossed means that X number of small AJAX requests takes more time than 
one non-AJAX transaction.


3. There is definitely tuning that needs to be done in terms of moving 
static resources off to the web server, making sure your AJAX responses 
are tight, things like that.  The very biggest impact we found, recently 
actually, was in moving all images, CSS, Javascript and other static 
content off to the web server... especially when your doing AJAX and 
your making numerous small requests vs. one or two larger non-AJAX 
requests, not having to hit the web server makes a huge difference... 
remember that in most cases, there is a small number of connections 
available between the web server and app server (we had 5 I believe) 
even though you may have 100 connections/threads available on the web 
server (and probably app server).  That's where we found the most 
significant bottleneck... we're talking making an app twice as fast just 
by moving static content off the app server!


4. Aside from the static content thing, this is the biggest point to 
emphasize: you need to get your developers thinking a different way then 
they probably are used to... they need to, for lack of a better way to 
put it, trust the client more.  For instance, we had developers that 
insisted on putting objects in session, even though myself and other 
senior developers were telling them it'd be better to keep things in 
Javascript objects client-side... they would tell you now we were 100% 
right :)  This isn't a criticism of them though, when your used to doing 
things a certain way, and they basically work well, you don't want to 
change, especially given what many people have historically thought 
about Javascript and client-side development.  But once you get the 
mindset changing, you'll see a really huge improvement in performance of 
your apps because the fundamental design leads to better performance 
naturally.



rgds
Rahul


Frank

--
--
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
AIM/Yahoo: fzammetti
MSN: [EMAIL PROTECTED]
Author of Practical Ajax Projects With Java Technology
 (2006, Apress, ISBN 1-59059-695-1)
and JavaScript, DOM Scripting and Ajax Projects
 (2007, Apress, ISBN 1-59059-816-4)
Java Web Parts - http://javawebparts.sourceforge.net
 Supplying the wheel, so you don't have to reinvent it!

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



struts2.0.8 javax.servlet.Filter implementation problem

2007-08-10 Thread Eugen Stoianovici
i'm trying to use a custom filter to implement authorization and i can't 
get the damned thing to work (i'm an absolute beginner, be warned).

i'm using struts2.0.8 with tomcat 5.5

my doFilter method looks like this
public class AuthorizationFilter implements Filter {
public void doFilter(ServletRequest request, ServletResponse response,
   FilterChain chain) throws IOException, ServletException {

   HttpServletRequest req = (HttpServletRequest) request;
   HttpServletResponse res = (HttpServletResponse) response;

   HttpSession session = req.getSession();
   Employee employee = (Employee) session.getAttribute(user);
   boolean hasRole = false;
  
   if(employee!=null){

   for (int i = 0; i  roleNames.length; i++) {
   if (employee.hasRole(roleNames[i])) {
   hasRole = true;
   break;
   }
   }
   }
   if (hasRole) {
   chain.doFilter(request, response);
   } else {
   req.getRequestDispatcher(onErrorUrl).forward(req, res);
   }
}
}

the browser reports: (line 47 is
req.getRequestDispatcher(onErrorUrl).forward(req, res); )


*type* Exception report

*message*

*description* _The server encountered an internal error () that 
prevented it from fulfilling this request._


*exception*

org.apache.jasper.JasperException

org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:476)

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:389)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:315)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
security.AuthorizationFilter.doFilter(AuthorizationFilter.java:47)

*root cause*

java.lang.NullPointerException
org.apache.struts2.views.jsp.TagUtils.getStack(TagUtils.java:58)

org.apache.struts2.views.jsp.StrutsBodyTagSupport.getStack(StrutsBodyTagSupport.java:52)

org.apache.struts2.views.jsp.ComponentTagSupport.doStartTag(ComponentTagSupport.java:49)
org.apache.jsp.index_jsp._jspx_meth_s_005furl_005f0(index_jsp.java:102)
org.apache.jsp.index_jsp._jspService(index_jsp.java:62)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:328)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:315)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
security.AuthorizationFilter.doFilter(AuthorizationFilter.java:47)

*
*__



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



Re: Dynamic Tree Example

2007-08-10 Thread Musachy Barroso
Yes the example had several problems on 2.0.x, some of them were
fixed, others are still there.

musachy

On 8/10/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 I'm studying the dynamic tree example in the showcase, and there are a
 couple problems.  First, when you view sources, the configuration for the
 dynamicTreeSelectAction is not visible.  Also, as I inspect this action, I'm
 discovering that its dynamicTreeSelect.jsp never displays the node
 selected!  Is this example not finished?

 --
 Scott
 [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: iterator tag

2007-08-10 Thread Wesley Wannemacher
First off, do you have a 'public List getFiles()' in your action? The iterator 
tag looks for a getter that returns an object implementing java.util.List. For 
troubleshooting, I would put something static in your iterator tag just to see 
if the loop even starts (of course, sans getFiles(), you will see nothing).

-Wes 

-Original Message-
From: Marcos Mendonça [mailto:[EMAIL PROTECTED] 
Sent: Thursday, August 09, 2007 5:03 PM
To: user@struts.apache.org
Subject: s:iterator tag

Hello

I'm going crazy trying to use the s:iterator tag.

I have an action that generates an ArrayList of the files in a given directory.

In my JSP I'd like to show this files as a list.

Here's my action's code:

File dir = new File(props.getProperty(files.saveDir));

FileFilter fileFilter = new FileFilter() { public boolean accept(File file) {
return file.getName().endsWith(.gpx); } };

File[] f = dir.listFiles(fileFilter);

ArrayListFile files = new ArrayList(Arrays.asList(f));

return SUCCESS;

And the JSP code:

s:iterator value=files
s:property /
/s:iterator


But it show absolutely nothing
I tried using s:property value=name/ instead, but it doesn't work either. I 
also trying using JSTL's c:forEach with no success either.

I'm going desperate here, it should be so simple, yet nothing I tried works. 
Please, give me a hand.

Much appreciated.

Thanks

-
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: [OT] Question about performance with last array

2007-08-10 Thread Dave Newton
--- Ashish Kulkarni wrote:
 i have to find the shortest distance to travel, but
 this is not as simple as travel sales man problem 
 because A-B is not as same as B-C

That *is* the traveling salesman problem.

There are many homework and algorithm sites that can
help you, and googling for various Java performance
search terms should give you much more information
than you'll want.

d.



  

Fussy? Opinionated? Impossible to please? Perfect.  Join Yahoo!'s user panel 
and lay it on us. http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7 


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



Re: S2 : Validation per Action method - ideas?

2007-08-10 Thread Veronica Iturrioz
You must to set the property validateAnnotatedMethodOnly=true, and the 
validation occurs only for the correct methods.

interceptor-ref name=validation
param name=validateAnnotatedMethodOnlytrue/param
param name=excludeMethodsinput,back,cancel,browse/param
/interceptor-ref

but this is ok for server validation, not for client validation.
Anybody know how to resolve that for client validations?


Veronica.

- Original Message 
From: beto [EMAIL PROTECTED]
To: user@struts.apache.org
Sent: Friday, August 10, 2007 8:54:02 AM
Subject: RE: S2 : Validation per Action method - ideas?


I tried removing annotations from the execute method, and the field confirm
is still getting validated. It seems like any validation annotation added in
my action causes validation of the defined fields whenever a method not
defined in the validation interceptor configuration (methods excluded from
validation) is called. 

Could it be that I'm trying to do something that is not supported? I'll have
another go on google. Found this post in this list, so it looks like I'm not
alone:

http://www.nabble.com/S2-%3A-XML-vs-annotation-validation---thoughts--tf4229633.html#a12032762
post 


Arno wrote:
 
 Well, looking at my code using Validations on methods, I noticed that I
 used
 it only on one method and used @SkipValidation on my other action methods
 (which worked). So I did not try the multi validations scenario.
 
 Just to test, let the validations annotation on only one method and check
 what happens.
 
 -Message d'origine-
 De : beto [mailto:[EMAIL PROTECTED] 
 Envoyé : vendredi 10 août 2007 13:21
 À : user@struts.apache.org
 Objet : RE: S2 : Validation per Action method - ideas?
 
 
 Yes, I removed the annotations from the setters. I might be overlooking
 something, but I'm not sure where to start looking at this moment. Is
 there
 any more details I could provide to help you see the clear picture?
 
 
 Arno wrote:
 
 Pretty strange indeed. Did you remove all the validation annotations on
 the
 field setters?
 
 -Message d'origine-
 De : beto [mailto:[EMAIL PROTECTED] 
 Envoyé : vendredi 10 août 2007 11:56
 À : user@struts.apache.org
 Objet : RE: S2 : Validation per Action method - ideas?
 
 
 Hi again, and thank you for your answer.
 
 I've tried using @Validations at the method level as you point out. I'll
 try
 to illustrate:
 
 I have an action, not annotated with @Validation, with three action
 methods;
 input, execute and confirm (custom action method).
 
 The input method has no annotations and is not validated as expected.
 
 The execute method is annotated with @Validations:
 
 @Validations(requiredStrings={
 @RequiredStringValidator(fieldName=amount,
 message=Amount is required, key=amount.required) }, regexFields={
 @RegexFieldValidator(fieldName=amount, expression=^\\d+$,
 message=Amount has to be numeric, key=amount.numeric) })
 public String execute() throws Exception {
   ...
 }
 
 The confirm method is also annotated with @Validations:
 
 @Validations(expressions={ @ExpressionValidator(expression=confirm ==
 true, message=test) })
 public String confirm() throws Exception {
   ...
 }
 
 And here comes the confusing part. When I call my action with no method
 name
 indicator (say MyAction, not MyAction_confirm), both fields (amount and
 confirm) is validated. I just want to validate amount when execute is
 called and only the field confirm when the confirm method is called.
 
 What am I doing wrong?
 
 beto
 
 
 Arno wrote:
 
 This is the Validations (with a 's' at the end :-) ) that can be put on
 a
 method. The syntax is pretty confusing but the functionality quite neat.
 


 http://struts.apache.org/2.x/struts2-core/apidocs/com/opensymphony/xwork2/va
 lidator/annotations/Validations.html
 
 -Message d'origine-
 De : beto [mailto:[EMAIL PROTECTED] 
 Envoyé : vendredi 10 août 2007 10:57
 À : user@struts.apache.org
 Objet : RE: S2 : Validation per Action method - ideas?
 
 
 Hi.
 
 I've tried using validation annotation (which works great) and ran into
 the
 scenario mentioned by Joseph. I have different action methods which
 requires
 different set of validation rules. I can not find out how to set up
 validation annotation to differentiate the validation rules based on
 which
 action method that is called. I do not wish to use validation xml-files
 if
 I
 can avoid it, and will probably end up creating separate action classes
 in
 these scenarios if not anybody can point out a solution to this problem.
 
 Am I missing something?
 
 Do you have the solution Arno? :-) 
 
 
 Arno wrote:
 
 You should check the Javadoc of the
 com.opensymphony.xwork2.validator.annotations.Validation annotation.
 
 Syntax example:
 
 @Validations(
  requiredFields =
  [EMAIL PROTECTED](type =
 ValidatorType.SIMPLE,
 fieldName = customfield, message = You must enter a value for
 field.)},
  requiredStrings =
  [EMAIL 

Re: [OT] Question about performance with last array

2007-08-10 Thread Ashish Kulkarni
Hi
This is what i have to do,
suppose have 3 points A-B-C then
i have to find the shortest distance to travel, but this is not as simple as
travel sales man problem because
A-B is not as same as B-C
So suppose i have
A-B is 2
A-C is 1
B-A is 3
B-C is 2
C-A is 4
C-B is 3
then i have find what is the best of A-B-C or A-C-B or some thing else,
any ideas?



On 8/10/07, Antonio Petrelli [EMAIL PROTECTED] wrote:

 2007/8/10, Ashish Kulkarni [EMAIL PROTECTED]:
  Hi
  I have a program which creates permutations for 10 letters, so the
 values i
  get is 10 ^10 which is more then 3 million

 Do you mean permutations (the same letters ordered in different ways)
 or dispositions with repetition (the 10-letter group can be taken from
 the 26 letters of the alphabet, can be repeated and can stay in any
 order)?
 Permutations: 10! possibilities
 Dispositions with repetition: 26^10

  Now i have to go through all 3 million records and do some calculations
 to
  determine the best possible combination .
 
  Any ideas what i should use, LinkedList, ArrayList, HashMap,
  what would be the best way performance wise
 
  should i use primitive or objects for calculations.
  Any suggestions on approaching this problem.

 IMHO it's better not to do it! :-) AFAICT, either way you are using
 permutations or dispositions with repetition, it is a O(e^n) problem,
 i.e. exponential complexity.
 I think that you need to change the problem, or solve it in another
 way, to go down to polynomial complexity.
 The answer, then, is that the complexity does not depend on the
 array-like structure you are using.

 Just my 0.02 euros.
 Antonio

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




[S2] JSP load time

2007-08-10 Thread shuruga

Hello

I have a question about the time a JSP takes to load.  I am converting a
struts1+tiles1 application to struts2 (2.0.9) + tiles2 (2.0.4) on weblogic
10 and I have noticed that the first time a jsp using S2+T2 is accessed it
is taking a long time to be displayed, after the initial access the page is
displayed almost instantly.  At first I thought it was recompiling the JSP
but looking at weblogic's jsp cache the class file has not been changed. 
The time taken is roughly the same as when the JSP is recompiled.

The page is a view with no form tag but does have a lot of s:if tags and
some s:iterate tags in it.  

Does anyone know why this would be happening and if there is a way to stop
it from occurring?

Thanks  
-- 
View this message in context: 
http://www.nabble.com/-S2--JSP-load-time-tf4248504.html#a12090706
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: There is no Action mapped for action name HelloWorld. - [unknown location]

2007-08-10 Thread GEDA

Thanks a lot for the solution. It seems that many things are still not
standardized and I simply got stuck for an entire day's work in order to
find a solution for this problem. Thanks again.
-- 
View this message in context: 
http://www.nabble.com/There-is-no-Action-mapped-for-action-name-HelloWorld.unknown-location--tf3362312.html#a12090504
Sent from the Struts - User mailing list archive at Nabble.com.


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



[S2] ExecAndWait interceptor : request.getSession() null

2007-08-10 Thread mleneveut

Hi,

I try to add the execAndWait interceptor in my application. But now the
request.getSession() returns null so my app crash in the first Action.

What did I miss ?

interceptor name=login
class=org.myorg.coordination.interceptor.LoginInterceptor /
interceptor-stack name=crmStack
interceptor-ref name=servletConfig/
interceptor-ref name=i18n/
interceptor-ref name=login/
interceptor-ref name=fileUpload/
interceptor-ref name=checkbox/
interceptor-ref name=staticParams/
interceptor-ref name=params
dojo\..*
/interceptor-ref
interceptor-ref name=conversionError/
interceptor-ref name=validation/
interceptor-ref name=workflow/
interceptor-ref name=execAndWait
1000
100
/interceptor-ref
/interceptor-stack
default-interceptor-ref name=crmStack/

global-results
result name=notLogged/jsp/login.jsp/result
result name=functionalError/jsp/error.jsp/result
result name=technicalError/jsp/error.jsp/result
result name=runtimeError/jsp/error.jsp/result
result name=wait/jsp/wait.jsp/result
/global-results

My wait.jsp :
%@ taglib prefix=s uri=/struts-tags %
html
head
title
s:text name=title.webapp.prefix/
s:text name=title.wait/
/title
 meta http-equiv=Cache-Control content=no-store/
 meta http-equiv=Pragma content=no-cache/
 meta http-equiv=Expires content=0/ 
meta http-equiv=refresh content=50;url=s:url includeParams=all
//
link href=css/crm.css rel=stylesheet type=text/css
/head
body
table border=0 cellspacing=0 cellpadding=0 width=100%
tr valign=middle
td align=center
Please wait while we process your request.
Click  s:url includeParams= here  if this page 
does not reload
automatically.
/td
/tr
/table
/body
/html

My Generic Action :
public class CRMAction extends ActionSupport implements ServletRequestAware,
ServletResponseAware {
private HttpServletRequest request;
...
protected final void setSessionAttribute(final String key, final Object 
o)
{
if (o != null) {
request.getSession().setAttribute(key, o);
}
}
...
}

My called Action :
public class LoginAction extends CRMAction {
private UserVO user;
private AuthentifyUserServiceInterface authentifyUserService;

/**
 * Method called after the login form's submittion.
 * Authentificates the user or send an error.
 * @return String the forward
 */
public String login() {
try {
user = authentifyUserService.authentifyUser(user);
if (user != null) {
setSessionAttribute(Constants.USER, user);
...
}

My login JSP submit to login_login, so calls the login method of
LoginAction. The wait.jsp is displayed, but I have a NullPointerExceptoin
when setting the user in session.
-- 
View this message in context: 
http://www.nabble.com/-S2--ExecAndWait-interceptor-%3A-request.getSession%28%29-null-tf4248436.html#a12090487
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: S2 : Validation per Action method - ideas?

2007-08-10 Thread beto

I tried removing annotations from the execute method, and the field confirm
is still getting validated. It seems like any validation annotation added in
my action causes validation of the defined fields whenever a method not
defined in the validation interceptor configuration (methods excluded from
validation) is called. 

Could it be that I'm trying to do something that is not supported? I'll have
another go on google. Found this post in this list, so it looks like I'm not
alone:

http://www.nabble.com/S2-%3A-XML-vs-annotation-validation---thoughts--tf4229633.html#a12032762
post 


Arno wrote:
 
 Well, looking at my code using Validations on methods, I noticed that I
 used
 it only on one method and used @SkipValidation on my other action methods
 (which worked). So I did not try the multi validations scenario.
 
 Just to test, let the validations annotation on only one method and check
 what happens.
 
 -Message d'origine-
 De : beto [mailto:[EMAIL PROTECTED] 
 Envoyé : vendredi 10 août 2007 13:21
 À : user@struts.apache.org
 Objet : RE: S2 : Validation per Action method - ideas?
 
 
 Yes, I removed the annotations from the setters. I might be overlooking
 something, but I'm not sure where to start looking at this moment. Is
 there
 any more details I could provide to help you see the clear picture?
 
 
 Arno wrote:
 
 Pretty strange indeed. Did you remove all the validation annotations on
 the
 field setters?
 
 -Message d'origine-
 De : beto [mailto:[EMAIL PROTECTED] 
 Envoyé : vendredi 10 août 2007 11:56
 À : user@struts.apache.org
 Objet : RE: S2 : Validation per Action method - ideas?
 
 
 Hi again, and thank you for your answer.
 
 I've tried using @Validations at the method level as you point out. I'll
 try
 to illustrate:
 
 I have an action, not annotated with @Validation, with three action
 methods;
 input, execute and confirm (custom action method).
 
 The input method has no annotations and is not validated as expected.
 
 The execute method is annotated with @Validations:
 
 @Validations(requiredStrings={
 @RequiredStringValidator(fieldName=amount,
 message=Amount is required, key=amount.required) }, regexFields={
 @RegexFieldValidator(fieldName=amount, expression=^\\d+$,
 message=Amount has to be numeric, key=amount.numeric) })
 public String execute() throws Exception {
   ...
 }
 
 The confirm method is also annotated with @Validations:
 
 @Validations(expressions={ @ExpressionValidator(expression=confirm ==
 true, message=test) })
 public String confirm() throws Exception {
   ...
 }
 
 And here comes the confusing part. When I call my action with no method
 name
 indicator (say MyAction, not MyAction_confirm), both fields (amount and
 confirm) is validated. I just want to validate amount when execute is
 called and only the field confirm when the confirm method is called.
 
 What am I doing wrong?
 
 beto
 
 
 Arno wrote:
 
 This is the Validations (with a 's' at the end :-) ) that can be put on
 a
 method. The syntax is pretty confusing but the functionality quite neat.
 


 http://struts.apache.org/2.x/struts2-core/apidocs/com/opensymphony/xwork2/va
 lidator/annotations/Validations.html
 
 -Message d'origine-
 De : beto [mailto:[EMAIL PROTECTED] 
 Envoyé : vendredi 10 août 2007 10:57
 À : user@struts.apache.org
 Objet : RE: S2 : Validation per Action method - ideas?
 
 
 Hi.
 
 I've tried using validation annotation (which works great) and ran into
 the
 scenario mentioned by Joseph. I have different action methods which
 requires
 different set of validation rules. I can not find out how to set up
 validation annotation to differentiate the validation rules based on
 which
 action method that is called. I do not wish to use validation xml-files
 if
 I
 can avoid it, and will probably end up creating separate action classes
 in
 these scenarios if not anybody can point out a solution to this problem.
 
 Am I missing something?
 
 Do you have the solution Arno? :-) 
 
 
 Arno wrote:
 
 You should check the Javadoc of the
 com.opensymphony.xwork2.validator.annotations.Validation annotation.
 
 Syntax example:
 
 @Validations(
  requiredFields =
  [EMAIL PROTECTED](type =
 ValidatorType.SIMPLE,
 fieldName = customfield, message = You must enter a value for
 field.)},
  requiredStrings =
  [EMAIL PROTECTED](type =
 ValidatorType.SIMPLE,
 fieldName = stringisrequired, message = You must enter a value for
 string.)}
  
  )
  public String execute() throws Exception {
  return SUCCESS;
  }
 
 -Message d'origine-
 De : j alex [mailto:[EMAIL PROTECTED] 
 Envoyé : jeudi 9 août 2007 15:38
 À : Struts Users Mailing List
 Objet : S2 : Validation per Action method - ideas?
 
 Hi,
 
 Is there a way to declaratively restrict validations depending on the
 method
 within the Action? - this could be useful for wizard-like forms where
 each
 step of the wizard has a set of fields ; 

Re: s:iterator tag

2007-08-10 Thread Marcos Mendonça
I managed to make it work by acessing the ArrayList.iterator() method.
That is, I had to create another class member of the type Iterator,
create getters and setters for it, and the use that member in the
.jsp.

On 8/9/07, Marcos Mendonça [EMAIL PROTECTED] wrote:
 Yes, I did. ArrayList has something in it.

 I managed to print it's size and log the file name, the one I'd like
 to print with the JSP.

 On 8/9/07, Dave Newton [EMAIL PROTECTED] wrote:
  --- Marcos Mendonça wrote:
   I have an action that generates an ArrayList of the
   files in a given directory.
 
  Do you know that it's generating a list with any files
  in it (determine via logging for the most complete
  information or put something else in the
  s:iterator.../ loop as a quick sanity check)?
 
  d.
 
 
 
 
  
  Need a vacation? Get great deals
  to amazing places on Yahoo! Travel.
  http://travel.yahoo.com/
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 


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



RE: S2 : Validation per Action method - ideas?

2007-08-10 Thread Arnaud Cogoluegnes
Well, looking at my code using Validations on methods, I noticed that I used
it only on one method and used @SkipValidation on my other action methods
(which worked). So I did not try the multi validations scenario.

Just to test, let the validations annotation on only one method and check
what happens.

-Message d'origine-
De : beto [mailto:[EMAIL PROTECTED] 
Envoyé : vendredi 10 août 2007 13:21
À : user@struts.apache.org
Objet : RE: S2 : Validation per Action method - ideas?


Yes, I removed the annotations from the setters. I might be overlooking
something, but I'm not sure where to start looking at this moment. Is there
any more details I could provide to help you see the clear picture?


Arno wrote:
 
 Pretty strange indeed. Did you remove all the validation annotations on
 the
 field setters?
 
 -Message d'origine-
 De : beto [mailto:[EMAIL PROTECTED] 
 Envoyé : vendredi 10 août 2007 11:56
 À : user@struts.apache.org
 Objet : RE: S2 : Validation per Action method - ideas?
 
 
 Hi again, and thank you for your answer.
 
 I've tried using @Validations at the method level as you point out. I'll
 try
 to illustrate:
 
 I have an action, not annotated with @Validation, with three action
 methods;
 input, execute and confirm (custom action method).
 
 The input method has no annotations and is not validated as expected.
 
 The execute method is annotated with @Validations:
 
 @Validations(requiredStrings={
 @RequiredStringValidator(fieldName=amount,
 message=Amount is required, key=amount.required) }, regexFields={
 @RegexFieldValidator(fieldName=amount, expression=^\\d+$,
 message=Amount has to be numeric, key=amount.numeric) })
 public String execute() throws Exception {
   ...
 }
 
 The confirm method is also annotated with @Validations:
 
 @Validations(expressions={ @ExpressionValidator(expression=confirm ==
 true, message=test) })
 public String confirm() throws Exception {
   ...
 }
 
 And here comes the confusing part. When I call my action with no method
 name
 indicator (say MyAction, not MyAction_confirm), both fields (amount and
 confirm) is validated. I just want to validate amount when execute is
 called and only the field confirm when the confirm method is called.
 
 What am I doing wrong?
 
 beto
 
 
 Arno wrote:
 
 This is the Validations (with a 's' at the end :-) ) that can be put on a
 method. The syntax is pretty confusing but the functionality quite neat.
 


http://struts.apache.org/2.x/struts2-core/apidocs/com/opensymphony/xwork2/va
 lidator/annotations/Validations.html
 
 -Message d'origine-
 De : beto [mailto:[EMAIL PROTECTED] 
 Envoyé : vendredi 10 août 2007 10:57
 À : user@struts.apache.org
 Objet : RE: S2 : Validation per Action method - ideas?
 
 
 Hi.
 
 I've tried using validation annotation (which works great) and ran into
 the
 scenario mentioned by Joseph. I have different action methods which
 requires
 different set of validation rules. I can not find out how to set up
 validation annotation to differentiate the validation rules based on
 which
 action method that is called. I do not wish to use validation xml-files
 if
 I
 can avoid it, and will probably end up creating separate action classes
 in
 these scenarios if not anybody can point out a solution to this problem.
 
 Am I missing something?
 
 Do you have the solution Arno? :-) 
 
 
 Arno wrote:
 
 You should check the Javadoc of the
 com.opensymphony.xwork2.validator.annotations.Validation annotation.
 
 Syntax example:
 
 @Validations(
  requiredFields =
  [EMAIL PROTECTED](type =
 ValidatorType.SIMPLE,
 fieldName = customfield, message = You must enter a value for
 field.)},
  requiredStrings =
  [EMAIL PROTECTED](type =
 ValidatorType.SIMPLE,
 fieldName = stringisrequired, message = You must enter a value for
 string.)}
  
  )
  public String execute() throws Exception {
  return SUCCESS;
  }
 
 -Message d'origine-
 De : j alex [mailto:[EMAIL PROTECTED] 
 Envoyé : jeudi 9 août 2007 15:38
 À : Struts Users Mailing List
 Objet : S2 : Validation per Action method - ideas?
 
 Hi,
 
 Is there a way to declaratively restrict validations depending on the
 method
 within the Action? - this could be useful for wizard-like forms where
 each
 step of the wizard has a set of fields ; corresponds to a different
 method
 but all of them share the same Action.
 
 I can think of having an expression validator based on currentstep added
 to
 every field short-circuited ; but that's more of a workaround rather
 than
 the right way to do it.
 
 Thanks,
 Joseph
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 
 -- 
 View this message in context:


http://www.nabble.com/S2-%3A-Validation-per-Action-method---ideas--tf4242670
 .html#a12087696
 Sent from the Struts - User mailing list 

RE: S2 : Validation per Action method - ideas?

2007-08-10 Thread Arnaud Cogoluegnes
Pretty strange indeed. Did you remove all the validation annotations on the
field setters?

-Message d'origine-
De : beto [mailto:[EMAIL PROTECTED] 
Envoyé : vendredi 10 août 2007 11:56
À : user@struts.apache.org
Objet : RE: S2 : Validation per Action method - ideas?


Hi again, and thank you for your answer.

I've tried using @Validations at the method level as you point out. I'll try
to illustrate:

I have an action, not annotated with @Validation, with three action methods;
input, execute and confirm (custom action method).

The input method has no annotations and is not validated as expected.

The execute method is annotated with @Validations:

@Validations(requiredStrings={  @RequiredStringValidator(fieldName=amount,
message=Amount is required, key=amount.required) }, regexFields={
@RegexFieldValidator(fieldName=amount, expression=^\\d+$,
message=Amount has to be numeric, key=amount.numeric) })
public String execute() throws Exception {
  ...
}

The confirm method is also annotated with @Validations:

@Validations(expressions={ @ExpressionValidator(expression=confirm ==
true, message=test) })
public String confirm() throws Exception {
  ...
}

And here comes the confusing part. When I call my action with no method name
indicator (say MyAction, not MyAction_confirm), both fields (amount and
confirm) is validated. I just want to validate amount when execute is
called and only the field confirm when the confirm method is called.

What am I doing wrong?

beto


Arno wrote:
 
 This is the Validations (with a 's' at the end :-) ) that can be put on a
 method. The syntax is pretty confusing but the functionality quite neat.
 

http://struts.apache.org/2.x/struts2-core/apidocs/com/opensymphony/xwork2/va
 lidator/annotations/Validations.html
 
 -Message d'origine-
 De : beto [mailto:[EMAIL PROTECTED] 
 Envoyé : vendredi 10 août 2007 10:57
 À : user@struts.apache.org
 Objet : RE: S2 : Validation per Action method - ideas?
 
 
 Hi.
 
 I've tried using validation annotation (which works great) and ran into
 the
 scenario mentioned by Joseph. I have different action methods which
 requires
 different set of validation rules. I can not find out how to set up
 validation annotation to differentiate the validation rules based on which
 action method that is called. I do not wish to use validation xml-files if
 I
 can avoid it, and will probably end up creating separate action classes in
 these scenarios if not anybody can point out a solution to this problem.
 
 Am I missing something?
 
 Do you have the solution Arno? :-) 
 
 
 Arno wrote:
 
 You should check the Javadoc of the
 com.opensymphony.xwork2.validator.annotations.Validation annotation.
 
 Syntax example:
 
 @Validations(
  requiredFields =
  [EMAIL PROTECTED](type =
 ValidatorType.SIMPLE,
 fieldName = customfield, message = You must enter a value for
 field.)},
  requiredStrings =
  [EMAIL PROTECTED](type =
 ValidatorType.SIMPLE,
 fieldName = stringisrequired, message = You must enter a value for
 string.)}
  
  )
  public String execute() throws Exception {
  return SUCCESS;
  }
 
 -Message d'origine-
 De : j alex [mailto:[EMAIL PROTECTED] 
 Envoyé : jeudi 9 août 2007 15:38
 À : Struts Users Mailing List
 Objet : S2 : Validation per Action method - ideas?
 
 Hi,
 
 Is there a way to declaratively restrict validations depending on the
 method
 within the Action? - this could be useful for wizard-like forms where
 each
 step of the wizard has a set of fields ; corresponds to a different
 method
 but all of them share the same Action.
 
 I can think of having an expression validator based on currentstep added
 to
 every field short-circuited ; but that's more of a workaround rather than
 the right way to do it.
 
 Thanks,
 Joseph
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 
 -- 
 View this message in context:

http://www.nabble.com/S2-%3A-Validation-per-Action-method---ideas--tf4242670
 .html#a12087696
 Sent from the Struts - User mailing list archive at Nabble.com.
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context:
http://www.nabble.com/S2-%3A-Validation-per-Action-method---ideas--tf4242670
.html#a12088476
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: Struts Url Validator

2007-08-10 Thread Jasper Floor
 /**
 * This expression derived/taken from the BNF for URI (RFC2396).
 */
private static final String URL_PATTERN =
/^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?/;

the above regexp is what the validator seems to use to validate urls.
For more information download the source from the apache commons
project. btw, I am not so good at reading regexp to tell what the
answer to your question is ot if this even answers your question. good
luck ;)

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



RE: S2 : Validation per Action method - ideas?

2007-08-10 Thread beto

Hi.

I've tried using validation annotation (which works great) and ran into the
scenario mentioned by Joseph. I have different action methods which requires
different set of validation rules. I can not find out how to set up
validation annotation to differentiate the validation rules based on which
action method that is called. I do not wish to use validation xml-files if I
can avoid it, and will probably end up creating separate action classes in
these scenarios if not anybody can point out a solution to this problem.

Am I missing something?

Do you have the solution Arno? :-) 


Arno wrote:
 
 You should check the Javadoc of the
 com.opensymphony.xwork2.validator.annotations.Validation annotation.
 
 Syntax example:
 
 @Validations(
  requiredFields =
  [EMAIL PROTECTED](type = ValidatorType.SIMPLE,
 fieldName = customfield, message = You must enter a value for
 field.)},
  requiredStrings =
  [EMAIL PROTECTED](type =
 ValidatorType.SIMPLE,
 fieldName = stringisrequired, message = You must enter a value for
 string.)}
  
  )
  public String execute() throws Exception {
  return SUCCESS;
  }
 
 -Message d'origine-
 De : j alex [mailto:[EMAIL PROTECTED] 
 Envoyé : jeudi 9 août 2007 15:38
 À : Struts Users Mailing List
 Objet : S2 : Validation per Action method - ideas?
 
 Hi,
 
 Is there a way to declaratively restrict validations depending on the
 method
 within the Action? - this could be useful for wizard-like forms where each
 step of the wizard has a set of fields ; corresponds to a different method
 but all of them share the same Action.
 
 I can think of having an expression validator based on currentstep added
 to
 every field short-circuited ; but that's more of a workaround rather than
 the right way to do it.
 
 Thanks,
 Joseph
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/S2-%3A-Validation-per-Action-method---ideas--tf4242670.html#a12087696
Sent from the Struts - User mailing list archive at Nabble.com.


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



A non-javascript link that acts as if a form was submitted

2007-08-10 Thread struts
Hi all,

This question might be a faq, but I haven't seen any answer when searching on
google or in the mailing list archive.

I'm working with a website that uses a java-based CMS (Content Management
System) that has some struts-based functionality. One of the functions we have
is to let the user activate his web account by clicking a link sent by a
plain-text email.

We need this link to do the same thing as a submit button does when submitting a
struts form (account activation using this form works perfectly).

How can I do this?
Also, the success url needs to be dynamically generated, so it is not included
in struts-config.xml.

Also, I cannot (without *too* much extra work) rewrite the action of form
classes (the developers of the CMS has adviced us not to, and when looking at
the source code I notice they use some private and package private methods and
inner classes).

Currently, I have only been able to do this by making the link point to the form
jsp page, putting the parameters userName and activationCode in the html:text
fields, and then submitting the form using javascript after the page is loaded.
But this looks strange for the user (one page opens, then he is redirected to
another page) and takes time.

Can someone help me with this?

Regards
/Jimi

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



[OT] Re: A non-javascript link that acts as if a form was submitted

2007-08-10 Thread Antonio Petrelli
2007/8/10, [EMAIL PROTECTED] [EMAIL PROTECTED]:

 We need this link to do the same thing as a submit button does when
 submitting a
 struts form (account activation using this form works perfectly).



a href=blahblah onclick=yourform.submit() /

Antonio


RE: S2 : Validation per Action method - ideas?

2007-08-10 Thread Arnaud Cogoluegnes
This is the Validations (with a 's' at the end :-) ) that can be put on a
method. The syntax is pretty confusing but the functionality quite neat.

http://struts.apache.org/2.x/struts2-core/apidocs/com/opensymphony/xwork2/va
lidator/annotations/Validations.html

-Message d'origine-
De : beto [mailto:[EMAIL PROTECTED] 
Envoyé : vendredi 10 août 2007 10:57
À : user@struts.apache.org
Objet : RE: S2 : Validation per Action method - ideas?


Hi.

I've tried using validation annotation (which works great) and ran into the
scenario mentioned by Joseph. I have different action methods which requires
different set of validation rules. I can not find out how to set up
validation annotation to differentiate the validation rules based on which
action method that is called. I do not wish to use validation xml-files if I
can avoid it, and will probably end up creating separate action classes in
these scenarios if not anybody can point out a solution to this problem.

Am I missing something?

Do you have the solution Arno? :-) 


Arno wrote:
 
 You should check the Javadoc of the
 com.opensymphony.xwork2.validator.annotations.Validation annotation.
 
 Syntax example:
 
 @Validations(
  requiredFields =
  [EMAIL PROTECTED](type = ValidatorType.SIMPLE,
 fieldName = customfield, message = You must enter a value for
 field.)},
  requiredStrings =
  [EMAIL PROTECTED](type =
 ValidatorType.SIMPLE,
 fieldName = stringisrequired, message = You must enter a value for
 string.)}
  
  )
  public String execute() throws Exception {
  return SUCCESS;
  }
 
 -Message d'origine-
 De : j alex [mailto:[EMAIL PROTECTED] 
 Envoyé : jeudi 9 août 2007 15:38
 À : Struts Users Mailing List
 Objet : S2 : Validation per Action method - ideas?
 
 Hi,
 
 Is there a way to declaratively restrict validations depending on the
 method
 within the Action? - this could be useful for wizard-like forms where each
 step of the wizard has a set of fields ; corresponds to a different method
 but all of them share the same Action.
 
 I can think of having an expression validator based on currentstep added
 to
 every field short-circuited ; but that's more of a workaround rather than
 the right way to do it.
 
 Thanks,
 Joseph
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context:
http://www.nabble.com/S2-%3A-Validation-per-Action-method---ideas--tf4242670
.html#a12087696
Sent from the Struts - User mailing list archive at Nabble.com.


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





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



Struts2 Validation formating error messages

2007-08-10 Thread WiltOnTilt

Hi, I've searched around here and googling to try to find a good answer but I
haven't found one.

I'm using the basic struts2 validation with the validate=true on my
s:form so the validation is done client side.

I'd like to change the error messages so they do not show up ABOVE my
controls.  (I dont know about you guys but wow that's so annoying... default
should have been right or left of the control)...

I'd like to get the error messages to show up to the right of my control and
I'd like those messages to be in red.  Alternatively, I wouldn't mind having
all the errors listed at the top of the page with red *'s next to each
field.  Either is fine.

Do I need to create my own version of s:textfield to make this happen?  Or
a new theme perhaps?  If so do you know of any good resources for this?

I've tried using the s:actionerror / tag but nothing ever renders from it?

Thanks!
Aaron
-- 
View this message in context: 
http://www.nabble.com/Struts2-Validation-formating-error-messages-tf4250977.html#a12098699
Sent from the Struts - User mailing list archive at Nabble.com.


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



Conditional + visitor validation - for nested objects.

2007-08-10 Thread j alex
Hi All,

This is somewhat related to Matt's post on conditional validation at
http://www.nabble.com/Re:-Conditional-validation-p11990883.html ; i dont
have the original email on struts-user (joined the group only last week!) to
reply to :

I need some help regarding the extent to which we can apply visitor field
validation. Say, my domain object (Address - with attributes addrline1,
addrline2, ZIP etc.) is buried deep in a hierarchy - ie app.user1.address ;
and we define only app in the Action. Can we declare a visitor validation
on app and define the  rules on Address-validation.xml ? .

My requirement is that we could use address in different objects ; like
app.user1.address ; app.user2.address - and the error message needs to
be customized
depending on user1, user2 etc . It'll be elegant if the validation rules are
defined just once for Address. Right now, the only way i know to achieve is
to define ALL fields in the action- validation.xml and hardcode the
message for each situation ; which i think is an overkill.

Please let me know if you've any suggestions/ideas.

Thanks,
Joseph


S1-1.3.8 Validation using 'validwhen' for radio button

2007-08-10 Thread Vivek Chauhan

Hi,

I am trying to do a conditional validation using 'validwhen'.
There is group of two radio buttons (values 'Yes' and 'No') and on selecting
any one of them either a drop down box is displayed or a text box is
displayed.

I want to validate the text box or drop down box based on which radio button
is selected

I have added the following entry in validation.xml:
form name=productForm
field property=someStatus depends=required
!-- This is the radio button with two options Yes and No --
arg key=label.status / 
/field

field property=statusText depends=validwhen
arg position=0 key=label.text.value /
var
var-nametest/var-name
var-value
((someStatus != 'Yes') or (*this* != 
null))
/var-value
/var
/field
/form

The javascript validation is not generated for this case.

Similar questions remain unanswered on this mailing list

Thanks
-- 
View this message in context: 
http://www.nabble.com/S1-1.3.8-Validation-using-%27validwhen%27-for-radio-button-tf4248440.html#a12090493
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: Doubled requests in TabbedPane

2007-08-10 Thread Sebastian Kolbe
Hi

I'm using already 2.0.9. 
Is there a config option for this or something similar?
For me it looks like the 'remote'-div is fetching it's content on
before  *and* load topic publishing.

An other problem for me is that most browsers are rendering
very, very slow into such a 'div'. A page with tables that normally
(normal struts-action rendering into a browser window) takes less
than 1 second needs here almost 20 - 30 seconds.  It looks like the
javascript in browser is doing some sort of postprocessing on the
content?

Thanks,
Sebastian

Marco Carnevale schrieb:
 I had the same problem when I was using 2.0.6.  Upgrading to 2.0.8 \
 2.0.9resolved the issue.

 On 8/9/07, Sebastian Kolbe [EMAIL PROTECTED] wrote:
   
 Hello

 Hope someone can help me with this:
 I have a TabbedPane with some tabs in it, each calling an url for
 their content.
 Now I have several problems:
 - I noticed that the selected tab calls the url two times before
 displaying.
 - I reload a specific tab by publishing a dojo-topic. In this
 situation the div calls the
 url two times.

 Since especially some older browser need a lot of time to display the
 tabs content
 I need to correct this.
 Is there a way to circumvent this behaviour? Maybe I did anything wrong?

 Another question:
 Is there an easy way to catch the event (something like 'onclick') when
 a different tab is selected?

 Here is my code for reference:
 s:tabbedPanel id=resultTabPanel
 selectedTab=resultPanelTab_%{maxTabId}
s:url id=infoActionUrl
 action=SearchAction_fetchResultTable/s:url

s:div id=resultPanelTab_1 cssClass=panelTab
 label=tab1 theme=ajax labelposition=top
 href=%{infoActionUrl}
 errorText=Loading error on tab1
 refreshOnShow=false listenTopics=searchTab_0_Topic
 loadingText=Loading...
 showLoadingText=false autoStart=false executeScripts=true
div id=indicator1 align=center style=display:block;
   img  src=../pics/spinning_wheel_throbber.gif width=64
 height=64 alt=Loading...border=0 title=Loading.../
  /div
/s:div
 /s:tabbelPanel


 Thanks,
 Sebastian

 -
 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: Doubled requests in TabbedPane

2007-08-10 Thread Musachy Barroso
try  preload=false on the divs(tabs).

musachy

On 8/10/07, Sebastian Kolbe [EMAIL PROTECTED] wrote:
 Hi

 I'm using already 2.0.9.
 Is there a config option for this or something similar?
 For me it looks like the 'remote'-div is fetching it's content on
 before  *and* load topic publishing.

 An other problem for me is that most browsers are rendering
 very, very slow into such a 'div'. A page with tables that normally
 (normal struts-action rendering into a browser window) takes less
 than 1 second needs here almost 20 - 30 seconds.  It looks like the
 javascript in browser is doing some sort of postprocessing on the
 content?

 Thanks,
 Sebastian

 Marco Carnevale schrieb:
  I had the same problem when I was using 2.0.6.  Upgrading to 2.0.8 \
  2.0.9resolved the issue.
 
  On 8/9/07, Sebastian Kolbe [EMAIL PROTECTED] wrote:
 
  Hello
 
  Hope someone can help me with this:
  I have a TabbedPane with some tabs in it, each calling an url for
  their content.
  Now I have several problems:
  - I noticed that the selected tab calls the url two times before
  displaying.
  - I reload a specific tab by publishing a dojo-topic. In this
  situation the div calls the
  url two times.
 
  Since especially some older browser need a lot of time to display the
  tabs content
  I need to correct this.
  Is there a way to circumvent this behaviour? Maybe I did anything wrong?
 
  Another question:
  Is there an easy way to catch the event (something like 'onclick') when
  a different tab is selected?
 
  Here is my code for reference:
  s:tabbedPanel id=resultTabPanel
  selectedTab=resultPanelTab_%{maxTabId}
 s:url id=infoActionUrl
  action=SearchAction_fetchResultTable/s:url
 
 s:div id=resultPanelTab_1 cssClass=panelTab
  label=tab1 theme=ajax labelposition=top
  href=%{infoActionUrl}
  errorText=Loading error on tab1
  refreshOnShow=false listenTopics=searchTab_0_Topic
  loadingText=Loading...
  showLoadingText=false autoStart=false executeScripts=true
 div id=indicator1 align=center style=display:block;
img  src=../pics/spinning_wheel_throbber.gif width=64
  height=64 alt=Loading...border=0 title=Loading.../
   /div
 /s:div
  /s:tabbelPanel
 
 
  Thanks,
  Sebastian
 
  -
  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]




-- 
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: MultiPartRequest bean for File Upload missing?

2007-08-10 Thread Dave Newton
--- yitzle [EMAIL PROTECTED] wrote:
 On 8/9/07, Dave Newton [EMAIL PROTECTED]
 wrote:
  --- yitzle [EMAIL PROTECTED] wrote:
   I had
   s:form action=CertificateImport method=POST
   enctype=multipart/form-data 
   and tried with
   form action=CertificateImport.action
   method=POST
   enctype=multipart/form-data 
   When I tried
   html:form ...  I got
   No tag form defined in tag library imported
 with
   prefix html
   even though I have
   %@ taglib prefix=html tagdir=/WEB-INF/tags
 %
 
  I can't imagine that mixing S1 tags into an S2 app
  would work particularly well. Perhaps
extrapolating
  from the response as using the enctype in the S2
  form tag would be a better idea.
 Ah... would you mind repeating that in more words?

I personally cannot begin to imagine that the proposed
solution consisting of the intermixing of custom tags
from the Struts 1 web application framework within
your existing Struts 2 application would lead to
anything resembling success. Instead I would consider
taking the audacious step of applying common sense to
the problem and recognize that the original answer to
your question assumed (incorrectly) the existence of a
Struts 1 app thereby misrepresenting a potential
solution to your original question. However, the
general idea of the (again, incorrect) answer is also
applicable to your current application environment,
namely, Struts 2. The application of the spirit of the
original answer may lead you to a potential solution
(although I hasten to add that you did indeed find the
solution regardless of the initially-proposed (albeit
lacking) solution and my verbosity-lacking response
which, apparently, instead of being taken as the
um... don't just read the answer, think about it
reminder as was intended, was instead used as a poor
launchpad for an ill-conceived attempt at poking fun
of what was a fairly concise interpretation of my
feelings at the time.

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: [s2] How do I create a custom date range validator?

2007-08-10 Thread mraible

Changing this:

Integer startNumber = (Integer) getFieldValue(_startFieldName, object);
if(startNumber == null) 
  addFieldError(_startFieldName, Start Year is a required field.);

To this:

Integer startNumber = (Integer) getFieldValue(_startFieldName, object);
if(startNumber == null) {
  setDefaultMessage(Start Year is a required field.);
  addFieldError(_startFieldName, object);
}

Seems to solve the problem. 

However, I did discover something strange. If a NPE is thrown in my
validator, the exception is swallowed. Any ideas on what could be causing
this. There's no information in my logs or shown in my browser (just
Tomcat's default 500 page).

uncaught exception
javax.servlet.ServletException
at
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:515)
at
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:419)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
at o

Thanks,

Matt


mraible wrote:
 
 I have the following validation XML that suites my needs perfectly:
 
   field name=startYear
 field-validator type=required
   messageStart year is required./message
 /field-validator
 field-validator type=int
   1900
   messagePlease enter a date after 1900./message
 /field-validator
 field-validator type=fieldexpression
   startYear gte currentYear
   messageStart year must be less than or equal to the current year
 (${currentYear})./message
 /field-validator
   /field
   field name=endYear
 field-validator type=required
   messageEnd year is required./message
 /field-validator
 field-validator type=int
   1900
   messagePlease enter a date after 1900./message
 /field-validator
 field-validator type=fieldexpression
   endYear lt startYear
   messageEnd Year must be after Start year./message
 /field-validator
   /field
 
 I'd like to turn this into a Java class so I can have the following XML
 instead:
 
   validator type=monthyear
 message/
   /validator
 
 Is this possible? 
 
 I've given it a shot and I'm having some difficulty figuring out how to
 add field errors so they appear in the proper location (next to the
 fields) in my form. Here's the code I have so far. I realize that
 addFieldError() is not supposed to take the error message as its 2nd
 argument, but I think it helps convey what I'm trying to do.
 
 public class MonthYearRangeValidator extends ValidatorSupport
 {
   private String _startFieldName = startYear;
   private String _endFieldName = endYear;
   
   public void validate(Object object)
   throws ValidationException
   {
 Integer startNumber = (Integer) getFieldValue(_startFieldName,
 object);
 if(startNumber == null) 
   addFieldError(_startFieldName, Start Year is a required field.);
 
 Integer endNumber = (Integer) getFieldValue(_endFieldName, object);
 if(endNumber == null) {
   addFieldError(_endFieldName, End Year is a required field.);
 }

 if(!getValidatorContext().getFieldErrors().isEmpty())
   return;
 
 if (startNumber  1900) {
   addFieldError(_startFieldName, Please enter a date after 1900.);
 }
 if (endNumber  1900) {
   addFieldError(_endFieldName, Please enter a date after 1900.);
 }
 
 if(!getValidatorContext().getFieldErrors().isEmpty())
   return;
 
 if (startNumber  Calendar.getInstance().get(Calendar.YEAR)) {
   addFieldError(_startFieldName, Start year must be less than or
 equal to the current year.);
 }
 
 if (endNumber  startNumber) {
   addFieldError(_endFieldName, End Year must be after Start year.);
 }
   }
 
   public void setStartFieldName(String startFieldName)
   {
 _startFieldName = startFieldName;
   }
 
   public void setEndFieldName(String endFieldName)
   {
 _endFieldName = endFieldName;
   }
 
 }
 
 Thanks,
 
 Matt
 

-- 
View this message in context: 
http://www.nabble.com/-s2--How-do-I-create-a-custom-date-range-validator--tf4245411.html#a12099744
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: Doubled requests in TabbedPane

2007-08-10 Thread Sebastian Kolbe
Hm, well...
JSP-Exception ?!  :-(

'preload' is not in DTD, right?
If this attribute is recognized I could add it to the DTD?

Sebastian

Musachy Barroso schrieb:
 try  preload=false on the divs(tabs).

 musachy

 On 8/10/07, Sebastian Kolbe [EMAIL PROTECTED] wrote:
   
 Hi

 I'm using already 2.0.9.
 Is there a config option for this or something similar?
 For me it looks like the 'remote'-div is fetching it's content on
 before  *and* load topic publishing.

 An other problem for me is that most browsers are rendering
 very, very slow into such a 'div'. A page with tables that normally
 (normal struts-action rendering into a browser window) takes less
 than 1 second needs here almost 20 - 30 seconds.  It looks like the
 javascript in browser is doing some sort of postprocessing on the
 content?

 Thanks,
 Sebastian

 Marco Carnevale schrieb:
 
 I had the same problem when I was using 2.0.6.  Upgrading to 2.0.8 \
 2.0.9resolved the issue.

 On 8/9/07, Sebastian Kolbe [EMAIL PROTECTED] wrote:

   
 Hello

 Hope someone can help me with this:
 I have a TabbedPane with some tabs in it, each calling an url for
 their content.
 Now I have several problems:
 - I noticed that the selected tab calls the url two times before
 displaying.
 - I reload a specific tab by publishing a dojo-topic. In this
 situation the div calls the
 url two times.

 Since especially some older browser need a lot of time to display the
 tabs content
 I need to correct this.
 Is there a way to circumvent this behaviour? Maybe I did anything wrong?

 Another question:
 Is there an easy way to catch the event (something like 'onclick') when
 a different tab is selected?

 Here is my code for reference:
 s:tabbedPanel id=resultTabPanel
 selectedTab=resultPanelTab_%{maxTabId}
s:url id=infoActionUrl
 action=SearchAction_fetchResultTable/s:url

s:div id=resultPanelTab_1 cssClass=panelTab
 label=tab1 theme=ajax labelposition=top
 href=%{infoActionUrl}
 errorText=Loading error on tab1
 refreshOnShow=false listenTopics=searchTab_0_Topic
 loadingText=Loading...
 showLoadingText=false autoStart=false executeScripts=true
div id=indicator1 align=center style=display:block;
   img  src=../pics/spinning_wheel_throbber.gif width=64
 height=64 alt=Loading...border=0 title=Loading.../
  /div
/s:div
 /s:tabbelPanel


 Thanks,
 Sebastian

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



Struts and arabic encoding

2007-08-10 Thread Ahmed Atif

hi all,
i have a problem with my web application, when i enter an arabic text in the
text fields and trying to save it in the database or print it into the
command it appears with some strange encoding some like this  احÙ?د 
and i'm using 
the meta tag
meta http-equiv=Content-Language content=ar-eg
meta http-equiv=Content-Type content=text/html; charset=windows-1256

also

[EMAIL PROTECTED] pageEncoding=windows-1256%

but nothing happened 
please if any one know how to solve this prob.
thanks
regards,
Ahmed 
-- 
View this message in context: 
http://www.nabble.com/Struts-and-arabic-encoding-tf4251427.html#a12100026
Sent from the Struts - User mailing list archive at Nabble.com.


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



Tiles and struts tags

2007-08-10 Thread Jim Reynolds
Struts 1.29 app that uses tiles definitions. Question is: I am finding
myself having to call the  taglib in the layout, and also in each
tile. If I take the taglib out of any of the jsp pages that is a tile,
then the page fails to display because it cannot find the taglib from
the template layout.

Is this the correct behavior, or is there any way to only include
needed taglib (html, bean, tiles, etc) only once somewhere?

Thanks

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



Struts tile and other tag includes

2007-08-10 Thread Jim Reynolds
Struts 1.29 app that uses tiles definitions. Question is: I am finding
myself having to call the  taglib in the layout, and also in each
tile. If I take the taglib out of any of the jsp pages that is a tile,
then the page fails to display because it cannot find the taglib from
the template layout.

Is this the correct behavior, or is there any way to only include
needed taglib (html, bean, tiles, etc) only once somewhere?

Thanks

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



Passing value from Struts tag in JSP to Action class

2007-08-10 Thread Oleg Konovalov
Hi,

 I am populating JSP page with rows retrieved from the database and
represented as a List of Beans in forEach loop:
c:forEach var=list items=${OperationsForm.OperationsList}
  ...
  c:choose
c:when test=${list.isCompleted =='Y'} 
td width=100Completed/td
td width=100nbsp;/td
/c:when
c:otherwise
td width=100Pending/td
td width=100input type=image onclick= *
rowId=value;* form.action='action.do?command=notify' *value*=${
list.OperationId} /
/td
/c:otherwise
/c:choose
/tr
/c:forEach
Have hidden field:  html:hidden property=*rowId* value=-1/

User is clicking the button corresponding to one of the rows
and I need to pass the  value of that  rowId to the Action class, so it does
something in the database [action completed]
Now how do I pass it , is that the right way of doing it  with calling
request.getSession().getAttribute(rowId) in the Action class ?
As of now I am getting Javascript error Object doesn't support this
property or method, complaining about *rowId=value;*

Using Struts 1.3

Please help !

TIA,
Oleg.


Re: Struts tile and other tag includes

2007-08-10 Thread Dave Newton
Hmm; repeat?

--- Jim Reynolds [EMAIL PROTECTED] wrote:
 Struts 1.29 app that uses tiles definitions.
 Question is: I am finding myself having to call the 

 taglib in the layout, and also in each tile. 

Remember; every JSP is a standalone servlet.

d.



   

Need a vacation? Get great deals
to amazing places on Yahoo! Travel.
http://travel.yahoo.com/

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



[OT] Re: Passing value from Struts tag in JSP to Action class

2007-08-10 Thread Dave Newton
--- Oleg Konovalov [EMAIL PROTECTED] wrote:
input type=image onclick=rowId=value; 
 As of now I am getting Javascript error Object
 doesn't support this property or method,
complaining 
 about *rowId=value;*

The onclick attribute must have valid JavaScript.

d.



   

Take the Internet to Go: Yahoo!Go puts the Internet in your pocket: mail, news, 
photos  more. 
http://mobile.yahoo.com/go?refer=1GNXIC

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



Re: Struts tile and other tag includes

2007-08-10 Thread Jim Reynolds
I have something like this: This is the layout, or tiles template as
the docs state.
%@ taglib uri=/WEB-INF/struts-html.tld prefix=html%
%@ taglib uri=/WEB-INF/struts-bean.tld prefix=bean%
%@ taglib uri=/WEB-INF/tiles.tld prefix=tiles%

html:html
 head
  titlebean:message key=global.title//title
  html:base/
 /head
 body topmargin=0 leftmargin=0 bgcolor=#FF

  !-- Header page information --
  tiles:insert attribute=header/

So on that page, I have the taglib uris for html, bean, etc.

Now lets say I have this which uses the layout
%@ taglib uri=/WEB-INF/tiles.tld prefix=tiles %

tiles:insert page=/layouts/storefrontDefaultLayout.jsp flush=true
  tiles:put name=header value=/common/header.jsp /
  tiles:put name=menubar value=/common/menubar.jsp /
  tiles:put name=body-content value=/index-body.jsp /
  tiles:put name=copyright value=/common/copyright.jsp /
/tiles:insert

So in each of my pages now, such as header.jsp, menubar.jsp, etc. I
have to put the html, bean, etc tags in each of these put pages., like
so:
menubar.jsp (example:
%@ taglib uri=/WEB-INF/struts-html.tld prefix=html%
%@ taglib uri=/WEB-INF/struts-bean.tld prefix=bean%

So basically, I am finding myself putting in the taglibs in each page
I am put(ting) in my template.  So I feel I am duplicating too much
code.

Does this make sense? Possibly, I am doing something wrong?

Thanks,


On 8/10/07, Dave Newton [EMAIL PROTECTED] wrote:
 Hmm; repeat?

 --- Jim Reynolds [EMAIL PROTECTED] wrote:
  Struts 1.29 app that uses tiles definitions.
  Question is: I am finding myself having to call the

  taglib in the layout, and also in each tile.

 Remember; every JSP is a standalone servlet.

 d.




 
 Need a vacation? Get great deals
 to amazing places on Yahoo! Travel.
 http://travel.yahoo.com/

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



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



Add Web Service to Struts Web App

2007-08-10 Thread semaj.najraham

Hi,

I've been googling and looking at the user mailing list if I add web service
to a struts based application, but didn't find my answers. Currently I am
developing a struts based application with Struts 1.3.8 with Struts
validator framework. I've implemented business layer and data layer.

In future, I need to integrate my app with other applications such as portal
using web service. Therefore, I would like to think ahead on how I can
integrate since I've not worked with web service before.

By googling and reading some of the articles, I found out that web service
can call struts actions.  My real concern is the data validation. 
1. Can I use Struts validator framework?
2. If not, do I need to do validation at data layer? 
3. If I need to do validation at data layer, can I use Commons Validator ? 
4. If I use Commons Validator, should I use it in both presentation layer
and data layer.

Commons Validator was a part of Struts Validator. I'm totally lost!

Any help will be greatly appreciated.

Thanks,
semaj
-- 
View this message in context: 
http://www.nabble.com/Add-Web-Service-to-Struts-Web-App-tf4252401.html#a12102392
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: Add Web Service to Struts Web App

2007-08-10 Thread Frank W. Zammetti

One simple answer might be the StrutsWS project:

http://sourceforge.net/projects/strutsws/

In CVS you'll find a version for the 1.3.x branch of Struts.  Simply 
put, it allows you to call your existing Struts Actions as Web Services 
without any changes to them.  This means any validation you have 
configured should still work, they don't know they are being accessed as 
services versus part of a Struts app.


I have to say the project hasn't been developed lately, but we left it 
in a stable state, and anyone is free to pick up where we left off if 
they wanted to.


Frank

--
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
AIM/Yahoo: fzammetti
MSN: [EMAIL PROTECTED]
Author of Practical Ajax Projects With Java Technology
 (2006, Apress, ISBN 1-59059-695-1)
and JavaScript, DOM Scripting and Ajax Projects
 (2007, Apress, ISBN 1-59059-816-4)
Java Web Parts - http://javawebparts.sourceforge.net
 Supplying the wheel, so you don't have to reinvent it!

semaj.najraham wrote:

Hi,

I've been googling and looking at the user mailing list if I add web service
to a struts based application, but didn't find my answers. Currently I am
developing a struts based application with Struts 1.3.8 with Struts
validator framework. I've implemented business layer and data layer.

In future, I need to integrate my app with other applications such as portal
using web service. Therefore, I would like to think ahead on how I can
integrate since I've not worked with web service before.

By googling and reading some of the articles, I found out that web service
can call struts actions.  My real concern is the data validation. 
1. Can I use Struts validator framework?
2. If not, do I need to do validation at data layer? 
3. If I need to do validation at data layer, can I use Commons Validator ? 
4. If I use Commons Validator, should I use it in both presentation layer

and data layer.

Commons Validator was a part of Struts Validator. I'm totally lost!

Any help will be greatly appreciated.

Thanks,
semaj



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