Java Mailing List Archive

http://www.gg3721.com/

Home » Struts Users Mailing List »

user Digest 5 Aug 2010 21:04:26 -0000 Issue 9140

user-digest-help

2010-08-05


Author LoginPost Reply

user Digest 5 Aug 2010 21:04:26 -0000 Issue 9140

Topics (messages 207141 through 207147):

Re: Unit Testing in Struts 2.1.6
 207141 by: akash uppal
 207142 by: Cimballi

Clear ThreadLocal of ActionContext
 207143 by: Franz Wong

Re: XML error reading definitions
 207144 by: sivakrishna.komma

Struts2 Modifying An arraylist of objects
 207145 by: Rohit

FileUpload null file for large files?
 207146 by: Ozu Natsu

Struts2+json question
 207147 by: red phoenix

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_207141.ezm (zipped)



Dan - Is your Struts 2 application using Spring? If it isn't you shouldn't
need to use the StrutsSprintTestCase (but then I don't know why you would
get the error you did).

If you are using Spring then I don't have any good advice for you as I've
not used the JUnit plugin much with a Struts 2 - Spring application.

Bruce


dolsen wrote:
>
> When I follow the web site
> http://www.brucephillips.name/blog/index.cfm/2009/9/5/Unit-Testing-A-Struts-2-Action-Class--Struts-2-JUnit-Plugin
> I get the following error when trying to run my test case. I then try to
> extend StrutsSpringTestCase and I get a different error. Below is my code
> the two different errors I get.
>
>
>

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



Attachment: user_207142.ezm (zipped)
You can try this :
http://cimballisblog.blogspot.com/2009/09/unit-testing-struts2-actions-with.html

Cimballi


On Tue, Aug 3, 2010 at 3:01 PM, akash uppal <er.akashak@(protected):
>
>
>
> Dan - Is your Struts 2 application using Spring?  If it isn't you shouldn't
> need to use the StrutsSprintTestCase (but then I don't know why you would
> get the error you did).
>
> If you are using Spring then I don't have any good advice for you as I've
> not used the JUnit plugin much with a Struts 2 - Spring application.
>
> Bruce
>
>
> dolsen wrote:
>>
>> When I follow the web site
>> http://www.brucephillips.name/blog/index.cfm/2009/9/5/Unit-Testing-A-Struts-2-Action-Class--Struts-2-JUnit-Plugin
>> I get the following error when trying to run my test case. I then try to
>> extend StrutsSpringTestCase and I get a different error. Below is my code
>> the two different errors I get.
>>
>>
>>
>
> --
> View this message in context: http://old.nabble.com/Unit-Testing-in-Struts-2.1.6-tp25881838p29339523.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)
>
>



--
Cimballi
JAVA J2EE Freelance
http://javajeeleader.elance.com/


Attachment: user_207143.ezm (zipped)
Hi,

I would like to ask is there any mechanism clearing ThreadLocal of
ActionContext by struts? As I know, there are some issues when ThreadLocal
is used with thread pool.

Reference :
http://weblogs.java.net/blog/jjviana/archive/2010/06/09/dealing-glassfish-301-memory-leak-or-threadlocal-thread-pool-bad-ide

Thanks
Franz

Attachment: user_207144.ezm (zipped)


Hi,

This is Siva Krishna. I have also got the same problem. But i have been
facing this problem in IE7 only.

I used Tomcat5, struts2.0.11 jar file. Would you tell me how did u solve
this problem? Its very important and urgent.

Thanks in advance.












jondcruz wrote:
>
> Hello,
>
> I've posted this question on the Webwork forums, and thought that maybe
> the Struts2 community could help. I've integrated Tiles into my WW
> application, and am seeing an error that I can't seem to track down. I've
> combed the various WW and S2 forums and can't find anything specific to my
> error.
>
> First, some env info:
>
> *** Tomcat 4.1.31
> *** Occurs in FireFox 1.5 and IE 6.0
> *** WW 2.2.5 (last release before being officially merged into S2 I
> believe)
> *** Using the JARs for WW 2.2.5 for all other dependencies (rife, ognl,
> etc)
> *** Two machines being used for testing on WinXP boxes.
>
> *** I'm doing some *very* basic load testing on a WW app I'm creating.
>
> *** Basically I have two machines viewing the same webpage and I'm hitting
> the F5 key to refresh the screen. The webpage does a few basic DB hits,
> (part of what I'm testing).  Eventually I plan to use JMeter to test it
> more thoroughly...
>
> *** If I alternate F5 presses, everything is okay.
> *** If I hit F5 on each machine at roughly the same time,
>
> I get the following exeption:
>
> javax.servlet.ServletException: XML error reading definitions.
> at
> com.opensymphony.webwork.dispatcher.DispatcherUtils.serviceAction(DispatcherUti
> ls.java:236)
> at
> com.opensymphony.webwork.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.
> java:202)
> at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFil
> terChain.java:166)
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain
> .java:146)
> at
> org.apache.catalina.core.StandardWrapperValve.invoke (StandardWrapperValve.java:
> 209)
> ...
> ...
>
> With the Root Cause:
>
> org.apache.tiles.DefinitionsFactoryException: XML error reading
> definitions.
> at
> org.apache.tiles.digester.DigesterDefinitionsReader.read(DigesterDefinitionsRea
> der.java:156)
> at
> org.apache.tiles.definition.UrlDefinitionsFactory.readDefinitions(UrlDefinition
> sFactory.java:220)
> at
> com.opensymphony.webwork.views.tiles.TilesResult.getComponentDefinition(TilesRe
> sult.java:137)
> at
> com.opensymphony.webwork.views.tiles.TilesResult.doExecute (TilesResult.java:91)
> ...
> ...
>
> *** If I take Tiles out of the picture, this exception goes away.
>
> I've truncated the logs, figuring the first 10 or so lines would be the
> most important.  In particular I'm curious about what
> "org.apache.tiles.digester.DigesterDefinitionsReader" does to cause the
> expection...
>
> I can send/attach the full log error and exception if necessary.
>
> Anyone seen this particular exception before?
>
> Thanks.
>

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



Attachment: user_207145.ezm (zipped)
Hi,



I have an object in my Action class which contains an arraylist of objects
internally, I am trying to create a CRUD screen for this object. My Action
Class and bean are given below,



  /**

* @author rohit

*

*/

public class IRFeedMgmtAction extends ActionSupport implements
ModelDriven<IRFeeds>,SessionAware,ServletRequestAware

{

          private static org.apache.log4j.Logger log =
Logger.getLogger(IRFeedMgmtAction.class);



          private HttpServletRequest request;

         

          private Map session;

         

          private IRAccountsDAO acctsDAO;

         

          private IRFeeds feed = new IRFeeds();

         

          /* (non-Javadoc)

          * @see com.opensymphony.xwork2.ActionSupport#execute()

          */

          public String execute()

          {

                    return "success";

          }

         

          /**

          * @return

          */

          public String add()

          {

                    IRUser user = (IRUser) session.get("user");

                   

                    List<IRAccountUsers> twtUsers =
acctsDAO.getTwitterAcctByOrgId(user.getOrgId());


feed.setTwtAccts(prepareTwitterAccounts(twtUsers));

                   

                    return "addFeed";

          }

         

          /**

          * @return

          */

          public String save()

          {

                    IRFeeds fd = getFeed();

                    ArrayList<IRFeedAccts> twtAccts =
fd.getTwtAccts();

                   

                    System.err.println(fd.getFeedUrl());

                   

                    for (Iterator iterator =
twtAccts.iterator(); iterator.hasNext();)

                    {

                               IRFeedAccts irFeedAccts =
(IRFeedAccts) iterator.next();


System.err.println(irFeedAccts.getNumber());

                    }

                   

                    return "saved";

          }

         

          /**

          * @return

          *

          */

          private ArrayList<IRFeedAccts>
prepareTwitterAccounts(List<IRAccountUsers> twtUsers)

          {

                    ArrayList<IRFeedAccts> twtAccts = new
ArrayList<IRFeedAccts>();

                    IRAccountUsers twtUser = null;

                    IRFeedAccts feedAccnt = null;

                    for (Iterator iterator =
twtUsers.iterator(); iterator.hasNext();)

                    {

                               twtUser = (IRAccountUsers)
iterator.next();

                               

                               feedAccnt = new
IRFeedAccts();


feedAccnt.setAccountId(twtUser.getSocialId());


feedAccnt.setPic(twtUser.getPic());


feedAccnt.setName(twtUser.getTwtUsrName());

                               feedAccnt.setNumber(30);

                               

                               twtAccts.add(feedAccnt);

                    }

                   

                    return twtAccts;

          }

         

MY BEAN



  public class IRFeeds implements java.io.Serializable {





  private Integer feedId;

  private Integer campId;

  private String feedUrl;

  private boolean active;

  private Date createdOn;

  private Date updatedOn;

  private String createdBy;



  private ArrayList<IRFeedAccts> twtAccts;

         

  private ArrayList<IRFeedAccts> fbAccts;

         

  private ArrayList<IRFeedAccts> fbPages;





MY JSP FILE



  <s:iterator value="#session.fd.twtAccts" status="twtAcct">

                                          <tr>


<td>


<div style="width: 48px; float: left;"><img src="<s:property value="pic" />"
/></div>


<div style="text-align: left;"><s:property value="name" /></div>


</td>


<td>


<s:textfield name="number"/>


</td>


<td>


<input type="text" />


</td>


<td>


<s:textfield name="signature"/>


</td>

                                          </tr>


</s:iterator>





Now my problem is when the value of the beans in the arraylist is modified
in the JSP, the same doesn't reach the action class save method. The value
remains the same.



Regards,

Rohit




Attachment: user_207146.ezm (zipped)
Hi,

I am using Struts 2.1.8.1 and have an action that allows for a large
file (20+MB) to be uploaded. I have set the Struts
struts.multipart.maxSize attribute to allow a file upload large
enough, and have also set the interceptor max file upload size as
follows in my action:

<interceptor-ref name="fileUpload">
 <param name="maximumSize">25000000</param>
</interceptor-ref>

The action is invoked (previously I was running into the max file size
issue) but now all parameters (using paramsPrepareParamsStack in my
interceptor stack) are null, including the file attachment and all
other parameters sent by the form.

No exceptions are being thrown in the server log -- is there some
other known bug or restriction I might be running into here?

Any/All replies are much appreciated.


Attachment: user_207147.ezm (zipped)
I use struts2.1.8 and extjs3.2, I make a login page, if login
failed,it will alert a message and it will still stay this login page;
if it login success,it will go to another new page,such as main.jsp
page

My login page is follows:
var win=new Ext.Window({
el:'hello-win',
 ....
items:
loginForm,
  buttons:[{
    text:'OK',
    handler:function(){
     if(win.getComponent('loginForm').form.isValid()){
        win.getComponent('loginForm').form.submit({
         url:'/Test/test.do',
         success:function(form,action){
          Ext.Msg.alert("Login success!",action.result.message);
         },
        failure:function(form,action){
          Ext.Msg.alert('Login fail",action.result.message);
        }
       });
      }
    }
    }
 });

Action class is follows:
public String login() throws Exception{
 boolean success;.
 ....
 if(success){
  return SUCCESS;
 }
 else{
  setMessage("Your ID or password is wrong");
  return null;
}
}

configure file is follows:
<struts>
<package name="Test" namespace="" extends="json-default">
   <action name="login" class="Test.Login" method="test">
     <result type="json"/>
   </action>
</package>
</struts>

If I set <result>main.jsp</result>, when I click OK button,it will
raise javascript error,because extjs don't get json message.
If I set <result type="json"/>,whether I login success or fail,the
login page will don't redirect,If login success,I want to redirect
this page to main.jsp,but it don't redirect.What can I do about
configure file? I don't know how to do it.I have no idea about it.
Any idea will be appreciated!

Thanks in advance

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