You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by shadman <sh...@att.com> on 2007/05/18 20:31:47 UTC

[S2] – No result defined for action ERROR

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: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: [S2] – No result defined for action ERROR

Posted by shadman <sh...@att.com>.


Dave Newton-4 wrote:
> 
> --- shadman <sh...@att.com> wrote:
>> 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 not sure what Spring has to do with this except
> that the DAO/service would be injected in a different
> way, yes?
> 
> Correct, Spring is not issue - just trying to explain what and why, is
> all. Like a said, for comparison only. But, most S2 examples use Spring.
> 
>> if (this.paramsMap.size() > 0) {
>>     if (this.paramsMap.containsKey("id")) {
>>         String idStr = 
>>           CommonUtils.StrArr2Str((String[])
>>           this.paramsMap.get("id"));
>>         this.id = new Integer(idStr);
>>     }
>> }
> 
> Just out of curiosity, why not use the type conversion
> stuff and skip all this?
> 
> I'm a newbie to S2, didn't know I could do that yet.  Would rather, I'm
> sure.
> 
>> I get this error message:
>> 
>> No result defined for action
>> com.att.etpi.eval.struts2.actions.DepartmentAction
>> and result input.
> 
> Do you have a result defined for "input"? I didn't see
> one. It would appear as though some validation
> somewhere is failing hence it's trying to take you
> back to the input result.
> 
> d.
> 
> 1st, thanks for the reply: 
> This is what I understood from another post, must have a result input
> specified. I didn't have any validation, and earlier testing the
> result-input didn't work for me (meaning I must have had a problem).  I
> cleaned and retested in Eclipse 3x, still failed.  I did seem to stumble
> upon the right thing to do by accident. Added "<result
> name="input">jsps/errors.jsp</result>". So, my assumption is that its
> required in case some error occurs; and not used if no error occurs.
> 
> Thanks, Dave.
> 
> shadman
>  
> ____________________________________________________________________________________
> Don't pick lemons.
> See all the new 2007 cars at Yahoo! Autos.
> http://autos.yahoo.com/new_cars.html 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 

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


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


Re: [S2] – No result defined for action ERROR

Posted by Dave Newton <ne...@yahoo.com>.
--- shadman <sh...@att.com> wrote:
> 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 not sure what Spring has to do with this except
that the DAO/service would be injected in a different
way, yes?

> if (this.paramsMap.size() > 0) {
>     if (this.paramsMap.containsKey("id")) {
>         String idStr = 
>           CommonUtils.StrArr2Str((String[])
>           this.paramsMap.get("id"));
>         this.id = new Integer(idStr);
>     }
> }

Just out of curiosity, why not use the type conversion
stuff and skip all this?

> I get this error message:
> 
> No result defined for action
> com.att.etpi.eval.struts2.actions.DepartmentAction
> and result input.

Do you have a result defined for "input"? I didn't see
one. It would appear as though some validation
somewhere is failing hence it's trying to take you
back to the input result.

d.



 
____________________________________________________________________________________
Don't pick lemons.
See all the new 2007 cars at Yahoo! Autos.
http://autos.yahoo.com/new_cars.html 

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