어렵네요~
실행모습
전송을 누르면 form에서 선택한 이름과 이미지 속성 값이 넘어가서 출력됩니다.
사진은 학원에서 하던 거랑 달라서 이름이 살짝 다릅니다.(소스상으로만)
form//////////////////////////////////////////////////////////////////////////////////////////
<%@ page language="java" contentType="text/html; charset=EUC-KR"
pageEncoding="EUC-KR"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<title>Insert title here</title>
</head>
<script type="text/javascript">
function jsSetImage(param)
{
document.myForm.Pimage.value = param;
}
</script>
<body>
<div align="center">
<form name="myForm" method="get" action="photoProc.jsp">
<h2>좋아하는 투수 선택하기</h2>
<br/>
<table cellspacing="0" cellpadding="0" border="1">
<tr align="center">
<td>
<img src="/Jsp/day0426/img/ryuhyunjin1.jpg">
</td>
<td>
<img src="/Jsp/day0426/img/jungminchul1.jpg">
</td>
<td>
<img src="/Jsp/day0426/img/baeyoungsu1.jpg">
</td>
<td>
<img src="/Jsp/day0426/img/jungdaehyun1.jpg">
</td>
</tr>
<tr>
<td>
<input type="radio" NAME="name" value="류현진" onclick="javascript:jsSetImage('ryuhyunjin1')"> 류현진
</td>
<td>
<input type="radio" NAME="name" value="오승환" onclick="javascript:jsSetImage('jungminchul1')"> 오승환
</td>
<td>
<input type="radio" NAME="name" value="글로버" onclick="javascript:jsSetImage('baeyoungsu1')"> 글로버
</td>
<td>
<input type="radio" NAME="name" value="정대현" onclick="javascript:jsSetImage('jungdaehyun1')"> 정대현
</td>
</tr>
</table>
<input type="hidden" NAME="Pimage" value="">
<br/><br/> <input type="submit" value="전 송"/>
</form>
</div>
</body>
</html>
proc/////////////////////////////////////////////////////////////////////////////////////////////////////////////
<%@ page language="java" contentType="text/html; charset=EUC-KR"
pageEncoding="EUC-KR"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<title>Insert title here</title>
</head>
<body>
<%
String name=request.getParameter("name");
//String name =java.net.URLEncoder.encode(name);
String Pimage=request.getParameter("Pimage");
String file="photoPhoto.jsp?name="+name+"&Pimage="+Pimage;
//out.println("name");
response.sendRedirect(file);
%>
</body>
</html>
photo//////////////////////////////////////////////////////////////////////////////////////////////
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<title>Insert title here</title>
</head>
<%
//String name=request.getParameter("name");
String name=new String(request.getParameter("name").getBytes("8859_1"),"euc-kr");
String Pimage=request.getParameter("Pimage");
/*
if(name=="a")
{
name="류현진";
}else if(name=="b")
{
name="정민철";
}else if(name=="c")
{
name="배영수";
}else if(name=="d")
{
name="정대현";
}
*/
%>
<body>
<%=name %>(을)를 좋아 합니다.<br/><br/>
<img src="/Jsp/day0426/img/<%=Pimage %>.jpg"><br/><br/>
<a href=photoForm.jsp>다시선택</a>
</body>
</html>
본 블로그는 페이스북 댓글을 지원합니다.