java - How to use javax.servlet.error.status_code in spring excetion handling -


am using below code status code in error controller

 integer status_code = (integer)    request.getattribute("javax.servlet.error.status_code"); 

and have custom error handler

public class testnestableexception extends throwable {       private static final long serialversionuid = 1l;      private static final logger log = loggerfactory.getlogger(testnestableexception.class);       private int statuscode = 0;     private string errorcode;     private string message;       public int getstatuscode() {         return statuscode;     }       public void setstatuscode(int statuscode) {         this.statuscode = statuscode;     }       public string geterrorcode() {         return errorcode;     }       public void seterrorcode(string errorcode) {         this.errorcode = errorcode;     }      public string getmessage() {         return message;     }       public void setmessage(string message) {         this.message = message;     }       public testnestableexception(final int statuscode, final string errorcode, final string errormessage) {          super(errormessage);             this.statuscode = statuscode;         this.errorcode = errorcode;         this.message = errormessage;      }  } 

have followed internet resources , implemented above, every time getting 500 status code

do need add code set "javax.servlet.error.status_code"??

can 1 tell me going wrong.. have little knowledge in spring , servlets.


Comments