Java Mailing List Archive

http://www.gg3721.com/

Home » Struts Users Mailing List »

user Digest 16 Jul 2009 17:20:28 -0000 Issue 8755

user-digest-help

2009-07-16


Author LoginPost Reply

user Digest 16 Jul 2009 17:20:28 -0000 Issue 8755

Topics (messages 200780 through 200799):

Re: org.apache.jasper.JasperException: The Struts dispatcher cannot be found.
 200780 by: Lukasz Lenart
 200781 by: Lukasz Lenart
 200783 by: jayadevan
 200784 by: Lukasz Lenart
 200787 by: jayadevan
 200789 by: Martin Gainty

URL to underlying action
 200782 by: mathias-ewald
 200786 by: Nils-Helge Garli Hegvik

Re: Struts2 Action Class and EJB Injection
 200785 by: Martin Gainty

Re: how to configure struts2 for /*.action?
 200788 by: Struts Two

integer values in struts forms
 200790 by: Sandy.Verfaille.roularta.be

unit testing Struts2 application (with Spring and Hibernate)
 200791 by: Dimitrios Christodoulakis
 200794 by: Wes Wannemacher
 200796 by: Musachy Barroso
 200799 by: Greg Lindholm

Freemarker and Select Tag
 200792 by: Robin Mannering

Setter in action triggers twice. Bug?
 200793 by: Ritvars Rundzāns
 200795 by: Musachy Barroso

session on every request?
 200797 by: Mitch Claborn

disabling html:select and html:text by the value in another html:select
 200798 by: Odelya YomTov

Administrivia:

---------------------------------------------------------------------
To post to the list, e-mail: user@(protected)
To unsubscribe, e-mail: user-digest-unsubscribe@(protected)
For additional commands, e-mail: user-digest-help@(protected)

----------------------------------------------------------------------


Attachment: user_200780.ezm (zipped)
2009/7/16 jayadevan <jayadevan.m@(protected)>:
> my index.jsp like this

Is it the same file as in web.xml for welcome-file?

> where i place "struts-tags.xml " ?

It's already in struts2-*.jar


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

Joan Crawford - "I, Joan Crawford, I believe in the dollar.
Everything I earn, I spend." -
http://www.brainyquote.com/quotes/authors/j/joan_crawford.html


Attachment: user_200781.ezm (zipped)
2009/7/16 jayadevan <jayadevan.m@(protected)>:
> i tried both way
> directly
> and step by step

You should avoid directly accessing jsp files, always go through
actions. Especially when you are using Struts tags inside.


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

Ogden Nash - "The trouble with a kitten is that when it grows up,
it's always a cat." -
http://www.brainyquote.com/quotes/authors/o/ogden_nash.html


Attachment: user_200783.ezm (zipped)

hi

u said struts-tags.xml is already in struts2-*.jar
so add struts2-core.jar into class path and try to exccute

then i got the following exception

org.apache.jasper.JasperException: File "/struts-tags.tld" not found
 at
org.apache.jasper.compiler.DefaultErrorHandler.jspError (DefaultErrorHandler.java:51)
 at
org.apache.jasper.compiler.ErrorDispatcher.dispatch (ErrorDispatcher.java:409)
 at
org.apache.jasper.compiler.ErrorDispatcher.jspError (ErrorDispatcher.java:116)
 at
org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:160)
 at org.apache.jasper.compiler.Parser.parseTaglibDirective (Parser.java:420)
 at org.apache.jasper.compiler.Parser.parseDirective (Parser.java:476)
 at org.apache.jasper.compiler.Parser.parseElements (Parser.java:1426)
 at org.apache.jasper.compiler.Parser.parse (Parser.java:133)
 at
org.apache.jasper.compiler.ParserController.doParse (ParserController.java:216)
 at
org.apache.jasper.compiler.ParserController.parse (ParserController.java:103)
 at org.apache.jasper.compiler.Compiler.generateJava (Compiler.java:167)
 at org.apache.jasper.compiler.Compiler.compile (Compiler.java:306)
 at org.apache.jasper.compiler.Compiler.compile (Compiler.java:286)
 at org.apache.jasper.compiler.Compiler.compile (Compiler.java:273)
 at
org.apache.jasper.JspCompilationContext.compile (JspCompilationContext.java:566)
 at
org.apache.jasper.servlet.JspServletWrapper.service (JspServletWrapper.java:317)
 at org.apache.jasper.servlet.JspServlet.serviceJspFile (JspServlet.java:320)
 at org.apache.jasper.servlet.JspServlet.service (JspServlet.java:266)
 at javax.servlet.http.HttpServlet.service (HttpServlet.java:803)
 at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain.java:290)
 at
org.apache.catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain.java:206)
 at
org.apache.struts2.dispatcher.FilterDispatcher.doFilter (FilterDispatcher.java:413)
 at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain.java:235)
 at
org.apache.catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain.java:206)
 at
org.apache.catalina.core.StandardWrapperValve.invoke (StandardWrapperValve.java:233)
 at
org.apache.catalina.core.StandardContextValve.invoke (StandardContextValve.java:175)
 at
org.apache.catalina.core.StandardHostValve.invoke (StandardHostValve.java:128)
 at
org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:102)
 at
org.apache.catalina.core.StandardEngineValve.invoke (StandardEngineValve.java:109)
 at
org.apache.catalina.connector.CoyoteAdapter.service (CoyoteAdapter.java:263)
 at
org.apache.coyote.http11.Http11Processor.process (Http11Processor.java:844)
 at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
 at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
 at java.lang.Thread.run(Unknown Source)



Lukasz Lenart wrote:
>
> 2009/7/16 jayadevan <jayadevan.m@(protected)>:
>> my index.jsp like this
>
> Is it the same file as in web.xml for welcome-file?
>
>> where i place "struts-tags.xml " ?
>
> It's already in struts2-*.jar
>
>
> Regards
> --
> Lukasz
> http://www.lenart.org.pl/
> http://dailylog.lenart.org.pl/
>
> Joan Crawford - "I, Joan Crawford, I believe in the dollar.
> Everything I earn, I spend." -
> http://www.brainyquote.com/quotes/authors/j/joan_crawford.html
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
>

--
Sent from the Struts - User mailing list archive at Nabble.com.



Attachment: user_200784.ezm (zipped)
2009/7/16 jayadevan <jayadevan.m@(protected)>:
> u said struts-tags.xml is  already in struts2-*.jar
> so add struts2-core.jar into class path and try to exccute
>
> then i got the following exception
>
> org.apache.jasper.JasperException: File "/struts-tags.tld" not found

struts-tags.tld is for sure in struts2-core.jar, could list what other
libs do you have in WEB-INF/lib of that application?


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

Stephen Leacock - "I detest life-insurance agents: they always argue
that I shall some day die, which is not so." -
http://www.brainyquote.com/quotes/authors/s/stephen_leacock.html


Attachment: user_200787.ezm (zipped)

hi

xwork-2.0.4.jar,
ognl-2.6.11.jar,
jsp-api-2.0.jar,freemarker-2.3.8.jar,
commons-logging-1.0.4.jar
these are other jars

Lukasz Lenart wrote:
>
> 2009/7/16 jayadevan <jayadevan.m@(protected)>:
>> u said struts-tags.xml is  already in struts2-*.jar
>> so add struts2-core.jar into class path and try to exccute
>>
>> then i got the following exception
>>
>> org.apache.jasper.JasperException: File "/struts-tags.tld" not found
>
> struts-tags.tld is for sure in struts2-core.jar, could list what other
> libs do you have in WEB-INF/lib of that application?
>
>
> Regards
> --
> Lukasz
> http://www.lenart.org.pl/
> http://dailylog.lenart.org.pl/
>
> Stephen Leacock - "I detest life-insurance agents: they always argue
> that I shall some day die, which is not so." -
> http://www.brainyquote.com/quotes/authors/s/stephen_leacock.html
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
>

--
Sent from the Struts - User mailing list archive at Nabble.com.



Attachment: user_200789.ezm (zipped)

struts needs to map url requests to FilterDispatcher
your WEB-INF/web.xml should have filter configured and mapped as:
  <filter>
    <filter-name>struts</filter-name>
    <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
    <init-param>
       <param-name>actionPackages</param-name>
       <param-value>your.action.package</param-value>
    </init-param>
    <init-param>
       <param-name>templateDir</param-name>
       <param-value>template</param-value>
    </init-param>      
    <init-param>
       <param-name>theme</param-name>
       <param-value>simple</param-value>
    </init-param>  
    <init-param>
       <param-name>org.apache.catalina.jsp_file</param-name>
       <param-value>index.jsp</param-value>
    </init-param>
  </filter>

  <filter-mapping>
    <filter-name>struts</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>

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

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.
> Date: Wed, 15 Jul 2009 22:56:22 -0700
> From: jayadevan.m@(protected)
> To: user@(protected)
> Subject: org.apache.jasper.JasperException: The Struts dispatcher cannot be found.
>
>
> hi all
>
> i am using struts2 for my pjt
>
> when i try to excute pjt the following exception occured
>
> pls help me
>
> thanks in advance
>
>
>
> org.apache.jasper.JasperException: The Struts dispatcher cannot be found.
> This is usually caused by using Struts tags without the associated filter.
> Struts tags are only usable when the request has passed through its servlet
> filter, which initializes the Struts dispatcher needed for this tag. -
> [unknown location]
>
> org.apache.jasper.servlet.JspServletWrapper.handleJspException (JspServletWrapper.java:541)
>
> org.apache.jasper.servlet.JspServletWrapper.service (JspServletWrapper.java:435)
>  org.apache.jasper.servlet.JspServlet.serviceJspFile (JspServlet.java:320)
>  org.apache.jasper.servlet.JspServlet.service (JspServlet.java:266)
>  javax.servlet.http.HttpServlet.service (HttpServlet.java:803)
>
>
> root cause
>
> The Struts dispatcher cannot be found. This is usually caused by using
> Struts tags without the associated filter. Struts tags are only usable when
> the request has passed through its servlet filter, which initializes the
> Struts dispatcher needed for this tag. - [unknown location]
>  org.apache.struts2.views.jsp.TagUtils.getStack (TagUtils.java:60)
>
> 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_005fform_005f0 (index_jsp.java:99)
>  org.apache.jsp.index_jsp._jspService (index_jsp.java:72)
>  org.apache.jasper.runtime.HttpJspBase.service (HttpJspBase.java:70)
>  javax.servlet.http.HttpServlet.service (HttpServlet.java:803)
>
> org.apache.jasper.servlet.JspServletWrapper.service (JspServletWrapper.java:393)
>  org.apache.jasper.servlet.JspServlet.serviceJspFile (JspServlet.java:320)
>  org.apache.jasper.servlet.JspServlet.service (JspServlet.java:266)
>  javax.servlet.http.HttpServlet.service (HttpServlet.java:803)
>
>
> --
> View this message in context: http://www.nabble.com/org.apache.jasper.JasperException%3A-The-Struts-dispatcher-cannot-be-found.-tp24510546p24510546.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>

_________________________________________________________________
Hotmail® has ever-growing storage! Don’t worry about storage limits.
http://windowslive.com/Tutorial/Hotmail/Storage?ocid=TXT_TAGLM_WL_HM_Tutorial_Storage_062009

Attachment: user_200782.ezm (zipped)

Hi,

is there a way to create a URL (like <s:url>) to the Action that called a
JSP file? I would like to reuse some code like forms and other stuff

cu
mathias
--
Sent from the Struts - User mailing list archive at Nabble.com.



Attachment: user_200786.ezm (zipped)
Try using the url tag without specifying value or action.

Nils-H

Den 16. juli. 2009 kl. 13.14 skrev mathias-ewald <nitehoaxxer@(protected)>:

>
> Hi,
>
> is there a way to create a URL (like <s:url>) to the Action that
> called a
> JSP file? I would like to reuse some code like forms and other stuff
>
> cu
> mathias
> --
> View this message in context: http://www.nabble.com/URL-to-underlying-action-tp24514500p24514500.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>


Attachment: user_200785.ezm (zipped)

ive used OpenEJB with TC
then again you could deploy your EAR to a true EJB3 container with a J2EE-AppServer such as GF, WL or AMSServer..even resin would handle EJBs
?
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: Thu, 16 Jul 2009 07:16:14 +0200
> From: robin@(protected)
> To: user@(protected)
> Subject: Re: Struts2 Action Class and EJB Injection
>
> Thanks for the example. I shall download the source and give it a go.
>
> Thanks again.
>
> Nathan Schulte wrote:
> > Robin Mannering <robin <at> mtndesigns.co.uk> writes:
> >  
> >> Can you please tell me how you obtained the EJB plugin and a short
> >> example of using it.
> >>
> >> I would prefer to use this if possible.
> >>  
> >
> > Sorr, I misspoke earlier. I'm actually using the EJB3 JBoss Plugin, from here
> > http://cwiki.apache.org/S2PLUGINS/ejb3-jboss-plugin.html.
> >
> > However, browsing the source for the EJB3 Plugin, the annotations and even
> > classes are named the same, so the following example should still apply;
> > http://pastebin.com/f7053a2bc.
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@(protected)
> > For additional commands, e-mail: user-help@(protected)
> >  
> > ------------------------------------------------------------------------
> >
> >
> > No virus found in this incoming message.
> > Checked by AVG - www.avg.com
> > Version: 8.5.387 / Virus Database: 270.13.14/2238 - Release Date: 07/14/09 18:03:00
> >
> >  

_________________________________________________________________
Windows Live™ SkyDrive™: Get 25 GB of free online storage.
http://windowslive.com/online/skydrive?ocid=TXT_TAGLM_WL_SD_25GB_062009

Attachment: user_200788.ezm (zipped)

Let's say you have /*.action as your filter URL and you have Websphere application server and IBM Http server as your webserver. Once you try to generate your plugin file for http server, *.action is not picked up by WAS as filter are ignored [since they are not supposed be accessed directly for resource as specified by spec]. To make the long story short, all your requests for *.action would fail.

To fix the issue, you may want to create a dummuy servlet and have *.action as servlet URL. This also would work for any other appserver that may face a similar issue.

--- On Thu, 7/16/09, ravi_eze <ravichandrac@(protected):

> From: ravi_eze <ravichandrac@(protected)>
> Subject: RE: how to configure struts2 for /*.action?
> To: user@(protected)
> Received: Thursday, July 16, 2009, 6:04 AM
>
> hi,
>
> can you give some exampels for which u had to put hacks? We
> will test those
> parts explicitly.
>
> --
> ravi
> --
> View this message in context: http://www.nabble.com/how-to-configure-struts2-for--*.action--tp24481000p24510603.html
> Sent from the Struts - User mailing list archive at
> Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>


   __________________________________________________________________
Make your browsing faster, safer, and easier with the new Internet Explorer® 8. Optimized for Yahoo! Get it Now for Free! at http://downloads.yahoo.com/ca/internetexplorer/


Attachment: user_200790.ezm (zipped)
Hi,

I have made a struts form:
<s:form action="addProduct" method="POST" >
Name nl<s:textfield name="productNameNl" />
price: <s:textfield name="productPrice" value=""/>
</s:form>

and the mapped actionclassmethod addProduct with:

public String addProduct(){
Product p = new Product(productNameNl, productPrice);
ProductDA.getInstance().addProduct(p);
return SUCCESS;
}

public void setProductNameNl(String productNameNl) {
this.productNameNl = productNameNl;
}

public String getProductNameNl() {
return productNameNl;
}

public void setProductPrice(double productPrice) {
this.productPrice = productPrice;
}

public double getProductPrice() {
return productPrice;
}



When I run my jsp with that form, everything goes well when I enter for
example 3 or 5 in the pricebox.

But when I enter 0 (not the letter O, but zero), 0,0 or a letter i get
the error message:

/-- Encapsulated exception ------------\

java.lang.NoSuchMethodException: setProductPrice([Ljava.lang.String;)



Why doesn't it recognize a zero as a double, but as a string?

I think with a validation xml the problem with the letters will be
solved?



Any help would be appreciated!



Thx,

Sandy


Attachment: user_200791.ezm (zipped)
Hello,

I was hoping to hear the community's views about unit testing a
Struts2 application which is integrated with Spring and Hibernate. My
plan is to unit test the actions with the framework's interceptors
running, rather than each action class in a stand-alone isolated
fashion.

What approach do you usually follow? A highly regarded article:
http://depressedprogrammer.wordpress.com/2007/06/18/unit-testing-struts-2-actions-spring-junit/
provides some useful hints and starting points.

I would like to use Junit 4 with Ant for this. Are there any other
resources, or documented steps to take as far as you know, or
recommend?

I found quite a few bits and pieces searching online, but would
appreciate any general guidance or advice on how to begin with this.

Many thanks and regards.


Attachment: user_200794.ezm (zipped)
I have a few thoughts on this, but I am somewhat opinionated when it
comes to unit testing. Personally, I don't think it's necessary to
test your actions with the interceptors. If you want to make sure that
your actions fit into the struts flow of things, then unit testing is
probably not the right place to do it. Personally, I would suggest
that you check out selenium. In my (somewhat convoluted) opinion,
tests should be thought of as one of two possible types... unit and
integration tests. If you are unit testing, you should have created a
small enough unit of work in your code that you can whip up a unit
test that simply makes sure that your unit is doing what you intended
it to do. In my opinion, unit testing isn't about creating a
comprehensive set of tests that validates every possible scenario that
could ever happen, it's simply about showing that through the course
of development, you haven't made a change or introduced a bug through
some external dependency. On the other hand, integration testing is
important as well, but you shouldn't try to recreate your whole
platform in JUnit, that's just creating a situation where maintaining
your JUnit housekeeping code is just as much of a pain as writing your
application code. If you want to integration test, then have a system
set aside where you can deploy your app, then create a suite of
selenium tests that will go through the user flows that you expect to
work. The nice thing about this sort of setup is that you are
exercising the framework, by using the framework, not by trying to
recreate and maintain it.

Did I mention that this is just my opinion? :)

-Wes

On Thu, Jul 16, 2009 at 10:43 AM, Dimitrios
Christodoulakis<dimi.chr@(protected):
> Hello,
>
> I was hoping to hear the community's views about unit testing a
> Struts2 application which is integrated with Spring and Hibernate. My
> plan is to unit test the actions with the framework's interceptors
> running, rather than each action class in a stand-alone isolated
> fashion.
>
> What approach do you usually follow? A highly regarded article:
> http://depressedprogrammer.wordpress.com/2007/06/18/unit-testing-struts-2-actions-spring-junit/
> provides some useful hints and starting points.
>
> I would like to use Junit 4 with Ant for this. Are there any other
> resources, or documented steps to take as far as you know, or
> recommend?
>
> I found quite a few bits and pieces searching online, but would
> appreciate any general guidance or advice on how to begin with this.
>
> Many thanks and regards.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>



--
Wes Wannemacher
Author - Struts 2 In Practice
Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more
http://www.manning.com/wannemacher


Attachment: user_200796.ezm (zipped)
+1 for what Wes said. Plus, I would say, the junits become so complex
(when you do integration test from them), that from my experience,
when they break, people don't want to fix them (because we have to
admit, we are lazy).

musachy

On Thu, Jul 16, 2009 at 8:28 AM, Wes Wannemacher<wesw@(protected):
> I have a few thoughts on this, but I am somewhat opinionated when it
> comes to unit testing. Personally, I don't think it's necessary to
> test your actions with the interceptors. If you want to make sure that
> your actions fit into the struts flow of things, then unit testing is
> probably not the right place to do it. Personally, I would suggest
> that you check out selenium. In my (somewhat convoluted) opinion,
> tests should be thought of as one of two possible types... unit and
> integration tests. If you are unit testing, you should have created a
> small enough unit of work in your code that you can whip up a unit
> test that simply makes sure that your unit is doing what you intended
> it to do. In my opinion, unit testing isn't about creating a
> comprehensive set of tests that validates every possible scenario that
> could ever happen, it's simply about showing that through the course
> of development, you haven't made a change or introduced a bug through
> some external dependency. On the other hand, integration testing is
> important as well, but you shouldn't try to recreate your whole
> platform in JUnit, that's just creating a situation where maintaining
> your JUnit housekeeping code is just as much of a pain as writing your
> application code. If you want to integration test, then have a system
> set aside where you can deploy your app, then create a suite of
> selenium tests that will go through the user flows that you expect to
> work. The nice thing about this sort of setup is that you are
> exercising the framework, by using the framework, not by trying to
> recreate and maintain it.
>
> Did I mention that this is just my opinion? :)
>
> -Wes
>
> On Thu, Jul 16, 2009 at 10:43 AM, Dimitrios
> Christodoulakis<dimi.chr@(protected):
>> Hello,
>>
>> I was hoping to hear the community's views about unit testing a
>> Struts2 application which is integrated with Spring and Hibernate. My
>> plan is to unit test the actions with the framework's interceptors
>> running, rather than each action class in a stand-alone isolated
>> fashion.
>>
>> What approach do you usually follow? A highly regarded article:
>> http://depressedprogrammer.wordpress.com/2007/06/18/unit-testing-struts-2-actions-spring-junit/
>> provides some useful hints and starting points.
>>
>> I would like to use Junit 4 with Ant for this. Are there any other
>> resources, or documented steps to take as far as you know, or
>> recommend?
>>
>> I found quite a few bits and pieces searching online, but would
>> appreciate any general guidance or advice on how to begin with this.
>>
>> Many thanks and regards.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>> For additional commands, e-mail: user-help@(protected)
>>
>>
>
>
>
> --
> Wes Wannemacher
> Author - Struts 2 In Practice
> Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more
> http://www.manning.com/wannemacher
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>



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


Attachment: user_200799.ezm (zipped)
Well everyone has an opinion so here mine:

I want to unit test my Struts actions in the full Struts context which
includes the interceptor stack and validation. This way I know my actions
and results are configured correctly since I test them. I also know my
declarative validations are working correctly. I use junit and I really
don't want or have time to have to learn another test tool for integration
testing.

So to do this type of testing I wrote a StrutsTestContext class to run my
actions.
For full info see:
http://glindholm.wordpress.com/2008/06/30/unit-testing-struts-2-actions/

I don't use Spring so this class would need to be tweaked for Spring but you
are welcome to use this as a starting point.

This gives me a lot of flexibility for testing, sometimes I test against an
actual database (with hibernate) and sometimes I mock the services that the
actions use.



On Thu, Jul 16, 2009 at 10:43 AM, Dimitrios Christodoulakis <
dimi.chr@(protected):

> Hello,
>
> I was hoping to hear the community's views about unit testing a
> Struts2 application which is integrated with Spring and Hibernate. My
> plan is to unit test the actions with the framework's interceptors
> running, rather than each action class in a stand-alone isolated
> fashion.
>
> What approach do you usually follow? A highly regarded article:
>
> http://depressedprogrammer.wordpress.com/2007/06/18/unit-testing-struts-2-actions-spring-junit/
> provides some useful hints and starting points.
>
> I would like to use Junit 4 with Ant for this. Are there any other
> resources, or documented steps to take as far as you know, or
> recommend?
>
> I found quite a few bits and pieces searching online, but would
> appreciate any general guidance or advice on how to begin with this.
>
> Many thanks and regards.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

Attachment: user_200792.ezm (zipped)
Hello,

Platform : Struts 2, EJB 3.0, Glassfish 2.1

I'm having trouble using the Freemarker equivalent of the JSP Struts 2
Select Tag.

I need to convert:

<s:select list="application.userTypes" />

into the Freemarker equivalent.

userTypes is an application defined attribute. I have checked the
existence of the attribute within the page and it is shown as expected.

My List/Map is defined as

    Map<Integer, String> userTypes = new HashMap<Integer, String>();
    userTypes.put(1, "AGENCY_USER");
    userTypes.put(2, "SHOP_USER");
    userTypes.put(3, "TOUR_OPERATOR_USER");

I have tried the following, none of which work (or work correclty).

<@(protected)
the select box, but are valued as 1=AGENCY_USER, 2=SHOP_USER

The following produce empty select boxes (or errors)

<@(protected)"/>

<@(protected)}"/>

Does anybody have any ideas ?

Thanks




Attachment: user_200793.ezm (zipped)
Hi!

I am wondering, why setters for cmd and id fields @ my Person action (see
below) is called twice. For example, when browser requests
/person-aaa-bbb?dum=ccc , this gets stdout-ed :

example.Person@(protected)
setCmd ]aaa[
setId ]bbb[
setCmd ]aaa[
setDum ]ccc[
setId ]bbb[
execute

I know setter is just a setter, but this thing is really annoying me :) -
definately this kind of behaviour is undesirable. Any thoughts?

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

<struts>

  <constant name="struts.enable.DynamicMethodInvocation" value="false" />
  <constant name="struts.devMode" value="false" />

  <package name="default" namespace="/" extends="struts-default">

    <action name="person-*-*" class="example.Person">
       <param name="cmd">{1}</param>
       <param name="id">{2}</param>

       <result>jsp/abc.jsp</result>
    </action>

    <action name="index">

       <result type="redirectAction">
          <param name="actionName">HelloWorld</param>
          <param name="namespace">/example</param>
       </result>

    </action>

  </package>

</struts>
< --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
--- ---


Action:
--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
--- >
package example;

import com.opensymphony.xwork2.ActionSupport;

@SuppressWarnings("serial")
public class Person extends ActionSupport {
  //
  private String cmd;
  private String id;
  private String dum;
  //

  public String execute() throws Exception {
    System.out.println( "execute" );
    return SUCCESS;
  }

  public Person() {
    System.out.println( this + " " + this.hashCode() );
  }

  //
  public String getCmd() {
    return cmd;
  }

  public void setCmd(String cmd) {
    System.out.println( "setCmd ]" + cmd + "[" );
    this.cmd = cmd;
  }

  public String getId() {
    return id;
  }

  public void setId(String id) {
    System.out.println( "setId ]" + id+ "[" );
    this.id = id;
  }

  public String getDum() {
    return dum;
  }

  public void setDum(String dum) {
    System.out.println( "setDum ]" + dum+ "[" );
    this.dum = dum;
  }

}

< --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
--- ---

I uploaded war, so you can see this mystic stuff for yourself:

With no jars (grab them from struts2-blank app), 4kb:
http://maiss.02.lv/faili/batman/s2test_nolibs.war
Working version, 4mb: http://maiss.02.lv/faili/batman/s2test.war

Attachment: user_200795.ezm (zipped)
can you put a breakpoint in the setter and see where is it called
from? (both times)

musachy

On Thu, Jul 16, 2009 at 8:08 AM, Ritvars Rundzāns<rrundzans@(protected):
> Hi!
>
> I am wondering, why setters for cmd and id fields @ my Person action (see
> below) is called twice. For example, when browser requests
> /person-aaa-bbb?dum=ccc , this gets stdout-ed :
>
> example.Person@(protected)
> setCmd ]aaa[
> setId ]bbb[
> setCmd ]aaa[
> setDum ]ccc[
> setId ]bbb[
> execute
>
> I know setter is just a setter, but this thing is really annoying me :) -
> definately this kind of behaviour is undesirable. Any thoughts?
>
> struts.xml:
> --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
> --- >
> <?xml version="1.0" encoding="UTF-8" ?>
> <!DOCTYPE struts PUBLIC
>    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
>    "http://struts.apache.org/dtds/struts-2.0.dtd">
>
> <struts>
>
>    <constant name="struts.enable.DynamicMethodInvocation" value="false" />
>    <constant name="struts.devMode" value="false" />
>
>    <package name="default" namespace="/" extends="struts-default">
>
>        <action name="person-*-*" class="example.Person">
>            <param name="cmd">{1}</param>
>            <param name="id">{2}</param>
>
>            <result>jsp/abc.jsp</result>
>        </action>
>
>        <action name="index">
>
>            <result type="redirectAction">
>                <param name="actionName">HelloWorld</param>
>                <param name="namespace">/example</param>
>            </result>
>
>        </action>
>
>    </package>
>
> </struts>
> < --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
> --- ---
>
>
> Action:
> --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
> --- >
> package example;
>
> import com.opensymphony.xwork2.ActionSupport;
>
> @SuppressWarnings("serial")
> public class Person extends ActionSupport {
>    //
>    private String cmd;
>    private String id;
>    private String dum;
>    //
>
>    public String execute() throws Exception {
>        System.out.println( "execute" );
>        return SUCCESS;
>    }
>
>    public Person() {
>        System.out.println( this + " " + this.hashCode() );
>    }
>
>    //
>    public String getCmd() {
>        return cmd;
>    }
>
>    public void setCmd(String cmd) {
>        System.out.println( "setCmd ]" + cmd + "[" );
>        this.cmd = cmd;
>    }
>
>    public String getId() {
>        return id;
>    }
>
>    public void setId(String id) {
>        System.out.println( "setId ]" + id+ "[" );
>        this.id = id;
>    }
>
>    public String getDum() {
>        return dum;
>    }
>
>    public void setDum(String dum) {
>        System.out.println( "setDum ]" + dum+ "[" );
>        this.dum = dum;
>    }
>
> }
>
> < --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
> --- ---
>
> I uploaded war, so you can see this mystic stuff for yourself:
>
> With no jars (grab them from struts2-blank app), 4kb:
> http://maiss.02.lv/faili/batman/s2test_nolibs.war
> Working version, 4mb: http://maiss.02.lv/faili/batman/s2test.war
>



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


Attachment: user_200797.ezm (zipped)
It appears that every request through struts is getting a copy of the
Session object, even for those that don't need it, like static resources
(.js, .css, etc). Can I disable this behavior somehow, only getting the
session when I need it? Below is a sample stack trace.

    at
org.apache.catalina.session.PersistentManagerBase.swapIn (PersistentManagerBase.java:791)
    at
org.apache.catalina.session.PersistentManagerBase.findSession (PersistentManagerBase.java:614)
    at
org.apache.catalina.connector.Request.doGetSession (Request.java:2295)
    at
org.apache.catalina.connector.Request.getSession (Request.java:2074)
    at
org.apache.catalina.connector.RequestFacade.getSession (RequestFacade.java:833)
    at
org.apache.struts2.dispatcher.SessionMap.<init>(SessionMap.java:62)
    at
org.apache.struts2.dispatcher.Dispatcher.createContextMap (Dispatcher.java:510)
    at
org.apache.struts2.dispatcher.ng.PrepareOperations.createActionContext(PrepareOperations.java:75)
    at
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:65)
    at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain.java:235)
    at
org.apache.catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain.java:206)
    at
org.apache.catalina.core.StandardWrapperValve.invoke (StandardWrapperValve.java:233)
    at
org.apache.catalina.core.StandardContextValve.invoke (StandardContextValve.java:191)
    at
org.apache.catalina.core.StandardHostValve.invoke (StandardHostValve.java:128)
    at
org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:102)
    at
org.apache.catalina.valves.AccessLogValve.invoke (AccessLogValve.java:567)
    at
org.apache.catalina.core.StandardEngineValve.invoke (StandardEngineValve.java:109)
    at
org.apache.catalina.connector.CoyoteAdapter.service (CoyoteAdapter.java:293)
    at
org.apache.coyote.http11.Http11Processor.process (Http11Processor.java:849)
    at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
    at
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
    at java.lang.Thread.run (Thread.java:636)




Mitch



Attachment: user_200798.ezm (zipped)
Hi!
i have these components:

<html:select name="orderBean" property="data.payingType"
onchange="javascript:disable();">
 <html:options name="orderBean" property="payingTypes" />
</html:select>
<html:select name="orderBean" property="data.payments">
  <html:options name="orderBean" property="paymentsList" />
</html:select>
<html:text maxlength="25" size="15" name="orderBean"
property="data.billToName" />

i would like that when the user chooses a specific value in data.payingType
- it would disable/enable the other html:select and html:text.
i wrote this function:

<script type="text/javascript">
function disable(){
 var sel = document.getElementsByName('data.billToName')[0];
 sel.options[sel.selectedIndex].value;

 alert(sel);
}

<script>

but i get an error:
sel.selectedIndex is undefined.
how can i do it please?

Thanks!



©2008 gg3721.com - Jax Systems, LLC, U.S.A.