You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Br...@aspca.org on 2009/09/02 18:15:27 UTC

Action Tag java.lang.StackOverflowError

I've been banging my head against the wall for the past 6+ hours or so and 
need help with this problem.

I am trying to call an action to display results on a page when the page 
is closed, but I keep getting a loop that keeps printing the data over and 
over until a StackOverflowError occurs.

My code looks like this:

index.jsp

<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<html>

        <head>
    <title>Action Tag</title>
        </head>

        <body>
                <h3>Action Tag</h3>
                <hr/>
                <h4>This line is before the ActionTag invokes the 
secondary action.</h4>
                <s:action name="TargetAction" executeResult="true"/>
        </body>

</html>


web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">

    <filter>
        <filter-name>struts2</filter-name>
 
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
    </filter>

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

    <session-config>
        <session-timeout>
            30
        </session-timeout>
    </session-config>

    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>
</web-app>


struts.xml

<!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
    "http://struts.apache.org/dtds/struts-2.0.dtd">

<struts>
   <package name="default" extends="struts-default">
      <action name="TargetAction" class="manning.chapterSix.TargetAction">
         <result>/index.jsp</result>
      </action>
   </package>
</struts>


TargetAction.java

package manning.chapterSix;

import com.opensymphony.xwork2.ActionSupport;

/**
 *
 * @author bnicely
 */
public class TargetAction extends ActionSupport {

   @Override
   public String execute(){
      return SUCCESS;
   }
}


Can anyone assist me?

Thanks,  
 
Brian E. Nicely
Programmer / Analyst
Knowledge Management
 
ASPCA®
1717 South Philo Road, Suite 36
Urbana, IL 61802
 
briannicely@aspca.org
 
P: 217-337-9700, 9799
F: 217-337-0599
www.aspca.org
 
The information contained in this e-mail, and any attachments hereto, is 
from The American Society for the Prevention of Cruelty to Animals® (ASPCA
®) and is intended only for use by the addressee(s) named herein and may 
contain legally privileged and/or confidential information. If you are not 
the intended recipient of this e-mail, you are hereby notified that any 
dissemination, distribution, copying or use of the contents of this 
e-mail, and any attachments hereto, is strictly prohibited. If you have 
received this e-mail in error, please immediately notify me by reply email 
and permanently delete the original and any copy of this e-mail and any 
printout thereof.
 

Re: Action Tag java.lang.StackOverflowError

Posted by Br...@aspca.org.
Thank you Martin and Dave.

That makes sense to me Dave, thanks for clearing that up. What I would 
like to do though is stay on the same page without going to a different 
page but still contain that action. From what you're describing and from 
what I got from Martin, it appears it might not be possible.
 
 
Brian E. Nicely
Programmer / Analyst
Knowledge Management
 
ASPCA®
1717 South Philo Road, Suite 36
Urbana, IL 61802
 
briannicely@aspca.org
 
P: 217-337-9700, 9799
F: 217-337-0599
www.aspca.org
 
The information contained in this e-mail, and any attachments hereto, is 
from The American Society for the Prevention of Cruelty to Animals® (ASPCA
®) and is intended only for use by the addressee(s) named herein and may 
contain legally privileged and/or confidential information. If you are not 
the intended recipient of this e-mail, you are hereby notified that any 
dissemination, distribution, copying or use of the contents of this 
e-mail, and any attachments hereto, is strictly prohibited. If you have 
received this e-mail in error, please immediately notify me by reply email 
and permanently delete the original and any copy of this e-mail and any 
printout thereof.

Re: Action Tag java.lang.StackOverflowError

Posted by Dave Newton <ne...@yahoo.com>.
BrianNicely@aspca.org wrote:
> Is there an example you could point me to (that actually works) or help me 
> get my example working?

We seem to be talking past each other here.

Load a page you're not already on. Do you understand *why* you're 
getting a stack overflow? You're calling an action. That action renders 
a JSP. That JSP is the JSP you're already on. The JSP you're on calls an 
action, that renders a JSP, that calls the same action, that renders a 
JSP, that calls an action...

dave


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


Re: Action Tag java.lang.StackOverflowError

Posted by Rusty Wright <ru...@gmail.com>.
Think subroutine.

musomesa@aol.com wrote:
>  Different tags do different things so I'm afraid you have to look at the documentation for 
> a tag to see just what it does. This one was written for the purpose of allowing you to 
> use the result of an action in the page you are currently rendering.
> 
> 
>  
> 
> 
> Chris
> 
>  
> 
> 
>  
> 
> -----Original Message-----
> From: BrianNicely@aspca.org
> To: Struts Users Mailing List <us...@struts.apache.org>
> Sent: Wed, Sep 2, 2009 3:36 pm
> Subject: Re: Action Tag java.lang.StackOverflowError
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> Of course if you couldn't tell, I'm very new to Struts. Can you explain 
> why that all shows up on one page and doesn't take me to a different page?
> 
> My best assumption on how Struts works is that when I'm at index.jsp I 
> call the action ActionTag which on a success displays the snippet.jsp page 
> on the index.jsp page.
>  
>  
> Brian E. Nicely
> Programmer / Analyst
> Knowledge Management
>  
> ASPCA®
> 1717 South Philo Road, Suite 36
> Urbana, IL 61802
>  
> briannicely@aspca.org
>  
> P: 217-337-9700, 9799
> F: 217-337-0599
> www.aspca.org
>  
> The information contained in this e-mail, and any attachments hereto, is 
> from The American Society for the Prevention of Cruelty to Animals® (ASPCA
> ®) and is intended only for use by the addressee(s) named herein and may 
> contain legally privileged and/or confidential information. If you are not 
> the intended recipient of this e-mail, you are hereby notified that any 
> dissemination, distribution, copying or use of the contents of this 
> e-mail, and any attachments hereto, i
> s strictly prohibited. If you have 
> received this e-mail in error, please immediately notify me by reply email 
> and permanently delete the original and any copy of this e-mail and any 
> printout thereof.
> 
> 
> 
>  
> 
> 

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


Re: Action Tag java.lang.StackOverflowError

Posted by mu...@aol.com.
 Different tags do different things so I'm afraid you have to look at the documentation for 
a tag to see just what it does. This one was written for the purpose of allowing you to 
use the result of an action in the page you are currently rendering.


 


Chris

 


 

-----Original Message-----
From: BrianNicely@aspca.org
To: Struts Users Mailing List <us...@struts.apache.org>
Sent: Wed, Sep 2, 2009 3:36 pm
Subject: Re: Action Tag java.lang.StackOverflowError










Of course if you couldn't tell, I'm very new to Struts. Can you explain 
why that all shows up on one page and doesn't take me to a different page?

My best assumption on how Struts works is that when I'm at index.jsp I 
call the action ActionTag which on a success displays the snippet.jsp page 
on the index.jsp page.
 
 
Brian E. Nicely
Programmer / Analyst
Knowledge Management
 
ASPCA®
1717 South Philo Road, Suite 36
Urbana, IL 61802
 
briannicely@aspca.org
 
P: 217-337-9700, 9799
F: 217-337-0599
www.aspca.org
 
The information contained in this e-mail, and any attachments hereto, is 
from The American Society for the Prevention of Cruelty to Animals® (ASPCA
®) and is intended only for use by the addressee(s) named herein and may 
contain legally privileged and/or confidential information. If you are not 
the intended recipient of this e-mail, you are hereby notified that any 
dissemination, distribution, copying or use of the contents of this 
e-mail, and any attachments hereto, i
s strictly prohibited. If you have 
received this e-mail in error, please immediately notify me by reply email 
and permanently delete the original and any copy of this e-mail and any 
printout thereof.



 


Re: Action Tag java.lang.StackOverflowError

Posted by Br...@aspca.org.
Of course if you couldn't tell, I'm very new to Struts. Can you explain 
why that all shows up on one page and doesn't take me to a different page?

My best assumption on how Struts works is that when I'm at index.jsp I 
call the action ActionTag which on a success displays the snippet.jsp page 
on the index.jsp page.
 
 
Brian E. Nicely
Programmer / Analyst
Knowledge Management
 
ASPCA®
1717 South Philo Road, Suite 36
Urbana, IL 61802
 
briannicely@aspca.org
 
P: 217-337-9700, 9799
F: 217-337-0599
www.aspca.org
 
The information contained in this e-mail, and any attachments hereto, is 
from The American Society for the Prevention of Cruelty to Animals® (ASPCA
®) and is intended only for use by the addressee(s) named herein and may 
contain legally privileged and/or confidential information. If you are not 
the intended recipient of this e-mail, you are hereby notified that any 
dissemination, distribution, copying or use of the contents of this 
e-mail, and any attachments hereto, is strictly prohibited. If you have 
received this e-mail in error, please immediately notify me by reply email 
and permanently delete the original and any copy of this e-mail and any 
printout thereof.

Re: Action Tag java.lang.StackOverflowError

Posted by mu...@aol.com.
 Great. The trick is not to have an action's result contain a call to the action -- 
you set up an infinite recursion that way.


 


Chris

 


 

-----Original Message-----
From: BrianNicely@aspca.org
To: Struts Users Mailing List <us...@struts.apache.org>
Sent: Wed, Sep 2, 2009 3:21 pm
Subject: Re: Action Tag java.lang.StackOverflowError










Chris,

Thanks, that works exactly the way I wanted. 
 
Brian E. Nicely
Programmer / Analyst
Knowledge Management
 
ASPCA®
1717 South Philo Road, Suite 36
Urbana, IL 61802
 
briannicely@aspca.org
 
P: 217-337-9700, 9799
F: 217-337-0599
www.aspca.org
 
The information contained in this e-mail, and any attachments hereto, is 
from The American Society for the Prevention of Cruelty to Animals® (ASPCA
®) and is intended only for use by the addressee(s) named herein and may 
contain legally privileged and/or confidential information. If you are not 
the intended recipient of this e-mail, you are hereby notified that any 
dissemination, distribution, copying or use of the contents of this 
e-mail, and any attachments hereto, is strictly prohibited. If you have 
received this e-mail in error, please immediately notify me by reply email 
and permanently delete the original and any copy of this e-mail and any 
printout thereof.



 


Re: Action Tag java.lang.StackOverflowError

Posted by Br...@aspca.org.
Chris,

Thanks, that works exactly the way I wanted. 
 
Brian E. Nicely
Programmer / Analyst
Knowledge Management
 
ASPCA®
1717 South Philo Road, Suite 36
Urbana, IL 61802
 
briannicely@aspca.org
 
P: 217-337-9700, 9799
F: 217-337-0599
www.aspca.org
 
The information contained in this e-mail, and any attachments hereto, is 
from The American Society for the Prevention of Cruelty to Animals® (ASPCA
®) and is intended only for use by the addressee(s) named herein and may 
contain legally privileged and/or confidential information. If you are not 
the intended recipient of this e-mail, you are hereby notified that any 
dissemination, distribution, copying or use of the contents of this 
e-mail, and any attachments hereto, is strictly prohibited. If you have 
received this e-mail in error, please immediately notify me by reply email 
and permanently delete the original and any copy of this e-mail and any 
printout thereof.

Re: Action Tag java.lang.StackOverflowError

Posted by mu...@aol.com.
 
1) Create a file called snippet.jsp with just:

        <h4>
            And this line is from the target action.
        </h4>

---------------------------------        
        
2) Change result in your struts.xml to read

<struts>
   <package name="default" extends="struts-default">
      <action name="TargetAction" class="manning.chapterSix.TargetAction">
         <result>/snippet.jsp</result>
      </action>
   </package>
</struts>


-----------------------------------------------
3) Just a comment: you are overriding the execute() method with the same functionality you
are inheriting from ActionSupport so your TargetAction can be abbreviated to:

package manning.chapterSix;
import com.opensymphony.xwork2.ActionSupport;
public class TargetAction extends ActionSupport {}

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

4) index.jsp stays the same:

<html>
    <head>
        <title>Action Tag</title>
    </head>
    <body>
        <h3>
            Action Tag
        </h3>
        <hr />
        <h4>
            This line is before the ActionTag invokes the secondary action.
        </h4>
     
   <s:action name="TargetAction" executeResult="true" />
    </body>
</html>



 


Chris

 


 

-----Original Message-----
From: BrianNicely@aspca.org
To: Struts Users Mailing List <us...@struts.apache.org>
Sent: Wed, Sep 2, 2009 2:14 pm
Subject: Re: Action Tag java.lang.StackOverflowError










Is there an example you could point me to (that actually works) or help me 
get my example working?
 
 
Brian E. Nicely
Programmer / Analyst
Knowledge Management
 
ASPCA®
1717 South Philo Road, Suite 36
Urbana, IL 61802
 
briannicely@aspca.org
 
P: 217-337-9700, 9799
F: 217-337-0599
www.aspca.org
 
The information contained in this e-mail, and any attachments hereto, is 
from The American Society for the Prevention of Cruelty to Animals® (ASPCA
®) and is intended only for use by the addressee(s) named herein and may 
contain legally privileged and/or confidential information. If you are not 
the intended recipient of this e-mail, you are hereby notified that any 
dissemination, distribution, copying or use of the contents of this 
e-mail, and any attachments hereto, is strictly prohibited. If you have 
received this e-mail in error, please immediately notify me by reply email 
and permanently delete the original and any copy of this e-mail and any 
printout thereof.



 


Re: Action Tag java.lang.StackOverflowError

Posted by Br...@aspca.org.
Is there an example you could point me to (that actually works) or help me 
get my example working?
 
 
Brian E. Nicely
Programmer / Analyst
Knowledge Management
 
ASPCA®
1717 South Philo Road, Suite 36
Urbana, IL 61802
 
briannicely@aspca.org
 
P: 217-337-9700, 9799
F: 217-337-0599
www.aspca.org
 
The information contained in this e-mail, and any attachments hereto, is 
from The American Society for the Prevention of Cruelty to Animals® (ASPCA
®) and is intended only for use by the addressee(s) named herein and may 
contain legally privileged and/or confidential information. If you are not 
the intended recipient of this e-mail, you are hereby notified that any 
dissemination, distribution, copying or use of the contents of this 
e-mail, and any attachments hereto, is strictly prohibited. If you have 
received this e-mail in error, please immediately notify me by reply email 
and permanently delete the original and any copy of this e-mail and any 
printout thereof.

Re: Action Tag java.lang.StackOverflowError

Posted by Dave Newton <ne...@yahoo.com>.
BrianNicely@aspca.org wrote:
> What I want to do is load a page without the user having to click on it 
> (like a submit button) and have the data show up on the page. I also don't 
> want to forward to another page. Is that even possible?

You can use the action tag for that (depending on a few things), but 
you're loading the same page you're already on.

Dave


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


Re: Action Tag java.lang.StackOverflowError

Posted by Br...@aspca.org.
What I want to do is load a page without the user having to click on it 
(like a submit button) and have the data show up on the page. I also don't 
want to forward to another page. Is that even possible?
 
 
Brian E. Nicely
Programmer / Analyst
Knowledge Management
 
ASPCA®
1717 South Philo Road, Suite 36
Urbana, IL 61802
 
briannicely@aspca.org
 
P: 217-337-9700, 9799
F: 217-337-0599
www.aspca.org
 
The information contained in this e-mail, and any attachments hereto, is 
from The American Society for the Prevention of Cruelty to Animals® (ASPCA
®) and is intended only for use by the addressee(s) named herein and may 
contain legally privileged and/or confidential information. If you are not 
the intended recipient of this e-mail, you are hereby notified that any 
dissemination, distribution, copying or use of the contents of this 
e-mail, and any attachments hereto, is strictly prohibited. If you have 
received this e-mail in error, please immediately notify me by reply email 
and permanently delete the original and any copy of this e-mail and any 
printout thereof.
 

Dave Newton <ne...@yahoo.com> wrote on 09/02/2009 12:56:02 PM:

> BrianNicely@aspca.org wrote:
> > I've been banging my head against the wall for the past 6+ hours or so 
and 
> > need help with this problem.
> > 
> > I am trying to call an action to display results on a page when the 
page 
> > is closed, but I keep getting a loop that keeps printing the data over 
and 
> > over until a StackOverflowError occurs.
> > 
> > My code looks like this:
>  > [snipalottacode]
> 
> Well, you're calling the action you're in from the action you're 
> in--that's a stack overflow... I'm not sure what you're trying to do.
> 
> Dave
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 

Re: Action Tag java.lang.StackOverflowError

Posted by Dave Newton <ne...@yahoo.com>.
BrianNicely@aspca.org wrote:
> I've been banging my head against the wall for the past 6+ hours or so and 
> need help with this problem.
> 
> I am trying to call an action to display results on a page when the page 
> is closed, but I keep getting a loop that keeps printing the data over and 
> over until a StackOverflowError occurs.
> 
> My code looks like this:
 > [snipalottacode]

Well, you're calling the action you're in from the action you're 
in--that's a stack overflow... I'm not sure what you're trying to do.

Dave


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


Re: Action Tag java.lang.StackOverflowError

Posted by Br...@aspca.org.
I'm sorry, I should correct myself.  I want to display the results when 
the page is "open" and I'm using Struts2.
 
Brian E. Nicely
Programmer / Analyst
Knowledge Management
 
ASPCA®
1717 South Philo Road, Suite 36
Urbana, IL 61802
 
briannicely@aspca.org
 
P: 217-337-9700, 9799
F: 217-337-0599
www.aspca.org
 
The information contained in this e-mail, and any attachments hereto, is 
from The American Society for the Prevention of Cruelty to Animals® (ASPCA
®) and is intended only for use by the addressee(s) named herein and may 
contain legally privileged and/or confidential information. If you are not 
the intended recipient of this e-mail, you are hereby notified that any 
dissemination, distribution, copying or use of the contents of this 
e-mail, and any attachments hereto, is strictly prohibited. If you have 
received this e-mail in error, please immediately notify me by reply email 
and permanently delete the original and any copy of this e-mail and any 
printout thereof.
 

BrianNicely@aspca.org wrote on 09/02/2009 11:15:27 AM:

> I've been banging my head against the wall for the past 6+ hours or so 
and 
> need help with this problem.
> 
> I am trying to call an action to display results on a page when the page 

> is closed, but I keep getting a loop that keeps printing the data over 
and 
> over until a StackOverflowError occurs.
> 
> My code looks like this:
> 
> index.jsp
> 
> <%@ page contentType="text/html; charset=UTF-8" %>
> <%@ taglib prefix="s" uri="/struts-tags" %>
> <html>
> 
>         <head>
>     <title>Action Tag</title>
>         </head>
> 
>         <body>
>                 <h3>Action Tag</h3>
>                 <hr/>
>                 <h4>This line is before the ActionTag invokes the 
> secondary action.</h4>
>                 <s:action name="TargetAction" executeResult="true"/>
>         </body>
> 
> </html>
> 
> 
> web.xml
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
>     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>     xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
> http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
> 
>     <filter>
>         <filter-name>struts2</filter-name>
> 
> <filter-class>org.apache.struts2.dispatcher.ng.filter.
> StrutsPrepareAndExecuteFilter</filter-class>
>     </filter>
> 
>     <filter-mapping>
>         <filter-name>struts2</filter-name>
>         <url-pattern>/*</url-pattern>
>     </filter-mapping>
> 
>     <session-config>
>         <session-timeout>
>             30
>         </session-timeout>
>     </session-config>
> 
>     <welcome-file-list>
>         <welcome-file>index.jsp</welcome-file>
>     </welcome-file-list>
> </web-app>
> 
> 
> struts.xml
> 
> <!DOCTYPE struts PUBLIC
>     "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
>     "http://struts.apache.org/dtds/struts-2.0.dtd">
> 
> <struts>
>    <package name="default" extends="struts-default">
>       <action name="TargetAction" 
class="manning.chapterSix.TargetAction">
>          <result>/index.jsp</result>
>       </action>
>    </package>
> </struts>
> 
> 
> TargetAction.java
> 
> package manning.chapterSix;
> 
> import com.opensymphony.xwork2.ActionSupport;
> 
> /**
>  *
>  * @author bnicely
>  */
> public class TargetAction extends ActionSupport {
> 
>    @Override
>    public String execute(){
>       return SUCCESS;
>    }
> }
> 
> 
> Can anyone assist me?
> 
> Thanks, 
> 
> Brian E. Nicely
> Programmer / Analyst
> Knowledge Management
> 
> ASPCA®
> 1717 South Philo Road, Suite 36
> Urbana, IL 61802
> 
> briannicely@aspca.org
> 
> P: 217-337-9700, 9799
> F: 217-337-0599
> www.aspca.org
> 
> The information contained in this e-mail, and any attachments hereto, is 

> from The American Society for the Prevention of Cruelty to Animals® 
(ASPCA
> ®) and is intended only for use by the addressee(s) named herein and may 

> contain legally privileged and/or confidential information. If you are 
not 
> the intended recipient of this e-mail, you are hereby notified that any 
> dissemination, distribution, copying or use of the contents of this 
> e-mail, and any attachments hereto, is strictly prohibited. If you have 
> received this e-mail in error, please immediately notify me by reply 
email 
> and permanently delete the original and any copy of this e-mail and any 
> printout thereof.
>