Co należy zmienić aby nie wyświetlało się null

0

Mam taką drobnostkę mianowicie nie wiem co zrobić aby w tekstboksach nie pojawiały się nulle (przy pierwszym zaladowaniu);

public class Kalkulator extends HttpServlet {
	private static final long serialVersionUID = 1L;

	public Kalkulator() {
		super();
	}

	protected void doGet(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		PrintWriter out = response.getWriter();
		response.setContentType("text/html; charset=UTF-8");
		String licz1 = "notnull";
		String licz2 ="!!!!!";
		licz1 = request.getParameter("licz1");
		licz2 = request.getParameter("licz2");
		String op = request.getParameter("op");
		double wynik = 0;
		double l1, l2;
		if (licz1 != null && licz2 != null) {
			try {
				l1 = Double.parseDouble(licz1);
				l2 = Double.parseDouble(licz2);
				if (op.equals("+")) {
					wynik = l1 + l2;
				} else if (op.equals("-")) {
					wynik = l1 - l2;
				} else if (op.equals("*")) {
					wynik = l1 * l2;
				} else if (op.equals("/")) {
					wynik = l1 / l2;
				}
			} catch (Exception e) {
			}
		}
		out.println("<html>" + "<head>" + "<title>Kalkulator</title>"
				+ "</head>" + "<body>" + "<form action=\"Kalkulator\">"
				+ "<input type=\"text\" name=\"licz1\" value=" + licz1 + ">"
				+ "<select name=\"op\">"
				+ "<option value=\"+\" selected=\"selected\">+</option>"
				+ "<option value=\"-\">-</option>"
				+ "<option value=\"*\">*</option>"
				+ "<option value=\"/\">/</option>" + "</select>"
				+ "<input type=\"text\" name=\"licz2\" value=" + licz2 + ">"
				+ "=" + wynik + "<input type=\"submit\" value=\"Oblicz\"><br>"
				+ "</form>" + "</body>" + "</html>");
	}

	protected void doPost(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		doGet(request, response);
	}

}
0

Widze ze ktos byl dzisiaj na onecie. Stallman by wiedzial co napisac...

1 użytkowników online, w tym zalogowanych: 0, gości: 1