You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Lukasz Lenart (JIRA)" <ji...@apache.org> on 2016/09/01 07:34:20 UTC

[jira] [Commented] (WW-4683) some of actions did not work.

    [ https://issues.apache.org/jira/browse/WW-4683?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15454622#comment-15454622 ] 

Lukasz Lenart commented on WW-4683:
-----------------------------------

It's probably due to you are writing directly to response in action and result cannot generate response as response was already committed.

> some of actions did not work.
> -----------------------------
>
>                 Key: WW-4683
>                 URL: https://issues.apache.org/jira/browse/WW-4683
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Core Results
>    Affects Versions: 2.3.24
>         Environment: struts2.3.24.3,weblogic12c, jdk8,centos7  
>            Reporter: DavidLiu
>             Fix For: 2.3.31, 2.5.3
>
>
> If I change struts.devMode =false ,the struts2 occur error. the error info as below.
> error message : No result defined for action guangdu.admin.action.BorrowerAccountManager and result success
> If I change struts.devMode =true ,the struts2 work well.
> {code:java}
>  @Action("/borrowerAccount/depositSaving")
>     public String depositSaving(){
>         try{
>             if(amount<=0){
>                 throw new IllegalArgumentException("金额不能小于0");
>             }
>             String orderNo=_sequence.generateBackgroundSequence();
>             UserAgentInfo userAgentInfo=new UserAgentInfo(request.getRemoteAddr(),"web",request.getSession().getAttribute("username").toString(),"admin");
>             String html=orderService.generatorDeposit(orderNo,enterpriseId,-1,amount,request.getRequestURL().toString().replace("depositSaving", "manager"),userAgentInfo);
>             generateHtml(html);
>             return SUCCESS;
>         }
>         catch (Exception exp){
>             return showMessageAction(SUCCESS,exp);
>         }
>         catch (Error error){
>             return showMessageAction(SUCCESS,error);
>         }
>     }
> private void generateHtml(String html) throws IOException {
>         HttpServletResponse res = ServletActionContext.getResponse();
>         res.setContentType("html/text;charset=utf-8");
>         PrintWriter out = res.getWriter();
>         out.write(html);
>     }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)