I’m attempting to put a tutorial together that does NOT use Spring. My goal
is to compare Spring and Spring MVC with Struts 2 and Guice.  The issue I’m
having is probably simple, but I can’t seem to find any good non-Spring
examples of passing a selection parameter into the Action to retrieve a
specific record for display on another JSP. I’m sure the errors is
associated with the struts.xml, just don’t know what.

JSP code: list_depts.jsp

<s:iterator value="depts" status="status">
  <tr>
    <td> <s:url action= <s:param name="id" value="deptId"
/></s:url>"><s:property value="deptId" /> </td>
    <td><s:property value="deptName" /></td>
  </tr>
</s:iterator>

Part of struts.xml:

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

      <interceptors>
         <interceptor-stack name="crudStack">
            <interceptor-ref name="servlet-config"/>
            <interceptor-ref name="static-params" />
            <interceptor-ref name="defaultStack" />
         </interceptor-stack>
      </interceptors>

      <action name="listDepts"
class="com.att.etpi.eval.struts2.actions.DepartmentAction" method="doList">
         <result name="success">jsps/list_depts.jsp</result>
         <interceptor-ref name="basicStack"/>
      </action>

      <action name="findDept_*"
class="com.att.etpi.eval.struts2.actions.DepartmentAction"
method="findById">
         <result name="success">jsps/edit_dept.jsp</result>
         <result type="redirect-action">listDepts</result>
         <interceptor-ref name="crudStack"/>
      </action>

The Action is as follows:

public class DepartmentAction extends ActionSupport implements Preparable,
ParameterAware 
{
        private Integer id;
        private Department dept;
        private List<Department> depts;
        private DaoManager daoManager = null;
        private HashMap paramsMap = null;

        @SuppressWarnings("unchecked")
        public void prepare() throws Exception 
        {
                if (this.paramsMap.size() > 0) {
                        if (this.paramsMap.containsKey("id")) {
                                String idStr = CommonUtils.StrArr2Str((String[])
this.paramsMap.get("id"));
                                this.id = new Integer(idStr);
                        }
                }

        @SuppressWarnings("unchecked")
        public void setParameters(Map params) {
                this.paramsMap = new HashMap(params);
        }

        public String findById () throws Exception
        {
                System.out.println("I'm into dept.findbyid.");
                Short val = this.getId().shortValue();
                dept = getDaoManager().getDeptDao().findById(val);
                return SUCCESS;
        }

I get this error message:

No result defined for action
com.att.etpi.eval.struts2.actions.DepartmentAction and result input.


Here’s the partial stack dump:

No result defined for action
com.att.etpi.eval.struts2.actions.DepartmentAction and result input - action
-
file:/C:/my_projects/workspace_3.2.2/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/webapps/Struts2test1/WEB-INF/classes/struts2test1.xml:36:106
 
   
com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:345)
   
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
   
com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:150)
   
org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:48)
   
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
   
com.google.inject.struts2.GuiceObjectFactory$ProvidedInterceptor.intercept(GuiceObjectFactory.java:222)
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218)

com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)

Sorry for the length: Any ideas what I’m doing wrong?

shadman
-- 
View this message in context: 
http://www.nabble.com/-S2--%E2%80%93-No-result-defined-for-action-ERROR-tf3779469.html#a10687943
Sent from the Struts - User mailing list archive at Nabble.com.


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

Reply via email to