the web app is a simple calculator that adds and subtracts. my problem is that the add and the subtract buttons don't work
i get an error message: "An error occurred at line: 19 in the jsp file: /adder.jsp
Invalid character constant"
<%
String name = (String) session.getAttribute("name");
if (name==null) {
name = request.getParameter("name");
if (name!=null) session.setAttribute("name",name);
}
String sum = (String) session.getAttribute("sum");
if (sum==null) {
sum = "0";
session.setAttribute("sum",sum);
}
int isum = Integer.parseInt(sum);
String number = request.getParameter("number");
if (number==null) number = "0";
int inumber = Integer.parseInt(number);
switch(opchar){
case 'add':
isum += inumber;
session.setAttribute("sum",""+isum);
break;
case 'subtract':
isum += inumber;
session.setAttribute("sum",""+isum);
break;}
%>
<html>
<head>
<title>Adding Machine</title>
</head>
<body>
<form method='get' action='adder.jsp'>
<%
if (name==null) {
%>
<p>
Name: <input type='text' name='name' id='name'>
</p>
<p>
<input type='submit' name='submit' id='submit' value='signin'>
</p>
<%
} else {
%>
<p>Welcome, <%=name%>!</p>
<p>Current sum is: <%=isum%></p>
<p>
Number to add: <input type='text' name='number' id='number' value='add'>
</p>
<p>
<% if (opchar == 'add') %> <input type='submit' name='submit' id='submit' value='add'>
</p>
<p>
<% if (opchar == 'suntract') %> <input type='submit' name='submit' id='submit' value='subtract'>
</p>
<%
}
%>
</form>
</body>
</html>