You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Henry Park <He...@isd.lacounty.gov> on 2008/01/03 01:09:57 UTC

action call not calling action

Hello everyone, I am reposting this question as I am still having issues
with it. 

 

I am having a really strange issue.  In my application I 
have a menu bar and a main content area. The menu bar and main content 
area are populated separately using an Ajax call to their respective 
action methods. They are automatically called/populated when I log into 
my application.  So when I log in, the main content area and menu bar 
are successfully displayed. 

When I first log into my application, everything gets loaded properly 
and the appropriate action methods are called.  However when I try to 
call my menu action again, it does not call my action method.  For 
example, if my action call looks like this: 


getUrl("MenuAction!list.action") 


and my Menu Action class looks like this: 


public class MenuAction extends ActionSupport implements Preparable { 

  public void prepare() throws Exception { 
    log.debug("in prepare"); 
  } 

  public String doList() { 
    log.debug("doList"); 
    return SUCCESS; 
  } 
} 



A section from my 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">

    <default-interceptor-ref name="paramsPrepareParamsStack"/>

    

    <!-- Menu -->   

    <action name="Menu" class="action.MenuAction" method="list">

      <result name="success">/jsp/include/menu.jsp</result>

      <interceptor-ref name="paramsPrepareParamsStack"/>

    </action>

    <action name="EmployeeAction" class="action.EmployeeAction"
method="edit">

      <result name="success"
type="redirect-action">EmployeeList!list.action</result>

      <result
name="input">/jsp/administration/employeeEntry.jsp</result>

      <result name="login"
type="redirect-action">Login!login.action</result>

      <interceptor-ref name="paramsPrepareParamsStack"/>

    </action>

    <action name="EmployeeList" class="action.EmployeeAction"
method="list">

      <result name="success">/jsp/administration/employee.jsp</result>

      <result name="login"
type="redirect-action">Login!login.action</result>

      <interceptor-ref name="basicStack"/>  

    </action>

    

   ... ... ...



My struts-default.xml is not modified.


It enters my 'prepare()' method but does not enter my doList() method. 
But on the first initial call, it does enter doList().  It seems like I 
can only 'get into' the doList() method once. I even entered the action 
call manually in my browser address bar but it still only enters my 
prepare() method. 

Here is the really strange part... on my development machine, everything

works perfectly. All the methods get called successfully.  The above 
only happens when I access it from a different computer. Any ideas? I've

been trying to figure this out for days.


Re: action call not calling action

Posted by Dave Newton <ne...@yahoo.com>.
--- Henry Park <He...@isd.lacounty.gov> wrote:
> getUrl("MenuAction!list.action") 

What's "getUrl", a JavaScript function?

>     <action name="Menu" class="action.MenuAction" method="list">

Where do you define "MenuAction"?

> It enters my 'prepare()' method but does not enter my doList() method.

Is your logging turned up to eleven? Is it a default S2 thing that if you
provide a method it'll look for a "do${methodName}" thing?

d.



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