Java 코드 안에 HTML 코드
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public ThreeParams extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/html");
printWriter out = response.getWriter();
String title = "Reading Three Request Parameters";
String docType = "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n";
out.println(docType +
"<HTML>\n" +
"<HEAD><TITLE>" + title + "</TITLE></HEAD>\n" +
"<BODY BGCOLOR=\"#FDF5E6\">\n" +
"<H1 ALIGN=\"CENTER\">" + title + "</H1>\n" +
"<UL>\n" +
"<LI><B>param1</B>: " + request.getParameter("param1") + "\n" +
"<LI><B>param2</B>: " + request.getParameter("param2") + "\n" +
"<LI><B>param3</B>: " + request.getParameter("param3") + "\n" +
"</UL>\n" +
"</BODY></HTML>");
)
}
}
https://gmlwjd9405.github.io/2018/11/04/servlet-vs-jsp.html
HTML 코드 안에 Java 코드
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<TITLE>Reading Three Request Parameters</TITLE>
<LINK REL=STYLESHEET HREF="JSP-Styles.css" TYPE="text/css">
</HEAD>
<BODY>
<H1>Reading Three Request Parameters</H1>
<UL>
<LI><B>param1</B>: <%= request.getParameter("param1") %>
<LI><B>param2</B>: <%= request.getParameter("param2") %>
<LI><B>param3</B>: <%= request.getParameter("param3") %>
</UL>
</BODY>
</HTML>
https://gmlwjd9405.github.io/2018/11/04/servlet-vs-jsp.html
참고