<!-- language: java-->
package bhatti;
public class find extends HttpServlet {
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;");
PrintWriter out = response.getWriter();
out.println("<html><body>");
out.println("<feildset>");
out.println("<form action='display' method='get'>");
out.println("<tr>");
out.println("<td>ID :</td><td> <input type='text' name='id' style='width=70px;'></td><tr><br>");
out.println("<tr><td>Uints: </tr><tr><input type='text' name='uints' style='width=70px;' ></td></tr><br>");
out.println("<tr><td><input type='submit' value='submit' ></td></tr><br>");
out.println("</form>");
out.println("</feildset>");
out.println("</body></html>");
int i = Integer.parseInt(request.getParameter("id"));
int u = Integer.parseInt(request.getParameter("uints"));
float bill;
bill = (float)(u * (1.5));
float s;
s = (float)(bill * 0.05);
float totalbill;
totalbill = bill - s;
RequestDispatcher requestDispatcher = getServletContext().getRequestDispatcher("display.java");
requestDispatcher.forward(request, response);
request.setAttribute("id", i);
request.setAttribute("uints", u);
request.setAttribute("totalbill", totalbill);
}
}
second servlet
package bhatti;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
}
}
浮点值未发送到其他 servlet
错误是 HTTP 状态 500 -
类型异常报告
信息
描述 服务器遇到内部错误,无法满足此请求。
note Apache Tomcat/8.0.27 日志中提供了根本原因的完整堆栈跟踪。
元芳怎么了
相关分类