Java
- 6 ответов
- 0 вопросов
0
Вклад в тег
$.get("/getTimeLordNameByIndex", { index: 1 })
.done(function( data ) {
alert( "First timelord is " + data ); // Doctor?
});
@WebServlet("/getTimeLordNameByIndex")
class GetTimeLordNameByIndex extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
String index = req.getParameter("index");
if (index.equals("1")) {
resp.getWriter().write("Doctor");
} else {
throw new ServletException("Can be only one!");
}
}
}