Re: Submit with several methods in Struts 2.2

2010-09-14 Thread hernan gonzalez
Has it been included in the JIRA tracker?
https://issues.apache.org/jira/browse/WW
https://issues.apache.org/jira/browse/WWI don't see it


Hernán

On Tue, Sep 14, 2010 at 6:18 AM, Maqsud Mohammad 
maqsud.moham...@ratedpeople.com wrote:

 i raised this issue as a bug but havent got any updates from the struts2
 team yet.




Submit with several methods in Struts 2.2

2010-09-13 Thread hernan gonzalez
This pattern (submit tag with method specified)
http://struts.apache.org/2.2.1/docs/html-form-buttons-howto.html
worked for me in my previous version (from Struts 2.1.6).
Now (in Struts 2.2.1), I can't make it work. It always calls execute.
The only workaround I found was to set DynamicMethodInvocation=true (which
is discouraged in the docs, and was not necesary before).
Is this some documented change? Did I miss something?

Regards

Hernán

= sample code / configuration 

public class TestMethodAction extends ActionSupport {
private String param1 =;

public String myMethod() throws Exception {
addActionMessage(Testing myMethod);
return SUCCESS;
}
// setters / getters 
}


and my Jsp:

s:form
 s:textfield name=param1 label=Write something /
 s:submit value=Test method=myMethod /
 /s:form
 s:property value=param1/  !-- for testing if the Param has been read
(this works ok)--


Debug console info:


DEBUG [http-8080-1] org.apache.struts2.interceptor.FileUploadInterceptor
debug- Bypassing /test/TestMethod
DEBUG [http-8080-1]
org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor
debug- Validating /test/TestMethod with method execute.

DEBUG [http-8080-1] org.apache.struts2.dispatcher.ServletDispatcherResult
debug- Forwarding to location /jsp/test/TestMethod.jsp
DEBUG [http-8080-1] org.apache.struts2.components.UIBean debug- Rendering
template /template/xhtml/actionmessage

struts.xml:

...
constant name=struts.enable.DynamicMethodInvocation value=false /
constant name=struts.devMode value=true /
   ...
  action name=TestMethod class=myproject.struts2.TestMethodAction
result/jsp/test/TestMethod.jsp/result
 /action

==


Re: [s2] broken documentation in web site

2010-06-15 Thread hernan gonzalez
More than 40 days passed, and still broken.
http://struts.apache.org/2.1.8.1/docs/tag-reference.html
http://struts.apache.org/2.1.8.1/docs/tag-reference.htmlThis is getting
depressing, it makes Struts2 look as an dying project.

Hernán


Re: Online docs messed up

2010-05-19 Thread hernan gonzalez
Still broken.

On Mon, May 17, 2010 at 12:39 PM, Lukasz Lenart
lukasz.len...@googlemail.com wrote:
 2010/5/14 nuwan chandrasoma mymail...@gmail.com:
 I also noticed that, i think the wiki .css is messed up,

 It's because of new Confluence and auto export plugin :-(
 I can restore the previous version of the css file but it looks like
 everyday a new export is generated :P


 Regards
 --
 Łukasz
 http://www.lenart.org.pl/
 Kapituła Javarsovia 2010
 http://javarsovia.pl

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





-- 
Hernán J. González
http://hjg.com.ar/

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



Re: java.lang.NoClassDefFoundError: org/apache/struts2/util/ObjectFactoryDestroyable

2010-05-17 Thread hernan gonzalez
Are you placing your struts jars in the tomcat lib directory ?
If so, try removing from there and placing them inside the war (web application)

On Mon, May 17, 2010 at 4:16 PM, Emi Lu em...@encs.concordia.ca wrote:
 The most similar question I could find is:

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

 But did not find any solutions?

 Someone knows the solution?

 Thanks a lot!
 --
 Lu Ying





 On 05/17/2010 02:50 PM, Emi Lu wrote:

 Hi Rebecca, Martin,

 Could you be having something going crazy with your build scripts or
 something where the struts core jar isn't getting put in the right spot?


   check to see if struts2-core-version.jar is located in
 YourWebApp/WEB-INF/lib

 Yes. it is there.

 Tomcat 6.0, jdk1.6, ant-1.6.2.

 If I restart tomcat, the error is gone.

 The error is shown only when I re-install source codes and did not
 reload tomcat.

 Some possible places that I should pay special attention? I am using ant
 1.6.2. Could this cause some potential problems? How come restart
 tomcat, errors are gone?

 Thanks a lot!
 --
 Lu Ying





 - Original Message 
 From: Emi Luem...@encs.concordia.ca
 To: user@struts.apache.org
 Sent: Mon, May 17, 2010 10:48:38 AM
 Subject: java.lang.NoClassDefFoundError:
 org/apache/struts2/util/ObjectFactoryDestroyable

 Good morning List,

 Using struts2.1.8.1, when I reinstall my application, I always got the
 following errors java.lang.NoClassDefFoundError:
 org/apache/struts2/util/ObjectFactoryDestroyable

 But in struts.jar does contain this class.

 Could someone help and tell me what cause the problem?

 Thanks a lot
 --
 Lu Ying




 SEVERE: Exception invoking periodic operation:
 java.lang.NoClassDefFoundError:
 org/apache/struts2/util/ObjectFactoryDestroyable
 at org.apache.struts2.dispatcher.Dispatcher.cleanup(Dispatcher.java:265)
 at

 org.apache.struts2.dispatcher.FilterDispatcher.destroy(FilterDispatcher.java:233)

 at

 org.apache.catalina.core.ApplicationFilterConfig.release(ApplicationFilterConfig.java:357)

 at

 org.apache.catalina.core.StandardContext.filterStop(StandardContext.java:3873)

 at
 org.apache.catalina.core.StandardContext.stop(StandardContext.java:4605)
 at

 org.apache.catalina.core.StandardContext.reload(StandardContext.java:3222)

 at

 org.apache.catalina.loader.WebappLoader.backgroundProcess(WebappLoader.java:403)

 at

 org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1309)

 at

 org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1601)

 at

 org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1610)

 at

 org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1610)

 at

 org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1590)

 at java.lang.Thread.run(Thread.java:619)

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





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


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





-- 
Hernán J. González
http://hjg.com.ar/

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



Re: java.lang.NoClassDefFoundError: org/apache/struts2/util/ObjectFactoryDestroyable

2010-05-17 Thread hernan gonzalez
You are doing a hot deploy of your full webapplication inside a
Tomcat tree, without restarting it ? If that's the case, I'm not much
surprised, hot deploys are rather fragile with respect to class
loading issues in my experience. I restart Tomcat in each deploy.

On Mon, May 17, 2010 at 5:11 PM, Emi Lu em...@encs.concordia.ca wrote:
 In my ant. build.xml file, I have classpath lib included shown as the
 following:


   path id=master-classpath
                fileset dir=${libraries}
                        include name=*.jar/
                /fileset
                fileset dir=${j2ee-common}
              include name=**/*.jar/
            /fileset
   /path
   ---. ${libraries} include struts-core.jar (webapp/WEB-INF/lib/)


        target name=compile depends=init
      echoCompile the source files/echo
           javac srcdir=${source} destdir=${webapp}/WEB-INF/classes
              classpath refid=master-classpath/
           /javac
        /target

 Still not find the solution why I have to re-start tomcat after I do ant
 -property build.xml

 Thanks a lot!
 --
 Lu Ying





 if your going to run your struts application (out of container) then you
 will need struts-core-version.jar on CLASSPATH e.g.

 dependency
 groupIdorg.easymock/groupId
 artifactIdeasymock/artifactId
 version2.0/version
 configuration
 source1.5/source
 target1.5/target

 compilerargumentclasspath=$STRUTS2_HOME/core/target/struts2-core-2.1.8.jar;%CLASSPATH%/compilerargument
 /configuration
 scopetest/scope
 /dependency

 Martin Gainty
 __
 Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité

 Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
 Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede
 unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig.
 Diese Nachricht dient lediglich dem Austausch von Informationen und
 entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten
 Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt
 uebernehmen.

 Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le
 destinataire prévu, nous te demandons avec bonté que pour satisfaire
 informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie
 de ceci est interdite. Ce message sert à l'information seulement et n'aura
 pas n'importe quel effet légalement obligatoire. Étant donné que les email
 peuvent facilement être sujets à la manipulation, nous ne pouvons accepter
 aucune responsabilité pour le contenu fourni.






   Date: Mon, 17 May 2010 14:50:47 -0400
   From: em...@encs.concordia.ca
   To: mrc...@yahoo.com
   CC: user@struts.apache.org; mgai...@hotmail.com
   Subject: Re: java.lang.NoClassDefFoundError:
 org/apache/struts2/util/ObjectFactoryDestroyable
  
   Hi Rebecca, Martin,
  
    Could you be having something going crazy with your build scripts
 or something where the struts core jar isn't getting put in the right
 spot?
  
  
    check to see if struts2-core-version.jar is located in
   YourWebApp/WEB-INF/lib
  
   Yes. it is there.
  
   Tomcat 6.0, jdk1.6, ant-1.6.2.
  
   If I restart tomcat, the error is gone.
  
   The error is shown only when I re-install source codes and did not
   reload tomcat.
  
   Some possible places that I should pay special attention? I am using
 ant
   1.6.2. Could this cause some potential problems? How come restart
   tomcat, errors are gone?
  
   Thanks a lot!
   --
   Lu Ying
  
  
  
   
   
    - Original Message 
    From: Emi Luem...@encs.concordia.ca
    To: user@struts.apache.org
    Sent: Mon, May 17, 2010 10:48:38 AM
    Subject: java.lang.NoClassDefFoundError:
 org/apache/struts2/util/ObjectFactoryDestroyable
   
    Good morning List,
   
    Using struts2.1.8.1, when I reinstall my application, I always got
 the following errors java.lang.NoClassDefFoundError:
 org/apache/struts2/util/ObjectFactoryDestroyable
   
    But in struts.jar does contain this class.
   
    Could someone help and tell me what cause the problem?
   
    Thanks a lot
    --
    Lu Ying
   
   
   
   
    SEVERE: Exception invoking periodic operation:
    java.lang.NoClassDefFoundError:
 org/apache/struts2/util/ObjectFactoryDestroyable
    at
 org.apache.struts2.dispatcher.Dispatcher.cleanup(Dispatcher.java:265)
    at

 org.apache.struts2.dispatcher.FilterDispatcher.destroy(FilterDispatcher.java:233)
    at

 org.apache.catalina.core.ApplicationFilterConfig.release(ApplicationFilterConfig.java:357)
    at

 org.apache.catalina.core.StandardContext.filterStop(StandardContext.java:3873)
    at
 org.apache.catalina.core.StandardContext.stop(StandardContext.java:4605)
    at
 org.apache.catalina.core.StandardContext.reload(StandardContext.java:3222)
    at

 org.apache.catalina.loader.WebappLoader.backgroundProcess(WebappLoader.java:403)
    at

 org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1309)
    

Re: [s2] broken documentation in web site

2010-05-06 Thread hernan gonzalez
Not only that, but the page displays ugly (classic missing css
symptom) and the main css

http://struts.apache.org/2.x/docs/resources/space.css

still show errors inside:

/* Could not locate resource: /includes/css/master.css */


On Thu, May 6, 2010 at 10:44 AM, Lukasz Lenart
lukasz.len...@googlemail.com wrote:
 2010/5/6 hernan gonzalez hgonza...@gmail.com:
 Uhmm CSS stuf is still broken for me -as detailed in previous post.
 And further, there's a #editReport()  thing near the header in most
 pages, for example here
 http://struts.apache.org/2.x/docs/getting-started.html

 You meant that CSS -
 http://cwiki.apache.org/confluence/download/resources/confluence.ext.code:code/shStyles.css
 If so it will be removed as is not needed, also that #editReport() can
 be thrown away!

 On Thu, May 6, 2010 at 3:45 AM, Lukasz Lenart
 lukasz.len...@googlemail.com wrote:
 Strange, it looks ok right now ;-)

 @Wes did do some magic?


 Regards
 --
 Łukasz
 http://www.lenart.org.pl/
 Kapituła Javarsovia 2010
 http://javarsovia.pl



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





-- 
Hernán J. González
http://hjg.com.ar/

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



Re: [s2] broken documentation in web site

2010-05-06 Thread hernan gonzalez
Not a cache issue on my side, I try this on several servers around the
world and get the same:

[vps1]~ $ wget --quiet -O-
http://struts.apache.org/2.x/docs/resources/space.css | grep resource
/* Could not locate resource: /includes/css/master.css */
/* Could not locate resource: /includes/css/wiki-content.css */


Do you get a different result ? Perhaps some cache in apache.org... ?


Hernán

 /* Could not locate resource: /includes/css/master.css */
Try to force reload that page, I don't see such problems any more!

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



[s2] broken documentation in web site

2010-05-05 Thread hernan gonzalez
Since several days ago, the docs in the webpage of Struts2 are badly
broken, in particular the examples and code.

Examples

https://cwiki.apache.org/WW/stream-result.html
http://struts.apache.org/2.x/docs/stream-result.html
http://struts.apache.org/2.x/docs/writing-interceptors.html

Compare the last ones with the older ones:

http://struts.apache.org/2.0.14/docs/stream-result.html
http://struts.apache.org/2.0.14/docs/writing-interceptors.html

-- 
Hernán J. González
http://hjg.com.ar/

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



Re: [s2] broken documentation in web site

2010-05-05 Thread hernan gonzalez
It seems quite probable that all will get fixed when the docs are
regenerated. Can somebody
force a full regeneration?

On Wed, May 5, 2010 at 12:00 PM, Lukasz Lenart
lukasz.len...@googlemail.com wrote:
 2010/5/5 Lukasz Lenart lukasz.len...@googlemail.com:
 Hmm something strange, the code is there but highlighting doesn't
 work any more :-(

 Here it is - https://issues.apache.org/jira/browse/INFRA-2638 but I
 have no clue how to solve that :P


 Regards
 --
 Łukasz
 http://www.lenart.org.pl/
 Kapituła Javarsovia 2010
 http://javarsovia.pl

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





-- 
Hernán J. González
http://hjg.com.ar/

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



struts 2.1.6 verbose logging

2009-03-18 Thread hernan gonzalez
Struts 2.1 introduces more verbose logging than Struts 2.0. While
extremely valuable, some users may find these annoying.
http://cwiki.apache.org/S2WIKI/troubleshooting-guide-migrating-from-struts-20x-to-21x.html

The extremely annoying thing is that struts 2.1 emits those warnings
(apparently) for each struts2 ui tag in each jsp page.  (Could not
find property [templateDir] )

In fact, a few (20 or 30) requests in my web application results in a
lot (about 1000) of warnings which are not (AFAIK) related to my
application, but to struts internals.
I like to be warned of missing properties in the stack, as they might
point to missing properies in my actions or bad spelt jsp tags... but
this is not very useful:

# tail -n 2000 /usr/local/tomcat/logs/catalina.out | grep Could not
find | sed 's/http.* //' | sort | uniq -c
 24 WARN  [[.freemarker.Request]
 24 WARN  [[.freemarker.RequestParameters]
 29 WARN  [[org.apache.catalina.jsp_file]
 29 WARN  [[struts.valueStack]
864 WARN  [[templateDir]
192 WARN  [[theme]

And no solution is provided, except for disabling those warnings completely.
I'd like to know if that implies something wrong (or slightly wrong)
about my jsp pages, or about struts.

Hernán

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



Re: Possible to return ibatis query in xml file?

2009-03-04 Thread hernan gonzalez
If I understand right, the answer is no (and the question is not
related to struts, but only to ibatis).
You can't get (AFAIK) the sql generated/executed by ibatis, and there
are good reasons for that.
If you are debugging some sql problem, your database should allow you
to turn on full logging
of your sql queries.

Hernán J. González
http://hjg.com.ar/

On Wed, Mar 4, 2009 at 4:46 PM, Emi Lu em...@encs.concordia.ca wrote:
 Good morning,

 I have a question based on ibatis + struts. Would it be possible that in
 java code, I could get the query in ibatis.

 For example, in ibatis_query.xml
 select id=test
 select * from a
 /select


 In java,
 ===
   public ActionForward execute(
      ActionMapping mapping,
      ActionForm aform,
      HttpServletRequest request,
      HttpServletResponse response)
   throws Exception
   {
      String ibatis_sql = ***(something need to know).getQuery(test, null);
    ... ...
   }


 Thanks a lot!
 Lu Ying






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





--

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



Re: Struts 2 - After validation failure populating the drop downs

2009-03-03 Thread hernan gonzalez
You should tell us how the dropdowns were populated in the first page.
If only one Action class is involved, and the dropdowns are populated
by reading some attribute of it
(eg:   getOptionListForDropDown() which looks at the
optionListForDropDown list )
you should fill that list, not in the action method that is invoked
for generating the
first form page, but in the prepare method, or in the constructor, or
making the getter method a lazy getter (my preferred way, in
general; but this depends on the scenario)

Hernán J. González
http://hjg.com.ar/



--

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



Re: Best Practices for Forms

2009-03-02 Thread hernan gonzalez
To avoid the problem of duplicated submissions (not only when
refreshing the result page, but also when double clicking the submit
button, or going back to the submited form and submitting again) you
should take a look at  the TokenSessionStoreInterceptor.

But that is complementary with the other issue: it is not bad practice
to separate the actions addData  from the action viewData, the
later is idempotent , the former is not. Hence, you might implement
two separate Actions (or a same Action with two methods that return
different results). For example

-
action name=SubmitData class=action.SubmitDataAction
result name=success/viewSubmitResult.jsp/result
/action

action name=ViewData class=action.ViewDataAction
result name=success/viewData.jsp/result
/action

(Here SubmitDataAction should include the Token interceptor to avoid
double submissions. And /viewSubmitResult.jsp might just show a
generic succes message with a link to the ViewDataAction action)



or

action name=SubmitData class=action.SubmitDataAction
result name=success
type=redirectViewDataAction.do?id=%{dataId}/result
/action

action name=ViewData class=action.ViewDataAction
result name=success/viewData.jsp/result
/action

(This is a little more straightforward, but has the slight
disadvantage of losing any ActionMessage you might have produced in
the SubmitDataAction)

---

Hernán J. González
http://hjg.com.ar/

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



[s2] accesing params from s:include tag

2009-02-27 Thread hernan gonzalez
I'm struggling with s:include + s:param in struts 2.0.14

The docs  for the include tag http://struts.apache.org/2.0.14/docs/include.html
states:

How To access parameters  Parameters are passed as request
parameters, so use the ${param.ParamName} notation to access  them. Do
not use the property tag to access parameters in included files.

That's not very clear for me, (and for others, judging from old
messages in the list).
The parameters passed to an included jsp via struts2 tags can't be
accesed using struts2 tags??
(it appears that the parameters are not added to the parameters
collection in the actionContext)

This should be really simple, please, can't someone give an example ?

Say I have a page.jsp that includes a fragment jsp file via the following:

s:include value=frag.jsps:param name=opt1/s:param/s:include

In the frag.jsp I want to do something as

s:if test=#parameters.opt == 1 ... /s2:if

What would be the correct syntax?

Hernán J. González

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



Re: [s2] accesing params from s:include tag

2009-02-27 Thread hernan gonzalez
 I was not able to do it, despite trying a million different forms as well as 
 suggestions by some folks in strust mailing list.
 I do not think you will be able to access the param value passed to s:include 
 within struts tag [clearly an obvious shortcoming]. Your best bet is using 
 jsp expression language as the parameter is put in request scope.


Indeed a shortcoming, and a frustrating one.
Wouldn this be partially fixed if, when the  s:include/s:param are
evaluated, the params are also put into the parameters object in the
ActionContext? Are there good reasons to not doing so ?


BTW, although I much prefer Struts2 over Struts1, the fact that many
developers -not gurus, but with some months of s2 experience-
frequently need to try million different forms ( # % $  params
parameters etc etc) till (in the best scenario) it happens to work,
should tell something...


Hernán J. González

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



Re: Form validation: how can khow in jsp that my action validation failed?

2009-02-27 Thread hernan gonzalez
Your jsp has access to your action, in the valuestack. So, you should
be able to ask

s:if test=hasActionErrors()

/s:if

Beware: for validation errors,
besides hasActionErrors()  you might want to ask hasFieldErrors().
Or use hasErrors() , that includes both


Hernán J. González
http://hjg.com.ar/


On Fri, Feb 27, 2009 at 3:25 PM, boraldo bora...@hotbox.ru wrote:

 I need output special info in JSP if validation failed. How can I do it?
 ActionSupport has method hasActionErrors. I need smth like that for JSP.
 --
 View this message in context: 
 http://www.nabble.com/Form-validation%3A-how-can-khow-in-jsp-that-my-action-validation-failed--tp22250234p22250234.html
 Sent from the Struts - User mailing list archive at Nabble.com.


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





--

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



S2 - Errors in tags documentation

2009-01-21 Thread hernan gonzalez
The docs for the iterator tag,
http://struts.apache.org/2.0.11.2/docs/iterator.html
has an error, IMO (apart from the unfortunate confusion over the 'id'
vs 'var' attributes, which actually apply to struts 2.1) :

It says:

var  : Name used to reference the value pushed into the Value Stack

But, if I am not mistaken, the value is not 'pushed into the
ValueStack', but 'placed into the ActionContext'.

The same error appears in the bean tag docs:
http://struts.apache.org/2.0.11.2/docs/bean.html

Hernán J. González
http://hjg.com.ar/



On Wed, Jan 21, 2009 at 9:25 AM, Fernandes Celinio SGCF
celinio.fernan...@socgen.com wrote:
 Hello Lukasz,
 Can you access the source code of this plugin ?
 http://code.google.com/p/struts2ejb3/

 I signed in on google but still cannot see any files.
 Is that project still empty ?

 Does anyone see the files ?


 -Message d'origine-
 De : Lukasz Lenart [mailto:lukasz.len...@googlemail.com]
 Envoyé : mardi 20 janvier 2009 22:10
 À : Struts Users Mailing List
 Objet : Re: Injecting in Interceptors

 2009/1/20 Ignacio de Córdoba icord...@skios.es:
 Anybody has an idea on how can I get info about ServletContext in the init()
 method of an interceptor? I'd like to lookup EJBs there and not lookup them
 for every request (I know I can get the info I need from ActionInvocation
 object that every intercept() gets)

 Did you try to use that plugin [1], you can ever base on it, build
 your own specific solution

 [1] http://code.google.com/p/struts2ejb3/


 Regards
 --
 Lukasz
 http://www.lenart.org.pl/

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

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





--

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



Re: S2 - Errors in tags documentation

2009-01-21 Thread hernan gonzalez
Of course, the object is pushed on the stack in every case (inside the
scope of the iterator /bean tag) but , apart from that, the var/id
attribute is used to place it (with that name!) in the ActionContext,
and it will remain there even outside the tag scope, after it has been
removed from the stack.

The docs seem (to me?) to imply that the name is used for pushing it
onto the stack  (which doesnt make sense).

On Wed, Jan 21, 2009 at 5:58 PM, Dave Newton newton.d...@yahoo.com wrote:
 (Forgot to add that the same is true for the bean tag as well.)

 Dave Newton wrote:

 hernan gonzalez wrote:

 The docs for the iterator tag,
 http://struts.apache.org/2.0.11.2/docs/iterator.html
 has an error, IMO (apart from the unfortunate confusion over the 'id'
 vs 'var' attributes, which actually apply to struts 2.1) :

 It says:

var  : Name used to reference the value pushed into the Value Stack

 But, if I am not mistaken, the value is not 'pushed into the
 ValueStack', but 'placed into the ActionContext'.

 Supplying the var/id attribute doesn't remove the stack push, it just adds
 the stack context reference. For example, from S2.0.11's IteratorComponent
 code:

 if ((iterator != null)  iterator.hasNext()) {
Object currentValue = iterator.next();
stack.push(currentValue);

String id = getId();
if ((id != null)  (currentValue != null)) {
stack.getContext().put(id, currentValue);
}
 //...


 Dave


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




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





-- 
Hernán J. González
http://hjg.com.ar/

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



Re: [ANNOUNCE] Struts 2.1.6 GA Release

2009-01-15 Thread hernan gonzalez
Thats fixed

Another related issue:
The releases notes for 2.1.6 has a (correct) link to releases notes
for previous - 2.1.5 , and so
on. This seems to be the only (is it?) way of look at the changes from
2.0. Besides
being a little involved (I believe the changes from 2.0.x should be
more visible; and a link to
the wiki article 2.0 to 2.1 for migration instructions would be
useful), the link 2.1.4 releases notes breaks the chain, its previous
release notes link points to itself.

http://struts.apache.org/2.1.6/docs/version-notes-214.html

Hernán J. González
http://hjg.com.ar/



On Thu, Jan 15, 2009 at 12:50 AM, Musachy Barroso musa...@gmail.com wrote:
 The link should be fine now. Thanks for reporting.

 musachy

 On Wed, Jan 14, 2009 at 9:39 PM, Martin Gainty mgai...@hotmail.com wrote:

 Hernan

 Can you file a bug report for this error at
 http://issues.apache.org/struts

 Saludos Cordiales desde EEUU
 Martin Gainty
 GMT+5
 __
 Disclaimer and confidentiality note
 Everything in this e-mail and any attachments relates to the official 
 business of Sender. This transmission is of a confidential nature and Sender 
 does not endorse distribution to any party other than intended recipient. 
 Sender does not necessarily endorse content contained within this 
 transmission.




 Date: Wed, 14 Jan 2009 17:37:35 -0200
 From: hgonza...@gmail.com
 To: user@struts.apache.org
 Subject: Re: [ANNOUNCE] Struts 2.1.6 GA Release

 The link to Releases notes in the main download page is broken.


 --
 Hernán J. González
 http://hjg.com.ar/


 On Wed, Jan 14, 2009 at 12:19 PM, Musachy Barroso musa...@gmail.com wrote:
  The Apache Struts group is pleased to announce that Struts 2.1.6 is
  available as a General Availability release. The GA designation is our
  highest quality grade.
 

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


 _
 Windows Live™: Keep your life in sync.
 http://windowslive.com/explore?ocid=TXT_TAGLM_WL_t1_allup_explore_012009



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

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





--

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



Re: [ANNOUNCE] Struts 2.1.6 GA Release

2009-01-14 Thread hernan gonzalez
The link to Releases notes in the main download page is broken.


-- 
Hernán J. González
http://hjg.com.ar/


On Wed, Jan 14, 2009 at 12:19 PM, Musachy Barroso musa...@gmail.com wrote:
 The Apache Struts group is pleased to announce that Struts 2.1.6 is
 available as a General Availability release. The GA designation is our
 highest quality grade.


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



Re: struts 2.1.5 listed on http://struts.apache.org/2.x/

2009-01-10 Thread hernan gonzalez
Another issue with the web site (probably it has been already noted) :
The Recent Threads box, in prominent place in the main page
http://struts.apache.org/
has not been updated in more than a year (!)

Hernán J. González
http://hjg.com.ar/

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



Re: OGNL exceptions are swallowed by struts2

2009-01-09 Thread hernan gonzalez

 I agree, Struts2 sucks big time in
 this regard while being an excellent framework otherwise.

 Robert

Judging from my (not very long) experience with Struts2, I agree wholeheartedly
with that.

It really seems badly broken that the framework (OGNL, in this case)
swallows exceptions (even if we are on the view stage, even if it logs it).

See also this thread http://markmail.org/message/ui2gbkuqjiuhnudf

If the very architecture design of OGNL implies that this cannot be fixed,
developers should be clearly warned about it. It means, for example, that
the one has put special care with  lazy getters in the action
(those which are called from the rendering stage), as exceptions during its
execution won't break the jsp page.  IMHO, this simply sucks.

Hernán J. González
http://hjg.com.ar/

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



Re: struts 2.1.5 listed on http://struts.apache.org/2.x/

2009-01-07 Thread hernan gonzalez
Now it says 2.1.6 ...
Please fix it, it's the first page that Googles shows searching by struts2.

Hernán J. González
http://hjg.com.ar/



On Mon, Jan 5, 2009 at 4:37 PM, Chris Pratt thechrispr...@gmail.com wrote:
 That is the official page, in fact 2.1.5 isn't actually on the page that
 button is linked to.  My guess would be something in the CI Script updates
 the blue button automatically and it was unintentionally triggered.
  (*Chris*)

 On Mon, Jan 5, 2009 at 9:14 AM, bradcupit b...@lsu.edu wrote:



 Wendy Smoak-3 wrote:
 
  From http://struts.apache.org, that page is linked under 'Development'
  as 'Struts 2.x Draft Docs'
 

 Oh wow, I didn't realize that page was a development page. That actually
 explains a bit. :-)


 Wendy Smoak-3 wrote:
 
  I'm curious, how did you get to that page?
 

 I've had the link for quite a while, and assumed it was the main Struts 2
 page. I just did a Google search for struts 2, without the quotes, and
 the
 first link Google pulls up is http://struts.apache.org/2.x/
 --
 View this message in context:
 http://www.nabble.com/struts-2.1.5-listed-on-http%3A--struts.apache.org-2.x--tp21293172p21295111.html
 Sent from the Struts - User mailing list archive at Nabble.com.


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






--

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



Re: How traumatic is to migrate from struts version 1.2 to struts version 2.0 ???

2008-11-07 Thread hernan gonzalez
S2 and S1 are entirely different frameworks.
The migration involves rewriting a lot, actions and jsp.
They can coexist, though, and you can migrate gradually, by steps.
We are doing that: two related webapps; the small one (25 actions, 70
jsp) is fully done,
the other is about twice bigger and almost done. It was quite a job,
but rather satisfying
(each ActionForm deleted...is a pleasure), I'd really hate to have to
go back to Struts 1.

Suerte!

Hernán J. González
http://hjg.com.ar/



   Hie everybody:
   I have a project working with struts 1.2 version, I would want to know
 How
  traumatic is to migrate from struts version 1.2 to struts version 2.0 ???
 
  Thanks in advance.
  Greetings
  Ariel
 





--

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



Re: struts2 validation failed method

2008-11-03 Thread hernan gonzalez
The quick answer: in the default configuration, when the validation
fails the result INPUT (input) is returned. You frequently define a
mapping for this action and result in your struts.xml which renders
the original jsp (the input) so that the user can see the errors
(eg: s:actionerrors /) and reenter the data.

Hernán J. González
http://hjg.com.ar/



On Mon, Nov 3, 2008 at 7:59 AM, Harden ZHU [EMAIL PROTECTED] wrote:
 Hi,

 I have Basic Validation. If validation failed, which method struts2 is
 calling? Can I define some method like in struts1 input?

 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: [S2]Multiple Form Submission

2008-10-30 Thread hernan gonzalez
On Wed, Oct 29, 2008 at 8:06 PM, Jishnu Viswanath
[EMAIL PROTECTED] wrote:
In some case I am getting
 Map session = ActionContext.getContext().getSession();
 And the session contains a key called


Unless you are doing some research to understand struts internals or
deal with some very strange scenario, you should keep it simple, don's
mess with the token in java, and practically never refer explicity to
the actioncontext in your action. This introduces unnecessary coupling
with struts internals, and smells just bad.

Hernán

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



Re: [S2]Multiple Form Submission

2008-10-29 Thread hernan gonzalez
http://struts.apache.org/2.0.11.2/docs/token-interceptor.html
http://struts.apache.org/2.0.11.2/docs/token-session-interceptor.html
http://www.planetstruts.org/struts2-showcase/token/index.jsp


Hernán J. González
http://hjg.com.ar/

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



Re: How to recover the action's name executed

2008-10-29 Thread hernan gonzalez
If you need to execute different validation for each method, would'n
it  be more
pertinent to validate programatically, invoking the corresponding
validation method
from each action method ?


On Wed, Oct 29, 2008 at 10:55 AM, Juanjo Cuadrado [EMAIL PROTECTED] wrote:
 Hi,

 I need to know how to recover (from the validation method) the name of de
 action that has been invoked. I want to know the name of the method that
 will be executed for this action (in the struts.xml I have put diferents
 methods for the same action class).

 Thanks.




-- 
Hernán J. González
http://hjg.com.ar/

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



Re: How to putt objects on the valuestack from INSIDE an action?

2008-10-29 Thread hernan gonzalez
A suggestion, which might or not be adequate for your case:
If  every action/jsp of your webapplication share that behaviour, and
if your actions
presently just extend ActionSupport, you might want to change that so that they
extend instead a MySiteAction class (which extends ActionSupport and implements
ServletRequestAware) with a getter for that object kept in the session.

Hernán J. González
http://hjg.com.ar/


On Wed, Oct 29, 2008 at 8:46 AM, Alexander Baetz
[EMAIL PROTECTED] wrote:
 I guess i should add explanation.

 i want to save an object permanently on the value stack.
 In my case this object holds many informations that configure my pages
 (loginuserid...). It is created inside my loginAction.
 I can get it from an action with a get-Method, but this object is permanent
 and doesnt matter for any action beside login/logout. But the jsp uses it
 every time.

 I could put this object into the session (which i currently do). But i like
 the value stack, and prefere lines like #Settings.loginUser.id instead of
 #session.settings.loginuser.id

 Hope i could explain my problem

 Greetings,
 Laures

 Sébastien Domergue schrieb:


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



Re: How to recover the action's name executed

2008-10-29 Thread hernan gonzalez
I wrote  validate programatically, it's rather trivial, though
perhaps does not mix well with
declarative validation, if you are using it. For example


public class MyAction extends ActionSupport implements Validateable  {

  public String method1() throws Exception  {
   validate1();
   if(hasErrors()) return INPUT;
   ... // real method1 work
  }

  public String method2() throws Exception  {
   validate2();
   if(hasErrors()) return INPUT;
   ... // real method1 work
  }


  public void validate1() {
 ...
  }

  public void validate2() {
 ...
  }

  public void validate () {
 // common validation for every method
  }

}


On Wed, Oct 29, 2008 at 11:52 AM, Juanjo Cuadrado [EMAIL PROTECTED] wrote:
 uuummm... yes... but.. how?

 have you documentation this?

 2008/10/29 hernan gonzalez [EMAIL PROTECTED]

 If you need to execute different validation for each method, would'n
 it  be more
 pertinent to validate programatically, invoking the corresponding
 validation method
 from each action method ?


 On Wed, Oct 29, 2008 at 10:55 AM, Juanjo Cuadrado [EMAIL PROTECTED]
 wrote:
  Hi,
 
  I need to know how to recover (from the validation method) the name of de
  action that has been invoked. I want to know the name of the method that
  will be executed for this action (in the struts.xml I have put diferents
  methods for the same action class).
 
  Thanks.
 



 --
 Hernán J. González
 http://hjg.com.ar/

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






-- 
Hernán J. González
http://hjg.com.ar/

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



Re: [S2]Multiple Form Submission

2008-10-29 Thread hernan gonzalez
Take a look at the documentation. The  message is quite clear:

No result defined for action com.neolivz.sandbox.action.IndexAction
and result invalid.token

The Tokeninterceptor  throw a special result  invalid.token when the
token is invalid (what usually
means a double submit). Hence, you should configure specify a jsp for
that result in your action mapping
(for that action, and/or globally).

Take a look also to the token-session-interceptor.html which has a
(perhaps) more interesting behaviuor.
You might also buy the struts2 in action book.

Regards

Hernán J. González
http://hjg.com.ar/



On Wed, Oct 29, 2008 at 2:54 PM, Jishnu Viswanath
[EMAIL PROTECTED] wrote:

 Hi,
Thanks for the reply but I tried it out but got this error.
 In my stack I added
interceptor-ref name=token-session/
 I have a list of interceptors stacks, I added to them


 HTTP ERROR: 404

 No result defined for action com.neolivz.sandbox.action.IndexAction and 
 result invalid.token

 RequestURI=/WebSandbox/index.action
 Caused by:

 No result defined for action com.neolivz.sandbox.action.IndexAction and 
 result invalid.token - action - 
 file:/D:/Work/TWMS/WebSandbox/target/classes/struts.xml:12:71
at 
 com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:345)
at 
 com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
at 
 org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:50)
at 
 org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:507)
at 
 org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:421)
at 
 org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1065)
at 
 org.apache.struts2.dispatcher.ActionContextCleanUp.doFilter(ActionContextCleanUp.java:99)
at 
 org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1065)
at 
 org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:174)
at 
 org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:77)
at 
 org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1065)
at 
 org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:365)
at 
 org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:185)
at 
 org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
at 
 org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:689)
at 
 org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:391)
at 
 org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:146)
at 
 org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
at 
 org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
at org.mortbay.jetty.Server.handle(Server.java:285)
at 
 org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:457)
at 
 org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:751)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:500)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:209)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:357)
at 
 org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:329)
at 
 org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:475)

 Powered by Jetty://

 Regards,

 Jishnu Viswanath

 Software Engineer

 *(+9180)41190300 - 222(Ext) ll * ( + 91 ) 9731209330ll

 Tavant Technologies Inc.,

 www.tavant.com

 PEOPLE :: PASSION :: EXCELLENCE


 -Original Message-
 From: hernan gonzalez [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, October 29, 2008 7:04 PM
 To: Struts Users Mailing List
 Subject: Re: [S2]Multiple Form Submission

 http://struts.apache.org/2.0.11.2/docs/token-interceptor.html
 http://struts.apache.org/2.0.11.2/docs/token-session-interceptor.html
 http://www.planetstruts.org/struts2-showcase/token/index.jsp


 Hernán J. González
 http://hjg.com.ar/

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

 Any comments or statements made in this email are not necessarily those of 
 Tavant Technologies.
 The information transmitted is intended only for the person or entity to 
 which it is addressed and may
 contain confidential and/or privileged material. If you have received this in 
 error, please contact the
 sender and delete the material from any computer. All e-mails sent from or to 
 Tavant Technologies
 may be subject to our monitoring procedures

Re: [S2]Multiple Form Submission

2008-10-29 Thread hernan gonzalez
The s:token / should be in the jsp that creates the form that is
submitted to the action (not in the result jsp!), so that the action
can
check for its existence. And the stack with the token interceptor
should be applied only to that action/method.

Hernán J. González
http://hjg.com.ar/


On Wed, Oct 29, 2008 at 4:38 PM, Jishnu Viswanath
[EMAIL PROTECTED] wrote:
 Hi Wes,
I was not using s:token /
 But after your mail I just added that, and tried
 I have an empty jsp

 %@ taglib prefix=s uri=/struts-tags %
 %@ taglib prefix=t uri=/test %
 html
 head
titleIndex/title
s:head theme=ajax/

 /head
 body
s:token/
 /body
 /html

 This jsp is mapped in index.action

 In struts.xml I have the action mapped which refers to the following 
 interceptor stack
interceptor-stack name=paramsPrepare
interceptor-ref name=token-session/
interceptor-ref name=exception /
interceptor-ref name=alias /
interceptor-ref name=checkbox /
interceptor-ref name=params /
interceptor-ref name=servlet-config /
interceptor-ref name=prepare /
interceptor-ref name=conversionError /
/interceptor-stack

 And action map is like this
action name=index 
 class=com.neolivz.sandbox.action.IndexAction
interceptor-ref name=paramsPrepare/
result/jsp/index.jsp/result
/action

 And ;) it does work without the token-session interceptor :D

 Regards,

 Jishnu Viswanath

 Software Engineer

 *(+9180)41190300 - 222(Ext) ll * ( + 91 ) 9731209330ll

 Tavant Technologies Inc.,

 www.tavant.com

 PEOPLE :: PASSION :: EXCELLENCE


 -Original Message-
 From: Wes Wannemacher [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, October 29, 2008 11:47 PM
 To: Struts Users Mailing List
 Subject: Re: [S2]Multiple Form Submission

 Can you copy/paste some of your action/jsp/configuration code.

 Are you using the s:token / tag in your form?

 -Wes

 On Wed, Oct 29, 2008 at 2:09 PM, Jishnu Viswanath
 [EMAIL PROTECTED] wrote:
 Hi,
I read that part,
First thing I used token session interceptor, it says it will block 
 subsequent requests until the first request is complete, and then instead of 
 returning the invalid.token code
Second there was no double post,  none of my pages are loading when I 
 added this interceptor.

 Regards,

 Jishnu Viswanath

 Software Engineer

 *(+9180)41190300 - 222(Ext) ll * ( + 91 ) 9731209330ll

 Tavant Technologies Inc.,

 www.tavant.com

 PEOPLE :: PASSION :: EXCELLENCE


 -Original Message-
 From: hernan gonzalez [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, October 29, 2008 11:26 PM
 To: Struts Users Mailing List
 Subject: Re: [S2]Multiple Form Submission

 Take a look at the documentation. The  message is quite clear:

 No result defined for action com.neolivz.sandbox.action.IndexAction
 and result invalid.token

 The Tokeninterceptor  throw a special result  invalid.token when the
 token is invalid (what usually
 means a double submit). Hence, you should configure specify a jsp for
 that result in your action mapping
 (for that action, and/or globally).

 Take a look also to the token-session-interceptor.html which has a
 (perhaps) more interesting behaviuor.
 You might also buy the struts2 in action book.

 Regards

 Hernán J. González
 http://hjg.com.ar/



 On Wed, Oct 29, 2008 at 2:54 PM, Jishnu Viswanath
 [EMAIL PROTECTED] wrote:

 Hi,
Thanks for the reply but I tried it out but got this error.
 In my stack I added
interceptor-ref name=token-session/
 I have a list of interceptors stacks, I added to them


 HTTP ERROR: 404

 No result defined for action com.neolivz.sandbox.action.IndexAction and 
 result invalid.token

 RequestURI=/WebSandbox/index.action
 Caused by:

 No result defined for action com.neolivz.sandbox.action.IndexAction and 
 result invalid.token - action - 
 file:/D:/Work/TWMS/WebSandbox/target/classes/struts.xml:12:71
at 
 com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:345)
at 
 com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
at 
 org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:50)
at 
 org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:507)
at 
 org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:421)
at 
 org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1065)
at 
 org.apache.struts2.dispatcher.ActionContextCleanUp.doFilter(ActionContextCleanUp.java:99)
at 
 org.mortbay.jetty.servlet.ServletHandler

Re: [S2] actions responding only to POST/GET methods

2008-10-28 Thread hernan gonzalez
Don is right.
No security issue here (and absolutely nothing to do with PHP's
register_globals).
I see little use in trying to discriminate between GET and POST in the
action side,
at least not in relation with security.
Of course, you should never use GET when submitting a password, but that's a
privacy concern you (developer) just deal when writing your jsp. An hypothetical
convolved user can always try to go the same url using a GET, passing
the parameters
in the query string. But that would be a dumb user rather than a malicious one.
The action could deny the request if it is a GET, but that would be
little or no gain;
the harm the user can do (to himself; eg leaving his password in some
log) has already
been done.

Hernán


On Tue, Oct 28, 2008 at 11:27 AM, Don Brown [EMAIL PROTECTED] wrote:
 PHP's register_globals really has nothing to do with GET vs POST but
 rather with how it could be possible to inject variables into a script
 to compromise later evaulation.  Since Java doesn't allow such dynamic
 variables, there is no equivalent.

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



struts2 mailing list?

2008-10-23 Thread hernan gonzalez
Sorry if this has been discussed/answered before, but:

Wouldn't it be nice to split the mailing list, so that Struts2 has its own list?

Really, we all know that Struts2 and Struts1/Classic are very
different frameworks,
and the user interest in the messagges about s2 have, in all
probability, little interest
in the messages from s1, and viceversa.

Hernán J. González

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



s2: Simple 'show empty form' flow

2008-05-22 Thread hernan gonzalez
In any webapp the most typical and simple form flow involves two steps:
(from the serverside point of view)

1) show an empty form for the user to fill the fields
2) receive the data, validate ; if ok, process it and show response page;
if not, show the same previous form with error messages

In Struts2, the standard mapping could be (taken from Struts2 in action)

action name=Registration 
  result/Registration.jsp/result
/action
action name=Register class=manning.Register
  result/RegistrationSuccess.jsp/result
  result name=input/Registration.jsp/result
/action

Now, this does not seem very nice to me.
-Two mappings for such a simple case seems a little too much
-Duplication/coupling of the input jsp (Registration.jsp) in the two mappings
-Registration.jsp must specify the Register action name in its form tag

This might be simplified by using a single mapping (the second one), by
giving the action a little more intelligence: has the user submitted anything?
if not, this is just a request to show the input form; then, return
INPUT; elsewhere,
do as usual.
This can be done (the decision show the empty form might involve
asking if there
were any parameters, etc), but where ? I want to make that decision
even before the
validation takes places, so that the empty form does not show some
field X is required,
hence I guess it would be some interceptor's work.
But before trying to write it, I wanted to asked here if this scenario
has not been
considered, as it seems so common...

-- 
Hernán J. González
http://hjg.com.ar/

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



Re: Clean some characters in request parameters

2008-04-15 Thread hernan gonzalez
  There's nothing in Struts that will take care of this directly. Ideally
 your users should be able to enter whatever characters they want; I would be
 looking at how to get the database layer to cooperate, instead of imposing
 arbitrary input restrictions based on the current database configuration.
 That said, here are some ideas to consider that might help get this done:

  - to simply validate input and reject any that is outside the target
 character set, you could implement a custom validator;

  - to transliterate the input (performing character conversions to force the
 input into the target character set), you could implement a custom converter

  - to apply either strategy to *all* inputs for a particular action or set
 of actions, you would want to use an interceptor. I would guess you'd need
 to call actionInvocation.getActionContext().setParameters() with your
 'manipulated' request parameter data.


Good answer. Thanks.

Hernán

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



Clean some characters in request parameters

2008-04-14 Thread hernan gonzalez
Assume I have a lot of html forms with text inputs, and I want to
palce some restrictions for the set of allowed chars. Sort of a sanity
check, at the charset level.
For a concrete example, my storage (db) uses LATIN9 (iso-8859-15), and
the user sometimes can enter the non-allowed acute-accent (instead of
the intended-correct apostrophe). In this -and similar cases- I want
to detect it (replacing it with the good character, or throwing an
error). I wish to do it globally, not field by field... though not for
the entire application, but for a set of actions.
I was thinking of an interceptor that operates at the
HttpServletRequest level, before the ParametersInterceptor is applied
(I don't care if the http param corresponds to a String property), but
this does not seem very straightforward , as the HttpServletRequest
does not allow to manipulate the params.
Any suggestion or pointer?

Hernán

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



Clean some characters in request parameters

2008-04-14 Thread hernan gonzalez
Assume I have a lot of html forms with text inputs, and I want to
palce some restrictions for the set of allowed chars. Sort of a sanity
check, at the charset level.
For a concrete example, my storage (db) uses LATIN9 (iso-8859-15), and
the user sometimes can enter the non-allowed acute-accent (instead of
the intended-correct apostrophe). In this -and similar cases- I want
to detect it (replacing it with the good character, or throwing an
error). I wish to do it globally, not field by field... though not for
the entire application, but for a set of actions.
I was thinking of an interceptor that operates at the
HttpServletRequest level, before the ParametersInterceptor is applied
(I don't care if the http param corresponds to a String property), but
this does not seem very straightforward , as the HttpServletRequest
does not allow to manipulate the params.
Any suggestion or pointer?

Hernán

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



Re: s2: Including Freemarker templates from JSP

2008-03-31 Thread hernan gonzalez
Thanks.
It is indeed almost sufficient.

The docs had led to me think the params were the only way to pass
parameters to the template, but in fact it works as it should without
any parameters, seeking the values in the value stack.

That's fine.

The only inconvenience is the rigid scheme for specifying the file
path: ${templateDir}/${theme}/${template}. And it doesnt accept an
empty theme.

Hernán J. González
http://hjg.com.ar/


On Sun, Mar 30, 2008 at 7:40 PM, Jeromy Evans
[EMAIL PROTECTED] wrote:
 The Struts2 Component tag may be sufficient:
  http://struts.apache.org/2.x/docs/component.html



  hernan gonzalez wrote:
   I have some freemarker templates (general purpose, i.e. not
   specifically for struts2) that generate html fragments, which I would
   like to include in some jsp pages (in a struts2 environment).
  
   Which are my alternatives? At first I tought of making a general jsp
  
 jsp:include page=includeFreemarkerS2.jsp
  jsp:param name=templateName value=test/foo.ftl /
 /jsp:include
  
   where includeFreemarkerS2.jsp invokes (with Java scriptlet) my already
   working aplication logic that finds-parses-fills the template, getting
   the datamodel from the corresponding scope. But I am not sure of how
   to pass some datamodel that wraps the ValueStack to Freemarker. And I
   suspect there must be a simpler and nicer solution.
   Suggestions?
  
   Hernán
  
   -
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
  
  
  
  
  


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





--

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



Re: s2: Including Freemarker templates from JSP

2008-03-31 Thread hernan gonzalez
Thanks.
It is indeed almost sufficient.

The docs had led to me think the params were the only way to pass
parameters to the template, but in fact it works as it should without
any parameters, seeking the values in the value stack.

That's fine.

The only inconvenience is the rigid scheme for specifying the file
path: ${templateDir}/${theme}/${template}. And it doesnt accept an
empty theme.

Hernán J. González
http://hjg.com.ar/


On Sun, Mar 30, 2008 at 7:40 PM, Jeromy Evans
[EMAIL PROTECTED] wrote:
 The Struts2 Component tag may be sufficient:
  http://struts.apache.org/2.x/docs/component.html



  hernan gonzalez wrote:
   I have some freemarker templates (general purpose, i.e. not
   specifically for struts2) that generate html fragments, which I would
   like to include in some jsp pages (in a struts2 environment).
  
   Which are my alternatives? At first I tought of making a general jsp
  
 jsp:include page=includeFreemarkerS2.jsp
  jsp:param name=templateName value=test/foo.ftl /
 /jsp:include
  
   where includeFreemarkerS2.jsp invokes (with Java scriptlet) my already
   working aplication logic that finds-parses-fills the template, getting
   the datamodel from the corresponding scope. But I am not sure of how
   to pass some datamodel that wraps the ValueStack to Freemarker. And I
   suspect there must be a simpler and nicer solution.
   Suggestions?
  
   Hernán
  
   -
   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]



s2: Including Freemarker templates from JSP

2008-03-28 Thread hernan gonzalez
I have some freemarker templates (general purpose, i.e. not
specifically for struts2) that generate html fragments, which I would
like to include in some jsp pages (in a struts2 environment).

Which are my alternatives? At first I tought of making a general jsp

  jsp:include page=includeFreemarkerS2.jsp
   jsp:param name=templateName value=test/foo.ftl /
  /jsp:include

where includeFreemarkerS2.jsp invokes (with Java scriptlet) my already
working aplication logic that finds-parses-fills the template, getting
the datamodel from the corresponding scope. But I am not sure of how
to pass some datamodel that wraps the ValueStack to Freemarker. And I
suspect there must be a simpler and nicer solution.
Suggestions?

Hernán

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



Re: s2 : checkbox and checkboxlist : dynamic lists

2008-01-14 Thread hernan gonzalez
Does not work for me.
Does that work on struts 2.0.x ? Did you find documented somewhere ?
Some special interceptor o configuration ?

Hernán J. González

On Jan 11, 2008 4:23 PM, Rubbinio [EMAIL PROTECTED] wrote:

 Actually you can do something like this

 s:checkbox name=selectedGroup fieldValue=%{id}_%{nextCell.label} /

 And in the action class you can have:

 private String[] selectedGroup;

 Which will be populated back with what you have selected. It works fine in
 our application.
 --
 View this message in context: 
 http://www.nabble.com/s2-%3A-checkbox-and-checkboxlist-%3A-dynamic-lists-tp14760993p14762264.html
 Sent from the Struts - User mailing list archive at Nabble.com.


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





--

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



s2 : checkbox and checkboxlist : dynamic lists

2008-01-11 Thread hernan gonzalez
Disclaimer: I'm fairly new to Struts2, so I may me wrong. But:

I feel the behaviour of checkbox tag lacking. I dont think there is a
straighforward way to do a common web-application case: a form with a
dynamic list of N records (rows), each of which can be selected by
the user by a checkbox. (Example: a webmail). The UI checkbox tag of
struts does not seem to cope well with this.

I know of checkboxlist; but this does not seem the right answer.
checkboxlist is thought as a macro-input component, very similar to a
select box with multiple selection. That is, its idea is one checkbox
tag instance which loops over all the N set of selections. I know
there are some twists to adapt it to my situation (N instances of the
checkboxlist tag, each of which has a list of only one element). This
can be worked, but I feel it hacky/dirty, and has some limitations
(BTW: I found the checkboxlist tag somewhat impredecible; the valueKey
and valueList work inconsistently, the label is used even with the
simple theme, etc).

For my situacion, I believe, one should be able to use the checkbox
tag (after all, one is trying to output one checkbox , not a list).
And the original html specification copes ok with this, and it has
been done for ages in web programming. In fact, the present struts
implementation of the checkbox tag severly limits the usefullnes of
the fieldvalue attribute: practically only the true and false
values seems to be expected.

My question/proposal: the checkbox UI tag should accept (and expect)
to be backed (via the name attribute) not only to a Boolean field,
but also to a Collection. In this case, the parameter interceptor
would work similarly than for a multiple-select: add the value to the
collection, and check for its existence.
Is there some catch for this not being implemented in that way?


Hernán J. González
http://hjg.com.ar/

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



struts2: some action mapping clarificacions needed

2007-11-14 Thread hernan gonzalez
I have a wildcard mapping, say

  action name=CarCRUD_* method={1} class=myCarCRUAction

If I have a form
s:form action=CarCRUD_load...
which results in (html stripped)
form action=/Presentation/test/CarCRUD_load.do2
and inside I have some submit buttons which go to other methods (besides load)
I can accomplish that by using the method and action attrbiute of
the submit struts-tag,
eg
s:submit value=Borrar action=CarCRUD_delete   /   (case 1)
s:submit value=Do1 method=met1  /  (case 2)
This would invoke the delete() and met1() methods in my action class,
respectively.
The magic, as I see, is done by struts-tag by inserting the http parameters
   action:CarCRUD_delete=Borrar
   method:met1=Do1
respectively in the resultant request. But the url of the request is
still /myapp/CarCRUD_load.do2
Then...
Am I to deduce that Struts2, BEFORE going to the struts.xml file, when
it must determine
the action name, replaces the standard action according to the url
(ie. CarCRUD_load )
if it finds some action:xxx parameter (in the first case)  ?
(say: it assumes that the action name is CarCRUD_delete and from
them it continues
as usual) ?
And that, (in the second case),  AFTER having deterined the method
name according to the standard
rule ( CarCRUD_load ) , finds the matching action mapping in
struts.xml, BUT instead of applying the
pattern matching rule, as it finds some method:xxx parameter in the
request , uses that method ?
Is this so ?
Is there some place in the documentation to see this behaviour ?
Is there other way of setting the method name ? (eg: with a -fixed
named- parameter VALUE ) ?

Hernán

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