String chushu = request.getParameter("chushu");
String beichushu = request.getParameter("beichushu");
int he=Integer.parseInt(chushu)+Integer.parseInt(beichushu) ;
在程序中(非jsp页面)我们一般习惯用try ...catch包起来 因为怕chushu或beichushu有null;
所以程序中
String chushu = request.getParameter("chushu");
String beichushu = request.getParameter("beichushu");
try{
int he=Integer.parseInt(chushu)+Integer.parseInt(beichushu) ;
}catch(Exception e){
System.out.println(e.getMessage());
}
String chushu = request.getParameter("chushu");
int c = Integer.parseInt(chushu);
String chushu = request.getParameter("chushu");
int i = Integer.parseInt(chushu );