반응형
Notice
Recent Posts
Recent Comments
Link
관리 메뉴

bro's coding

HTML.input.radio 본문

[IT]/html css js

HTML.input.radio

givemebro 2021. 4. 2. 16:07
반응형

package step3;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class RadioServlet extends HttpServlet {

	private static final long serialVersionUID = -5358598616911615290L;

	public RadioServlet() {
		super();
		// TODO Auto-generated constructor stub
	}

	protected void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		// 1. response charset=utf-8
		response.setContentType("text/html;charset=utf-8");
		// 2. PrintWriter 선언 server ->client write
		PrintWriter out = response.getWriter();
		out.println("<html>");
		out.println("<body bgcolor=yellow>");
		// 3. request.getParameter("이름")으로 서버로 부터 data를 받음
		String food = request.getParameter("food");
		out.println(food + "주문완료!");
		out.println("</body>");
		out.println("</html>");
		out.close();
	}

}
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
	<form action="RadioServlet" method="get">

		<input type="radio" name="food" value="육포">쇠고기 육포~~~<br> 
		<input type="radio" name="food" value="피자">도미노 피자~~~<br> 
		<input type="radio" name="food" value="맥주">1864 블랑<br>
		<input type="submit" value="주문">
	</form>
</body>
</html>
반응형

'[IT] > html css js' 카테고리의 다른 글

html/include  (0) 2021.04.22
Http Request Method(요청 방식)  (0) 2021.04.02
html.form  (0) 2021.04.02
javascript.ECMAScript  (0) 2021.03.31
HTML.hello HTML~  (0) 2021.03.30
레이아웃  (0) 2019.07.04
src사진 올리기  (0) 2019.07.03
link  (0) 2019.07.03
Comments