NullPointerException when using an interceptor in Struts 2
问题 This is my WelcomeAction Class package com.codinghazard.actions; public class WelcomeAction { private String operandA; private String operandB; private Character operator; private int sum; public String execute() { if ((operandA!="") && (operandB!="")) { int a=Integer.parseInt(operandA); int b=Integer.parseInt(operandB); switch (operator) { case '1': sum=a+b; break; case '2': sum=a-b; break; case '3': sum=a*b; break; case '4': try { sum=a/b; } catch(ArithmeticException ae) { return "ERROR"; }