import java.io.*; import javax.servlet.*; import javax.servlet.http.*; public class StartingBalanceServlet extends HttpServlet implements SingleThreadModel { private Integer balance; public void doPost (HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { HttpSession session = request.getSession(false); response.setContentType("text/html"); PrintWriter out = response.getWriter(); try { balance = new Integer(Integer.parseInt(ServletUtilities.filter(request.getParameter("balance")))); } catch(NumberFormatException e) { out.println("" + "NumberFormatException" + "

" + e.toString() + "

" + "

" + "You must enter only decimal digits " + session.getValue("name") + "." + "

" + " Gold Pieces" + "

" + "
"); out.close(); } session.putValue("balance",balance); out.println("Entrance" + "" + "" + "" + "" + "" + "" + "" + "
PotionsScrollsWeapons and ArmorRods, Staves and WandsWondrous ItemsRings
"); out.close(); } }