Return-Path: X-Original-To: apmail-struts-user-archive@www.apache.org Delivered-To: apmail-struts-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 46AFE10F34 for ; Fri, 15 Nov 2013 09:03:46 +0000 (UTC) Received: (qmail 27255 invoked by uid 500); 15 Nov 2013 09:03:42 -0000 Delivered-To: apmail-struts-user-archive@struts.apache.org Received: (qmail 26742 invoked by uid 500); 15 Nov 2013 09:03:35 -0000 Mailing-List: contact user-help@struts.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Struts Users Mailing List" Reply-To: "Struts Users Mailing List" Delivered-To: mailing list user@struts.apache.org Received: (qmail 26727 invoked by uid 99); 15 Nov 2013 09:03:33 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 15 Nov 2013 09:03:33 +0000 X-ASF-Spam-Status: No, hits=2.2 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [98.136.216.217] (HELO nm31-vm10.bullet.mail.gq1.yahoo.com) (98.136.216.217) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 15 Nov 2013 09:03:24 +0000 Received: from [216.39.60.184] by nm31.bullet.mail.gq1.yahoo.com with NNFMP; 15 Nov 2013 09:03:03 -0000 Received: from [98.137.12.201] by tm20.bullet.mail.gq1.yahoo.com with NNFMP; 15 Nov 2013 09:03:03 -0000 Received: from [127.0.0.1] by omp1009.mail.gq1.yahoo.com with NNFMP; 15 Nov 2013 09:03:02 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 988945.51971.bm@omp1009.mail.gq1.yahoo.com Received: (qmail 89789 invoked by uid 60001); 15 Nov 2013 09:03:02 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1384506182; bh=e6G3tpQhyU/am3KEYH01xsooEO0GPUG5VkiwDXDOzeA=; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:Message-ID:Date:From:Reply-To:Subject:To:MIME-Version:Content-Type; b=47qmuL7+6vMyWxmzArsrpycEObIkANNv7K123/8icWmS3A2t+75FU1trA01AFlPeg5+7ulnSridlih+B7vBtW94TRbD6VSmCgRv3zD54KYXWiBlfB9sk7IeFQziVN/H0MKWe4/M+rp0xQS4ucn8gvgp5yEMWNgq3+vNFBqFtU/4= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:Message-ID:Date:From:Reply-To:Subject:To:MIME-Version:Content-Type; b=seFUTg0mfe8pglMxIla/4gwHUR+OcfVjIClB1psMJsjeIRH0q4UjSZLr4P/4ElqoDScb2mkSHhWIJb1mmBJm0440V4/59UVD+3uPHEIwSfrXGylUp6xh7hq84KpEyy3AxSwi5oamp8apVH4DOilPn7d1fiGRNfZLr1cvTLYiQrM=; X-YMail-OSG: X3udBhgVM1mEtbehUBj45dRrEFxCpjldv7tHEs5maR3jYpo k2fG7cwRnULxxlmucuwire8O9DZKXBXq8OAohmbAzYgCRuyP5LnYRIs.xdeq VY42gsPeuT.E9p4DgWmM3NtGREVphoSUruH.vHUieQE_ZojEIowRNcEGEO47 rkldMo04gYs5kJ7gKDsvIJnDOIkqc15WIFo.U5NPogSK7CMWm4PaRuC4i_Nh EXS7uyIrje2mkGwAOFOSqXzeJyt.EC0.XT1PippAmjsp5iP1P8hEho2I_Rh6 MDZeHpvjA3CwqehtdPkfwkutO64WsjZxYatWjbWeRoS_xJyKb39agOObflzy HHWNOhSz.YWaPucpknTReWfqCBgsWjpxdP_PJVQSHBuPyNQEpgKk6Ub4GMtd j.OQubkKtbJFJcWQKTz4fMm3tdwpXdZaNLrlsmfXa4xllHsX2ROYSORfe5ty 2ooc6o7xFAnuzmYH.STstRos4qpCyQm18kjEYKPJ7v0XaMwPBdf.AmolZUvZ 1Wjoeoo_BbeXdDX6FIxGZK5TnLyw4w_2nT4gWVo1bI2N1waAoEklmPQZW Received: from [37.221.6.11] by web164003.mail.gq1.yahoo.com via HTTP; Fri, 15 Nov 2013 01:03:02 PST X-Rocket-MIMEInfo: 002.001,SGksCgpXZSBhcmUgdXNpbmcgc3RydXRzMiBKU09OVmFsaWRhdGlvbldpdGhJbnRlcmNlcHRvci4gVGhpcyBpbnRlcmNlcHRvciBncmFicyB0aGUgZXJyb3JzIGZyb20gdmFsaWRhdGlvbiBhbmQgY29udmVydCB0aGVtIHRvIGpzb24gbWVzc2FnZQpIb3cgY2FuIHdlIGhhdmUgc2FtZSBmZWF0dXJlISBBbiBpbnRlcmNlcHRvciB3aGljaCBncmFicyB0aGUgYWN0aW9uIGV4Y2VwdGlvbnMgYW5kIHNlcmlhbGl6ZSB0aGVtIGFzIGpzb24gZXJyb3JzLgoKSSB0cnkgYmVsb3cgaW50ZXJjZXB0b3IuIFdoZW4gYW4gZXgBMAEBAQE- X-Mailer: YahooMailWebService/0.8.163.597 Message-ID: <1384506182.85232.YahooMailNeo@web164003.mail.gq1.yahoo.com> Date: Fri, 15 Nov 2013 01:03:02 -0800 (PST) From: Alireza Fattahi Reply-To: Alireza Fattahi Subject: Showing Action Exception as Ajax Errors To: Struts Mailing List MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="133570123-849234411-1384506182=:85232" X-Virus-Checked: Checked by ClamAV on apache.org --133570123-849234411-1384506182=:85232 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Hi,=0A=0AWe are using struts2 JSONValidationWithInterceptor. This intercept= or grabs the errors from validation and convert them to json message=0AHow = can we have same feature! An interceptor which grabs the action exceptions = and serialize them as json errors.=0A=0AI try below interceptor. When an ex= ception happens it works, when there are no errors and I should pass {} to = response it is not working!=0A_____________________________________________= __=0A=0AString target=3DAction.NONE;=0A=A0=A0=A0 =A0=A0=A0 try {=0A=A0=A0= =A0 =A0=A0=A0 =A0=A0=A0 =A0target=3Dinvocation.invoke();=0A=A0=A0=A0 =A0=A0= =A0 =A0=A0=A0 =A0response.getWriter().print("{}");=A0=A0=A0 =A0=A0=A0 =A0= =A0=A0 =A0=A0=A0 =0A=A0=A0=A0 =A0=A0=A0=A0=A0=A0=A0 response.setContentType= ("application/json");=0A=A0=A0=A0 =A0=A0=A0 =A0=A0=A0=A0 return target;=0A= =A0=A0=A0 =A0=A0=A0 }=0A=0A=A0=A0=A0 =A0=A0=A0 catch (BussinessException ex= ) {=0A=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 StringBuilder sb =3D new StringBuilder(= );=0A=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 sb.append("{ ");=0A=A0=A0=A0 =A0=A0=A0 = =A0=A0=A0 sb.append("\"errors\": [\"");=0A=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 sb.= append("Bussiness Exception Happend");=0A=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 sb.a= ppend("\"]}");=0A=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 response.setContentType("app= lication/json");=0A=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 response.getWriter().print= (sb.toString());=A0=A0=A0 =0A=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 return Action.NO= NE;=0A=A0=A0=A0=A0=A0=A0=A0=A0 =0A=A0=A0=A0 =A0=A0=A0 }=0A=0A=0A=A0=0A~Rega= rds,=0A~~Alireza Fattahi --133570123-849234411-1384506182=:85232--