You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Emi Lu <em...@encs.concordia.ca> on 2011/04/13 21:19:55 UTC

addActionError() caused "Page not found (404)".

Hello,

addActionError() caused "Page not found (404)" Error.

(1) Action1.java
     browsing all records using displaytag

(2) Action2.java
     if just say:
     return "view"; go to Action1 successfully

     if:
     addActionError(...); //then
     return "view";
     Got an "Page not found (404)" exception.

Does anyone know what cause the problem?

Thanks a lot!
Emi

-- 
<result name="view" type="redirectAction">
    <param name="actionName">ProcessAction1</param>
    <param name="namespace">/Action</param>
</result>


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


Re: addActionError() caused "Page not found (404)".

Posted by Dave Newton <da...@gmail.com>.
Did you try adding an "input" result and seeing if the issue went away?

d.

On Thu, Apr 14, 2011 at 10:12 AM, Emi Lu <em...@encs.concordia.ca> wrote:
>
>> I'm still guessing it's a validation thing--put an "input" result in
>> there and check.
>>
>> Also, by naming the results the same as the actions you're actually
>> circumventing one of the reasons for abstracting the result names from
>> everything else. Even for test apps it's just not a good habit, IMO.
>
> So, what is the reason? I did not put input :-(
>
> I am looking for the answer......
>
> Emi
>
>
>>
>> On Wed, Apr 13, 2011 at 4:43 PM, Emi Lu<em...@encs.concordia.ca>  wrote:
>>>>
>>>> Depends on where you added the addActionError() call, at the very
>>>> least--an action error indicates a validation problem, so it may be
>>>> trying to go to the "input" result.
>>>>
>>>> Not enough information to help.
>>>
>>> It seems that I may get my answer soon!
>>>
>>> More info comes:
>>> =========================
>>> (1) Action1.java
>>> public class Action1 extends ActionSupport
>>> {  .. ....
>>>   public String execute() throws Exception
>>>   {
>>>      HttpServletRequest  req  = ServletActionContext.getRequest();
>>>      HttpServletResponse res  = ServletActionContext.getResponse();
>>>      /* paging method for display tag */
>>>      process_paging(req);
>>>      return SUCCESS;
>>>   }  ...
>>> }
>>>
>>>
>>> (2) Action1 in struts.xml
>>> <action name="*Action1"  method="{1}" class="Action1">
>>>  <result name="success" type="tiles">browse_action1</result>
>>> </action>
>>>
>>>
>>> (3) tiles for browse_action1
>>> <definition name= "browse_action1"  template="t.jsp">
>>>   <put-attribute name="body"  value="browse_action1.jsp" />
>>> </definition>
>>>
>>>
>>> (4) browse_action1.jsp
>>> ... ...
>>> <s:form id="Action1Form"
>>>   name="Action1Form"
>>>   action="Action1"
>>>   validate="true"
>>>   theme="simple">
>>> <display:table id="row_rec"
>>>               name="alist_paging_bean"
>>>               export="true"
>>>               class="simple"
>>>               cellspacing="0"
>>>               cellpadding="5"
>>>               requestURI="Action1"
>>>               keepStatus="true"
>>>               pagesize="<%=bean_display.getPageSize() %>"
>>>               partialList="true"
>>>               size="<%=bean_display.getTotalRecNum() %>"
>>>               sort="external"
>>>>
>>> <display:column property="c1" title="c1" sortName="c1" sortable="true"/>
>>> ... ...
>>> </display:table>
>>>
>>> <s:submit value="Update"  theme="simple" action="update_guiAction2">
>>> </s:submit>
>>> </s:form>
>>>
>>>
>>> (5) Action2.java
>>> public class ProcessThesis extends ActionSupport
>>> {
>>>   public String update_gui() throws Exception
>>>   {
>>>      HttpServletRequest  req  = ServletActionContext.getRequest();
>>>      HttpServletResponse res  = ServletActionContext.getResponse();
>>>      String[]    error_arr    = new String[2];
>>>   String[] checkbox_value =req.getParameterValues("checkbox_value");
>>>      if(Utils.isEmpty(checkbox_value))
>>>      {
>>>         addActionError(this.getText("at.least.one.rec.error"));
>>>         return "view_action1";   //Step_Q1 ->  "Page not found()404"
>>>      }
>>>
>>>      return "view_action1" ;   //Step_Q2 ->  no error at all
>>>   }
>>> }
>>>
>>>
>>> If remove "addActionError(this.getText("at.least.one.rec.error"))",
>>> return
>>> successfully! Otherwise, "Page not found 404"returned!
>>>
>>> (6) struts.xml for Action2
>>> <action name="*Action2"  method="{1}" class="Action2">
>>>   <result name="view_action1" type="redirectAction">
>>>      <param name="actionName">Action1</param>
>>>   </result>
>>> </action>
>>>
>>> I tried also the following, but it does not work either:
>>> <action name="*Action2"  method="{1}" class="Action2">
>>> <result name="view_action1" type="tiles">browse_action1</result>
>>> </action>
>>>
>>> Thanks a lot!
>>> Emi
>>>
>>>
>>>
>>>
>>>
>>>>
>>>> On Wed, Apr 13, 2011 at 3:19 PM, Emi Lu<em...@encs.concordia.ca>
>>>>  wrote:
>>>>>
>>>>> Hello,
>>>>>
>>>>> addActionError() caused "Page not found (404)" Error.
>>>>>
>>>>> (1) Action1.java
>>>>>    browsing all records using displaytag
>>>>>
>>>>> (2) Action2.java
>>>>>    if just say:
>>>>>    return "view"; go to Action1 successfully
>>>>>
>>>>>    if:
>>>>>    addActionError(...); //then
>>>>>    return "view";
>>>>>    Got an "Page not found (404)" exception.
>>>>>
>>>>> Does anyone know what cause the problem?
>>>>>
>>>>> Thanks a lot!
>>>>> Emi
>>>>>
>>>>> --
>>>>> <result name="view" type="redirectAction">
>>>>>   <param name="actionName">ProcessAction1</param>
>>>>>   <param name="namespace">/Action</param>
>>>>> </result>
>>>
>
>
> --
> Emi Lu, ENCS, Concordia University, Montreal H3G 1M8
> emilu@encs.concordia.ca        +1 514 848-2424 x5884
>

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


Re: addActionError() caused "Page not found (404)".

Posted by Emi Lu <em...@encs.concordia.ca>.
Hello,

All right, put "input".

I found this:
http://glindholm.wordpress.com/2008/07/02/preserving-messages-across-a-redirect-in-struts-2/

But no one ever provide an example of where to set input feature.

My situation is:
========================
(part1)

<action name="*Action1"  method="{1}" class="Action1">
    <result name="success"  type="tiles">browse_action1</result>
</action>


(part2)
<!-- want to go to view Action1 with action messages displayed -->
<action name="*Action2"  method="{1}" class="Action2">
    <result name="view_action1" type="redirectAction">
       <param name="actionName">Action1</param>
    </result>
</action>

"Input" should be added to (part1) or (part2)?

Thanks a lot!
Emi







> On Thu, Apr 14, 2011 at 12:18 PM, Aner Perez<an...@ncstech.com>  wrote:
>> It's annoying because it uses a side effect to figure out if validation failed.
>> Instead of setting some flag when any validation fails and using that flag
>> to determine if the INPUT result should be displayed, it is using the number
>> of error messages to determine if there were any validation errors.
>
> A flag is a side-effect too; any non-local phenomenon is a side-effect
> by definition.
>
>> It violates the principle of least surprise because the action method got
>> called and it returned a result.  This is the result the programmer expects
>> to be rendered.  Especially if there were no validation errors, only error
>> messages added by the application code.
>
> I have some sympathy for this argument and will update the
> documentation to make the behavior clearer.
>
> Ultimately, if errors are detected, IMO the workflow interceptor is
> doing the right thing: how the errors are indicated seems to be a
> non-issue, other than a need to clarify that errors are indicated by
> the presence of error messages.
>
> I haven't had a use-case where the presence of errors means that
> processing should continue as normal (and the framework provides a
> trivial workaround when it does), but I agree it should be spelled
> out.
>
> Dave
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>


-- 
Emi Lu, ENCS, Concordia University, Montreal H3G 1M8
emilu@encs.concordia.ca        +1 514 848-2424 x5884

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


Re: addActionError() caused "Page not found (404)".

Posted by Dave Newton <da...@gmail.com>.
On Thu, Apr 14, 2011 at 12:18 PM, Aner Perez <an...@ncstech.com> wrote:
> It's annoying because it uses a side effect to figure out if validation failed.
> Instead of setting some flag when any validation fails and using that flag
> to determine if the INPUT result should be displayed, it is using the number
> of error messages to determine if there were any validation errors.

A flag is a side-effect too; any non-local phenomenon is a side-effect
by definition.

> It violates the principle of least surprise because the action method got
> called and it returned a result.  This is the result the programmer expects
> to be rendered.  Especially if there were no validation errors, only error
> messages added by the application code.

I have some sympathy for this argument and will update the
documentation to make the behavior clearer.

Ultimately, if errors are detected, IMO the workflow interceptor is
doing the right thing: how the errors are indicated seems to be a
non-issue, other than a need to clarify that errors are indicated by
the presence of error messages.

I haven't had a use-case where the presence of errors means that
processing should continue as normal (and the framework provides a
trivial workaround when it does), but I agree it should be spelled
out.

Dave

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


Re: addActionError() caused "Page not found (404)".

Posted by Dave Newton <da...@gmail.com>.
On Thu, Apr 14, 2011 at 3:12 PM, Emi Lu wrote:
> I mean that I agree with Aner. If I just "addActionErrorMessage", but not a
> real ActionError, I would not expect the interceptor stop the workflow :-(

There's no such thing as a "real ActionError". There are error messages.

If there are error messages, there are errors. The default workflow
interceptor behavior when there's errors is to take you to the action
input that caused the errors to happen. The input result name can be
changed to be "success" or whatever you really want to go to.

Dave

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


Re: addActionError() caused "Page not found (404)".

Posted by Emi Lu <em...@encs.concordia.ca>.
Hi Dave,

> On Thu, Apr 14, 2011 at 2:43 PM, Emi Lu wrote:
>>> Especially if there were no validation errors,
>>> only error messages added by the application code.
>> By the way, I agree with this very much!
>
> So you're basically saying that you want to differentiate between two
> different types of errors, or at the very least have two different
> workflows based on the error type? That would require a custom
> interceptor and (at least two) collections of error messages.
>
> Or you could set the workflow.inputResultName for the action you don't
> want to add an "input" to.

 >> it is using the number of error messages to determine
 >> if there were any validation errors.

I mean that I agree with Aner. If I just "addActionErrorMessage", but 
not a real ActionError, I would not expect the interceptor stop the 
workflow :-( Or, as you suggested that if it could be specified in the 
online document, it will help as well.

Dave, could you provide an example, what should I put "input" for my 
case? in Struts.xml, I have:

(part1)
<action name="*Action1"  method="{1}" class="Action1">
    <result name="success"  type="tiles">browse_action1</result>
</action>


(part2)
<!-- want to go to view Action1 with action messages displayed -->
<action name="*Action2"  method="{1}" class="Action2">
    <result name="view_action1" type="redirectAction">
       <param name="actionName">Action1</param>
    </result>
</action>

"Input" should be added to (part1) or (part2), how?

Thanks a lot!
Emi

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


Re: addActionError() caused "Page not found (404)".

Posted by Dave Newton <da...@gmail.com>.
On Thu, Apr 14, 2011 at 2:43 PM, Emi Lu wrote:
>> Especially if there were no validation errors,
>> only error messages added by the application code.
> By the way, I agree with this very much!

So you're basically saying that you want to differentiate between two
different types of errors, or at the very least have two different
workflows based on the error type? That would require a custom
interceptor and (at least two) collections of error messages.

Or you could set the workflow.inputResultName for the action you don't
want to add an "input" to.

Dave

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


Re: addActionError() caused "Page not found (404)".

Posted by Emi Lu <em...@encs.concordia.ca>.
> Especially if there were no validation errors,
> only error messages added by the application code.

By the way, I agree with this very much!
Emi

>
> - Aner
>
> On 04/14/2011 12:00 PM, Dave Newton wrote:
>> On Thu, Apr 14, 2011 at 11:54 AM, Aner Perez<an...@ncstech.com> wrote:
>>> This is an annoying "feature" of the Workflow interceptor. If
>>> ValidationAware.hasErrors() returns
>>> true, the interceptor chain is stopped and Action.INPUT is returned.
>>> If you put error messages
>>> on your action, it will make hasErrors return true which will force
>>> the "input" result to be returned.
>>
>> How is it annoying? That's the interceptor's purpose in life, to
>> handle workflow. Errors usually change flow. "Mucking" with the
>> interceptor is as simple as changing the inputResultName property for
>> the specific action, although in this case I don't really see why it'd
>> be worth it.
>>
>> Dave
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org


-- 
Emi Lu, ENCS, Concordia University, Montreal H3G 1M8
emilu@encs.concordia.ca        +1 514 848-2424 x5884

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


Re: addActionError() caused "Page not found (404)".

Posted by Aner Perez <an...@ncstech.com>.
It's annoying because it uses a side effect to figure out if 
validation failed.  Instead of setting some flag when any validation 
fails and using that flag to determine if the INPUT result should be 
displayed, it is using the number of error messages to determine if 
there were any validation errors.

It violates the principle of least surprise because the action method 
got called and it returned a result.  This is the result the 
programmer expects to be rendered.  Especially if there were no 
validation errors, only error messages added by the application code.

	- Aner

On 04/14/2011 12:00 PM, Dave Newton wrote:
> On Thu, Apr 14, 2011 at 11:54 AM, Aner Perez<an...@ncstech.com>  wrote:
>> This is an annoying "feature" of the Workflow interceptor.  If ValidationAware.hasErrors() returns
>> true, the interceptor chain is stopped and Action.INPUT is returned.  If you put error messages
>> on your action, it will make hasErrors return true which will force the "input" result to be returned.
>
> How is it annoying? That's the interceptor's purpose in life, to
> handle workflow. Errors usually change flow. "Mucking" with the
> interceptor is as simple as changing the inputResultName property for
> the specific action, although in this case I don't really see why it'd
> be worth it.
>
> Dave

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


Re: addActionError() caused "Page not found (404)".

Posted by Dave Newton <da...@gmail.com>.
On Thu, Apr 14, 2011 at 11:54 AM, Aner Perez <an...@ncstech.com> wrote:
> This is an annoying "feature" of the Workflow interceptor.  If ValidationAware.hasErrors() returns
> true, the interceptor chain is stopped and Action.INPUT is returned.  If you put error messages
> on your action, it will make hasErrors return true which will force the "input" result to be returned.

How is it annoying? That's the interceptor's purpose in life, to
handle workflow. Errors usually change flow. "Mucking" with the
interceptor is as simple as changing the inputResultName property for
the specific action, although in this case I don't really see why it'd
be worth it.

Dave

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


Re: addActionError() caused "Page not found (404)".

Posted by Dave Newton <da...@gmail.com>.
On Thu, Apr 14, 2011 at 2:38 PM, Emi Lu wrote:
>> 1. Add an "input" result to your config as previously stated
> Do not know where/what should be set in struts.xml :-(

In the action that causes the 404 because there's no input.

Dave

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


Re: addActionError() caused "Page not found (404)".

Posted by Emi Lu <em...@encs.concordia.ca>.
Hi Aner,


> This is an annoying "feature" of the Workflow interceptor.  If
> ValidationAware.hasErrors() returns true, the interceptor chain is
> stopped and Action.INPUT is returned. If you put error messages on your
> action, it will make hasErrors return true which will force the "input"
> result to be returned.
>
> Your options are:
>
> 1. Add an "input" result to your config as previously stated

Do not know where/what should be set in struts.xml :-(

> 2. use addActionMessage() instead
This solution I tried, and it works fine!


> 3. Override this behavior (override hasErrors() or muck with the
> interceptor config)

this is takes more time; I may not pick this one.


If I could not make (1) works, I will probably pick (2).

Till now, I am already very satisfied with the answer! Thanks you very much!

Emi

>
> On 04/14/2011 10:12 AM, Emi Lu wrote:
>>
>>> I'm still guessing it's a validation thing--put an "input" result in
>>> there and check.
>>>
>>> Also, by naming the results the same as the actions you're actually
>>> circumventing one of the reasons for abstracting the result names from
>>> everything else. Even for test apps it's just not a good habit, IMO.
>>
>> So, what is the reason? I did not put input :-(
>>
>> I am looking for the answer......
>>
>> Emi
>>
>>
>>>
>>> On Wed, Apr 13, 2011 at 4:43 PM, Emi Lu<em...@encs.concordia.ca> wrote:
>>>>> Depends on where you added the addActionError() call, at the very
>>>>> least--an action error indicates a validation problem, so it may be
>>>>> trying to go to the "input" result.
>>>>>
>>>>> Not enough information to help.
>>>>
>>>> It seems that I may get my answer soon!
>>>>
>>>> More info comes:
>>>> =========================
>>>> (1) Action1.java
>>>> public class Action1 extends ActionSupport
>>>> { .. ....
>>>> public String execute() throws Exception
>>>> {
>>>> HttpServletRequest req = ServletActionContext.getRequest();
>>>> HttpServletResponse res = ServletActionContext.getResponse();
>>>> /* paging method for display tag */
>>>> process_paging(req);
>>>> return SUCCESS;
>>>> } ...
>>>> }
>>>>
>>>>
>>>> (2) Action1 in struts.xml
>>>> <action name="*Action1" method="{1}" class="Action1">
>>>> <result name="success" type="tiles">browse_action1</result>
>>>> </action>
>>>>
>>>>
>>>> (3) tiles for browse_action1
>>>> <definition name= "browse_action1" template="t.jsp">
>>>> <put-attribute name="body" value="browse_action1.jsp" />
>>>> </definition>
>>>>
>>>>
>>>> (4) browse_action1.jsp
>>>> ... ...
>>>> <s:form id="Action1Form"
>>>> name="Action1Form"
>>>> action="Action1"
>>>> validate="true"
>>>> theme="simple">
>>>> <display:table id="row_rec"
>>>> name="alist_paging_bean"
>>>> export="true"
>>>> class="simple"
>>>> cellspacing="0"
>>>> cellpadding="5"
>>>> requestURI="Action1"
>>>> keepStatus="true"
>>>> pagesize="<%=bean_display.getPageSize() %>"
>>>> partialList="true"
>>>> size="<%=bean_display.getTotalRecNum() %>"
>>>> sort="external"
>>>>>
>>>> <display:column property="c1" title="c1" sortName="c1"
>>>> sortable="true"/>
>>>> ... ...
>>>> </display:table>
>>>>
>>>> <s:submit value="Update" theme="simple" action="update_guiAction2">
>>>> </s:submit>
>>>> </s:form>
>>>>
>>>>
>>>> (5) Action2.java
>>>> public class ProcessThesis extends ActionSupport
>>>> {
>>>> public String update_gui() throws Exception
>>>> {
>>>> HttpServletRequest req = ServletActionContext.getRequest();
>>>> HttpServletResponse res = ServletActionContext.getResponse();
>>>> String[] error_arr = new String[2];
>>>> String[] checkbox_value =req.getParameterValues("checkbox_value");
>>>> if(Utils.isEmpty(checkbox_value))
>>>> {
>>>> addActionError(this.getText("at.least.one.rec.error"));
>>>> return "view_action1"; //Step_Q1 -> "Page not found()404"
>>>> }
>>>>
>>>> return "view_action1" ; //Step_Q2 -> no error at all
>>>> }
>>>> }
>>>>
>>>>
>>>> If remove "addActionError(this.getText("at.least.one.rec.error"))",
>>>> return
>>>> successfully! Otherwise, "Page not found 404"returned!
>>>>
>>>> (6) struts.xml for Action2
>>>> <action name="*Action2" method="{1}" class="Action2">
>>>> <result name="view_action1" type="redirectAction">
>>>> <param name="actionName">Action1</param>
>>>> </result>
>>>> </action>
>>>>
>>>> I tried also the following, but it does not work either:
>>>> <action name="*Action2" method="{1}" class="Action2">
>>>> <result name="view_action1" type="tiles">browse_action1</result>
>>>> </action>
>>>>
>>>> Thanks a lot!
>>>> Emi
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>>
>>>>> On Wed, Apr 13, 2011 at 3:19 PM, Emi Lu<em...@encs.concordia.ca>
>>>>> wrote:
>>>>>>
>>>>>> Hello,
>>>>>>
>>>>>> addActionError() caused "Page not found (404)" Error.
>>>>>>
>>>>>> (1) Action1.java
>>>>>> browsing all records using displaytag
>>>>>>
>>>>>> (2) Action2.java
>>>>>> if just say:
>>>>>> return "view"; go to Action1 successfully
>>>>>>
>>>>>> if:
>>>>>> addActionError(...); //then
>>>>>> return "view";
>>>>>> Got an "Page not found (404)" exception.
>>>>>>
>>>>>> Does anyone know what cause the problem?
>>>>>>
>>>>>> Thanks a lot!
>>>>>> Emi
>>>>>>
>>>>>> --
>>>>>> <result name="view" type="redirectAction">
>>>>>> <param name="actionName">ProcessAction1</param>
>>>>>> <param name="namespace">/Action</param>
>>>>>> </result>
>>>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org


-- 
Emi Lu, ENCS, Concordia University, Montreal H3G 1M8
emilu@encs.concordia.ca        +1 514 848-2424 x5884

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


Re: addActionError() caused "Page not found (404)".

Posted by Aner Perez <an...@ncstech.com>.
This is an annoying "feature" of the Workflow interceptor.  If 
ValidationAware.hasErrors() returns true, the interceptor chain is 
stopped and Action.INPUT is returned.  If you put error messages on 
your action, it will make hasErrors return true which will force the 
"input" result to be returned.

Your options are:

1. Add an "input" result to your config as previously stated
2. use addActionMessage() instead
3. Override this behavior (override hasErrors() or muck with the 
interceptor config)

	- Aner

On 04/14/2011 10:12 AM, Emi Lu wrote:
>
>> I'm still guessing it's a validation thing--put an "input" result in
>> there and check.
>>
>> Also, by naming the results the same as the actions you're actually
>> circumventing one of the reasons for abstracting the result names from
>> everything else. Even for test apps it's just not a good habit, IMO.
>
> So, what is the reason? I did not put input :-(
>
> I am looking for the answer......
>
> Emi
>
>
>>
>> On Wed, Apr 13, 2011 at 4:43 PM, Emi Lu<em...@encs.concordia.ca> wrote:
>>>> Depends on where you added the addActionError() call, at the very
>>>> least--an action error indicates a validation problem, so it may be
>>>> trying to go to the "input" result.
>>>>
>>>> Not enough information to help.
>>>
>>> It seems that I may get my answer soon!
>>>
>>> More info comes:
>>> =========================
>>> (1) Action1.java
>>> public class Action1 extends ActionSupport
>>> { .. ....
>>> public String execute() throws Exception
>>> {
>>> HttpServletRequest req = ServletActionContext.getRequest();
>>> HttpServletResponse res = ServletActionContext.getResponse();
>>> /* paging method for display tag */
>>> process_paging(req);
>>> return SUCCESS;
>>> } ...
>>> }
>>>
>>>
>>> (2) Action1 in struts.xml
>>> <action name="*Action1" method="{1}" class="Action1">
>>> <result name="success" type="tiles">browse_action1</result>
>>> </action>
>>>
>>>
>>> (3) tiles for browse_action1
>>> <definition name= "browse_action1" template="t.jsp">
>>> <put-attribute name="body" value="browse_action1.jsp" />
>>> </definition>
>>>
>>>
>>> (4) browse_action1.jsp
>>> ... ...
>>> <s:form id="Action1Form"
>>> name="Action1Form"
>>> action="Action1"
>>> validate="true"
>>> theme="simple">
>>> <display:table id="row_rec"
>>> name="alist_paging_bean"
>>> export="true"
>>> class="simple"
>>> cellspacing="0"
>>> cellpadding="5"
>>> requestURI="Action1"
>>> keepStatus="true"
>>> pagesize="<%=bean_display.getPageSize() %>"
>>> partialList="true"
>>> size="<%=bean_display.getTotalRecNum() %>"
>>> sort="external"
>>>>
>>> <display:column property="c1" title="c1" sortName="c1"
>>> sortable="true"/>
>>> ... ...
>>> </display:table>
>>>
>>> <s:submit value="Update" theme="simple" action="update_guiAction2">
>>> </s:submit>
>>> </s:form>
>>>
>>>
>>> (5) Action2.java
>>> public class ProcessThesis extends ActionSupport
>>> {
>>> public String update_gui() throws Exception
>>> {
>>> HttpServletRequest req = ServletActionContext.getRequest();
>>> HttpServletResponse res = ServletActionContext.getResponse();
>>> String[] error_arr = new String[2];
>>> String[] checkbox_value =req.getParameterValues("checkbox_value");
>>> if(Utils.isEmpty(checkbox_value))
>>> {
>>> addActionError(this.getText("at.least.one.rec.error"));
>>> return "view_action1"; //Step_Q1 -> "Page not found()404"
>>> }
>>>
>>> return "view_action1" ; //Step_Q2 -> no error at all
>>> }
>>> }
>>>
>>>
>>> If remove "addActionError(this.getText("at.least.one.rec.error"))",
>>> return
>>> successfully! Otherwise, "Page not found 404"returned!
>>>
>>> (6) struts.xml for Action2
>>> <action name="*Action2" method="{1}" class="Action2">
>>> <result name="view_action1" type="redirectAction">
>>> <param name="actionName">Action1</param>
>>> </result>
>>> </action>
>>>
>>> I tried also the following, but it does not work either:
>>> <action name="*Action2" method="{1}" class="Action2">
>>> <result name="view_action1" type="tiles">browse_action1</result>
>>> </action>
>>>
>>> Thanks a lot!
>>> Emi
>>>
>>>
>>>
>>>
>>>
>>>>
>>>> On Wed, Apr 13, 2011 at 3:19 PM, Emi Lu<em...@encs.concordia.ca>
>>>> wrote:
>>>>>
>>>>> Hello,
>>>>>
>>>>> addActionError() caused "Page not found (404)" Error.
>>>>>
>>>>> (1) Action1.java
>>>>> browsing all records using displaytag
>>>>>
>>>>> (2) Action2.java
>>>>> if just say:
>>>>> return "view"; go to Action1 successfully
>>>>>
>>>>> if:
>>>>> addActionError(...); //then
>>>>> return "view";
>>>>> Got an "Page not found (404)" exception.
>>>>>
>>>>> Does anyone know what cause the problem?
>>>>>
>>>>> Thanks a lot!
>>>>> Emi
>>>>>
>>>>> --
>>>>> <result name="view" type="redirectAction">
>>>>> <param name="actionName">ProcessAction1</param>
>>>>> <param name="namespace">/Action</param>
>>>>> </result>
>>>
>
>

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


Re: addActionError() caused "Page not found (404)".

Posted by Emi Lu <em...@encs.concordia.ca>.
> I'm still guessing it's a validation thing--put an "input" result in
> there and check.
>
> Also, by naming the results the same as the actions you're actually
> circumventing one of the reasons for abstracting the result names from
> everything else. Even for test apps it's just not a good habit, IMO.

So, what is the reason? I did not put input :-(

I am looking for the answer......

Emi


>
> On Wed, Apr 13, 2011 at 4:43 PM, Emi Lu<em...@encs.concordia.ca>  wrote:
>>> Depends on where you added the addActionError() call, at the very
>>> least--an action error indicates a validation problem, so it may be
>>> trying to go to the "input" result.
>>>
>>> Not enough information to help.
>>
>> It seems that I may get my answer soon!
>>
>> More info comes:
>> =========================
>> (1) Action1.java
>> public class Action1 extends ActionSupport
>> {  .. ....
>>    public String execute() throws Exception
>>    {
>>       HttpServletRequest  req  = ServletActionContext.getRequest();
>>       HttpServletResponse res  = ServletActionContext.getResponse();
>>       /* paging method for display tag */
>>       process_paging(req);
>>       return SUCCESS;
>>    }  ...
>> }
>>
>>
>> (2) Action1 in struts.xml
>> <action name="*Action1"  method="{1}" class="Action1">
>>   <result name="success" type="tiles">browse_action1</result>
>> </action>
>>
>>
>> (3) tiles for browse_action1
>> <definition name= "browse_action1"  template="t.jsp">
>>    <put-attribute name="body"  value="browse_action1.jsp" />
>> </definition>
>>
>>
>> (4) browse_action1.jsp
>> ... ...
>> <s:form id="Action1Form"
>>    name="Action1Form"
>>    action="Action1"
>>    validate="true"
>>    theme="simple">
>> <display:table id="row_rec"
>>                name="alist_paging_bean"
>>                export="true"
>>                class="simple"
>>                cellspacing="0"
>>                cellpadding="5"
>>                requestURI="Action1"
>>                keepStatus="true"
>>                pagesize="<%=bean_display.getPageSize() %>"
>>                partialList="true"
>>                size="<%=bean_display.getTotalRecNum() %>"
>>                sort="external"
>>>
>> <display:column property="c1" title="c1" sortName="c1" sortable="true"/>
>> ... ...
>> </display:table>
>>
>> <s:submit value="Update"  theme="simple" action="update_guiAction2">
>> </s:submit>
>> </s:form>
>>
>>
>> (5) Action2.java
>> public class ProcessThesis extends ActionSupport
>> {
>>    public String update_gui() throws Exception
>>    {
>>       HttpServletRequest  req  = ServletActionContext.getRequest();
>>       HttpServletResponse res  = ServletActionContext.getResponse();
>>       String[]    error_arr    = new String[2];
>>    String[] checkbox_value =req.getParameterValues("checkbox_value");
>>       if(Utils.isEmpty(checkbox_value))
>>       {
>>          addActionError(this.getText("at.least.one.rec.error"));
>>          return "view_action1";   //Step_Q1 ->  "Page not found()404"
>>       }
>>
>>       return "view_action1" ;   //Step_Q2 ->  no error at all
>>    }
>> }
>>
>>
>> If remove "addActionError(this.getText("at.least.one.rec.error"))", return
>> successfully! Otherwise, "Page not found 404"returned!
>>
>> (6) struts.xml for Action2
>> <action name="*Action2"  method="{1}" class="Action2">
>>    <result name="view_action1" type="redirectAction">
>>       <param name="actionName">Action1</param>
>>    </result>
>> </action>
>>
>> I tried also the following, but it does not work either:
>> <action name="*Action2"  method="{1}" class="Action2">
>> <result name="view_action1" type="tiles">browse_action1</result>
>> </action>
>>
>> Thanks a lot!
>> Emi
>>
>>
>>
>>
>>
>>>
>>> On Wed, Apr 13, 2011 at 3:19 PM, Emi Lu<em...@encs.concordia.ca>    wrote:
>>>>
>>>> Hello,
>>>>
>>>> addActionError() caused "Page not found (404)" Error.
>>>>
>>>> (1) Action1.java
>>>>     browsing all records using displaytag
>>>>
>>>> (2) Action2.java
>>>>     if just say:
>>>>     return "view"; go to Action1 successfully
>>>>
>>>>     if:
>>>>     addActionError(...); //then
>>>>     return "view";
>>>>     Got an "Page not found (404)" exception.
>>>>
>>>> Does anyone know what cause the problem?
>>>>
>>>> Thanks a lot!
>>>> Emi
>>>>
>>>> --
>>>> <result name="view" type="redirectAction">
>>>>    <param name="actionName">ProcessAction1</param>
>>>>    <param name="namespace">/Action</param>
>>>> </result>
>>


-- 
Emi Lu, ENCS, Concordia University, Montreal H3G 1M8
emilu@encs.concordia.ca        +1 514 848-2424 x5884

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


Re: addActionError() caused "Page not found (404)".

Posted by Dave Newton <da...@gmail.com>.
I'm still guessing it's a validation thing--put an "input" result in
there and check.

Also, by naming the results the same as the actions you're actually
circumventing one of the reasons for abstracting the result names from
everything else. Even for test apps it's just not a good habit, IMO.

Dave

On Wed, Apr 13, 2011 at 4:43 PM, Emi Lu <em...@encs.concordia.ca> wrote:
>> Depends on where you added the addActionError() call, at the very
>> least--an action error indicates a validation problem, so it may be
>> trying to go to the "input" result.
>>
>> Not enough information to help.
>
> It seems that I may get my answer soon!
>
> More info comes:
> =========================
> (1) Action1.java
> public class Action1 extends ActionSupport
> {  .. ....
>   public String execute() throws Exception
>   {
>      HttpServletRequest  req  = ServletActionContext.getRequest();
>      HttpServletResponse res  = ServletActionContext.getResponse();
>      /* paging method for display tag */
>      process_paging(req);
>      return SUCCESS;
>   }  ...
> }
>
>
> (2) Action1 in struts.xml
> <action name="*Action1"  method="{1}" class="Action1">
>  <result name="success" type="tiles">browse_action1</result>
> </action>
>
>
> (3) tiles for browse_action1
> <definition name= "browse_action1"  template="t.jsp">
>   <put-attribute name="body"  value="browse_action1.jsp" />
> </definition>
>
>
> (4) browse_action1.jsp
> ... ...
> <s:form id="Action1Form"
>   name="Action1Form"
>   action="Action1"
>   validate="true"
>   theme="simple">
> <display:table id="row_rec"
>               name="alist_paging_bean"
>               export="true"
>               class="simple"
>               cellspacing="0"
>               cellpadding="5"
>               requestURI="Action1"
>               keepStatus="true"
>               pagesize="<%=bean_display.getPageSize() %>"
>               partialList="true"
>               size="<%=bean_display.getTotalRecNum() %>"
>               sort="external"
>>
> <display:column property="c1" title="c1" sortName="c1" sortable="true"/>
> ... ...
> </display:table>
>
> <s:submit value="Update"  theme="simple" action="update_guiAction2">
> </s:submit>
> </s:form>
>
>
> (5) Action2.java
> public class ProcessThesis extends ActionSupport
> {
>   public String update_gui() throws Exception
>   {
>      HttpServletRequest  req  = ServletActionContext.getRequest();
>      HttpServletResponse res  = ServletActionContext.getResponse();
>      String[]    error_arr    = new String[2];
>   String[] checkbox_value =req.getParameterValues("checkbox_value");
>      if(Utils.isEmpty(checkbox_value))
>      {
>         addActionError(this.getText("at.least.one.rec.error"));
>         return "view_action1";   //Step_Q1 -> "Page not found()404"
>      }
>
>      return "view_action1" ;   //Step_Q2 -> no error at all
>   }
> }
>
>
> If remove "addActionError(this.getText("at.least.one.rec.error"))", return
> successfully! Otherwise, "Page not found 404"returned!
>
> (6) struts.xml for Action2
> <action name="*Action2"  method="{1}" class="Action2">
>   <result name="view_action1" type="redirectAction">
>      <param name="actionName">Action1</param>
>   </result>
> </action>
>
> I tried also the following, but it does not work either:
> <action name="*Action2"  method="{1}" class="Action2">
> <result name="view_action1" type="tiles">browse_action1</result>
> </action>
>
> Thanks a lot!
> Emi
>
>
>
>
>
>>
>> On Wed, Apr 13, 2011 at 3:19 PM, Emi Lu<em...@encs.concordia.ca>  wrote:
>>>
>>> Hello,
>>>
>>> addActionError() caused "Page not found (404)" Error.
>>>
>>> (1) Action1.java
>>>    browsing all records using displaytag
>>>
>>> (2) Action2.java
>>>    if just say:
>>>    return "view"; go to Action1 successfully
>>>
>>>    if:
>>>    addActionError(...); //then
>>>    return "view";
>>>    Got an "Page not found (404)" exception.
>>>
>>> Does anyone know what cause the problem?
>>>
>>> Thanks a lot!
>>> Emi
>>>
>>> --
>>> <result name="view" type="redirectAction">
>>>   <param name="actionName">ProcessAction1</param>
>>>   <param name="namespace">/Action</param>
>>> </result>
>

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


Re: addActionError() caused "Page not found (404)".

Posted by Emi Lu <em...@encs.concordia.ca>.
> Depends on where you added the addActionError() call, at the very
> least--an action error indicates a validation problem, so it may be
> trying to go to the "input" result.
>
> Not enough information to help.
It seems that I may get my answer soon!

More info comes:
=========================
(1) Action1.java
public class Action1 extends ActionSupport
{  .. ....
    public String execute() throws Exception
    {
       HttpServletRequest  req  = ServletActionContext.getRequest();
       HttpServletResponse res  = ServletActionContext.getResponse();
       /* paging method for display tag */
       process_paging(req);
       return SUCCESS;
    }  ...
}


(2) Action1 in struts.xml
<action name="*Action1"  method="{1}" class="Action1">
   <result name="success" type="tiles">browse_action1</result>
</action>


(3) tiles for browse_action1
<definition name= "browse_action1"  template="t.jsp">
    <put-attribute name="body"  value="browse_action1.jsp" />
</definition>


(4) browse_action1.jsp
... ...
<s:form id="Action1Form"
    name="Action1Form"
    action="Action1"
    validate="true"
    theme="simple">
<display:table id="row_rec"
                name="alist_paging_bean"
                export="true"
                class="simple"
                cellspacing="0"
                cellpadding="5"
                requestURI="Action1"
                keepStatus="true"
                pagesize="<%=bean_display.getPageSize() %>"
                partialList="true"
                size="<%=bean_display.getTotalRecNum() %>"
                sort="external"
 >
<display:column property="c1" title="c1" sortName="c1" sortable="true"/>
... ...
</display:table>

<s:submit value="Update"  theme="simple" action="update_guiAction2"> 
</s:submit>
</s:form>


(5) Action2.java
public class ProcessThesis extends ActionSupport
{
    public String update_gui() throws Exception
    {
       HttpServletRequest  req  = ServletActionContext.getRequest();
       HttpServletResponse res  = ServletActionContext.getResponse();
       String[]    error_arr    = new String[2];
    String[] checkbox_value =req.getParameterValues("checkbox_value");
       if(Utils.isEmpty(checkbox_value))
       {
          addActionError(this.getText("at.least.one.rec.error"));
          return "view_action1";   //Step_Q1 -> "Page not found()404"
       }

       return "view_action1" ;   //Step_Q2 -> no error at all
    }
}


If remove "addActionError(this.getText("at.least.one.rec.error"))", 
return successfully! Otherwise, "Page not found 404"returned!

(6) struts.xml for Action2
<action name="*Action2"  method="{1}" class="Action2">
    <result name="view_action1" type="redirectAction">
       <param name="actionName">Action1</param>
    </result>
</action>

I tried also the following, but it does not work either:
<action name="*Action2"  method="{1}" class="Action2">
<result name="view_action1" type="tiles">browse_action1</result>
</action>

Thanks a lot!
Emi





>
> On Wed, Apr 13, 2011 at 3:19 PM, Emi Lu<em...@encs.concordia.ca>  wrote:
>> Hello,
>>
>> addActionError() caused "Page not found (404)" Error.
>>
>> (1) Action1.java
>>     browsing all records using displaytag
>>
>> (2) Action2.java
>>     if just say:
>>     return "view"; go to Action1 successfully
>>
>>     if:
>>     addActionError(...); //then
>>     return "view";
>>     Got an "Page not found (404)" exception.
>>
>> Does anyone know what cause the problem?
>>
>> Thanks a lot!
>> Emi
>>
>> --
>> <result name="view" type="redirectAction">
>>    <param name="actionName">ProcessAction1</param>
>>    <param name="namespace">/Action</param>
>> </result>

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


Re: addActionError() caused "Page not found (404)".

Posted by Dave Newton <da...@gmail.com>.
Depends on where you added the addActionError() call, at the very
least--an action error indicates a validation problem, so it may be
trying to go to the "input" result.

Not enough information to help.

Dave

On Wed, Apr 13, 2011 at 3:19 PM, Emi Lu <em...@encs.concordia.ca> wrote:
> Hello,
>
> addActionError() caused "Page not found (404)" Error.
>
> (1) Action1.java
>    browsing all records using displaytag
>
> (2) Action2.java
>    if just say:
>    return "view"; go to Action1 successfully
>
>    if:
>    addActionError(...); //then
>    return "view";
>    Got an "Page not found (404)" exception.
>
> Does anyone know what cause the problem?
>
> Thanks a lot!
> Emi
>
> --
> <result name="view" type="redirectAction">
>   <param name="actionName">ProcessAction1</param>
>   <param name="namespace">/Action</param>
> </result>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

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