读书人

jsp提交iframe内容的有关问题

发布时间: 2012-01-18 00:23:26 作者: rapoo

jsp提交iframe内容的问题
abc1.jsp

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN ">

<HTML>
<HEAD>
<%@ page
language= "java "
contentType= "text/html; charset=GB18030 "
pageEncoding= "GB18030 "
%>
<META http-equiv= "Content-Type " content= "text/html; charset=GB18030 ">
<META name= "GENERATOR " content= "IBM WebSphere Studio ">
<META http-equiv= "Content-Style-Type " content= "text/css ">
<LINK href= "../theme/Master.css " rel= "stylesheet " type= "text/css ">
<TITLE> abc1.jsp </TITLE>
</HEAD>
<BODY>
<form name= "id1 " method= "psot "> <INPUT type= "checkbox " name= "id " value= "5 "> aaa <BR>
<INPUT type= "checkbox " name= "id " value= "1 "> bbb <BR>
<INPUT type= "checkbox " name= "id " value= "2 "> vvv <BR>
<INPUT type= "checkbox " name= "id " value= "3 "> ccc <BR>
<INPUT type= "checkbox " name= "id " value= "4 "> ddd
</form>
</BODY>
</HTML>


abc2.jsp
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN ">

<HTML>
<HEAD>
<%@ page
language= "java "
contentType= "text/html; charset=GB18030 "
pageEncoding= "GB18030 "
%>
<META http-equiv= "Content-Type " content= "text/html; charset=GB18030 ">
<META name= "GENERATOR " content= "IBM WebSphere Studio ">
<META http-equiv= "Content-Style-Type " content= "text/css ">
<LINK href= "../theme/Master.css " rel= "stylesheet " type= "text/css ">

<script language=javascript>

function s_ok()

{

document.form1.id.value=Composition.id1.id.value;

return true;

}
</script>
<TITLE> abc2.jsp </TITLE>
</HEAD>
<BODY>
<form action= "abc3.jsp " method= "post " name= "form1 " onsubmit= "return s_ok() ">
<input type=hidden name= "id " value= " ">
<IFRAME src= "abc1.jsp " width= "187 " height= "%100 " name=Composition
frameborder= "no " MARGINWIDTH= "0 " MARGINHEIGHT= "0 " SCROLLING= "no "> </IFRAME>
</from> <BR>
<INPUT type= "submit " name= "tj " value= "提交 "> </BODY>
</HTML>


abc3.jsp

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN ">



<HTML>
<HEAD>
<%@ page
language= "java "
contentType= "text/html; charset=GB18030 "
pageEncoding= "GB18030 "
%>
<META http-equiv= "Content-Type " content= "text/html; charset=GB18030 ">
<META name= "GENERATOR " content= "IBM WebSphere Studio ">
<META http-equiv= "Content-Style-Type " content= "text/css ">
<LINK href= "../theme/Master.css " rel= "stylesheet " type= "text/css ">
<TITLE> abc3.jsp </TITLE>
</HEAD>
<BODY>
<%
String aaa=request.getParameter( "id ");
System.out.println(aaa);
%>
</BODY>
</HTML>


提交后怎么样得到iframe的值,
  在abc2.jsp如何去写js



[解决办法]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN ">

<HTML>
<HEAD>
<TITLE> abc1.jsp </TITLE>
</HEAD>
<BODY>
<input type= "checkbox " name= "id " value= "5 "> aaa <BR>
<input type= "checkbox " name= "id " value= "1 "> bbb <BR>
<input type= "checkbox " name= "id " value= "2 "> vvv <BR>
<input type= "checkbox " name= "id " value= "3 "> ccc <BR>
<input type= "checkbox " name= "id " value= "4 "> ddd
</BODY>
</HTML>
/**************************************************/
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN ">

<HTML>
<HEAD>
<%@ page
language= "java "
contentType= "text/html; charset=GB18030 "
pageEncoding= "GB18030 "
%>
<META http-equiv= "Content-Type " content= "text/html; charset=GB18030 ">
<META name= "GENERATOR " content= "IBM WebSphere Studio ">
<META http-equiv= "Content-Style-Type " content= "text/css ">
<LINK href= "../theme/Master.css " rel= "stylesheet " type= "text/css ">

<script language=javascript>
function aa(){
var promit = window.frame1.document.getElementsByName( "id ");
var flag = " ";
for(var i =0;i <promit.length;i++){
if(promit[i].checked){
if(flag == " "){
flag += promit[i].value ;
}else{
flag += ", "+promit[i].value ;
}
}
}
document.form1.action= "/Test/abc3.jsp?ok= "+flag;
///Test/为应用文路径
}
</script>
<TITLE> abc2.jsp </TITLE>
</HEAD>
<BODY>
<form method= "post " name= "form1 ">
<iframe border=0 frameborder=0
framespacing=0 width=100% height=251 marginheight=0
marginwidth=0 name=frame1 noResize scrolling=auto
src= "abc1.jsp " vspale= "0 "> </iframe>
<INPUT type= "submit " name= "tj " value= "提交 " onclick = "aa() "> </BODY>
</from> <BR>

</HTML>
/*********************************************************************/


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN ">
<HTML>
<HEAD>
<%@ page
language= "java "
contentType= "text/html; charset=GB18030 "
pageEncoding= "GB18030 "
%>
<META http-equiv= "Content-Type " content= "text/html; charset=GB18030 ">
<META name= "GENERATOR " content= "IBM WebSphere Studio ">
<META http-equiv= "Content-Style-Type " content= "text/css ">
<LINK href= "../theme/Master.css " rel= "stylesheet " type= "text/css ">
<TITLE> abc3.jsp </TITLE>
</HEAD>
<BODY>
<%
String aaa=request.getParameter( "ok ");
System.out.println(aaa);
%>
</BODY>
</HTML>

读书人网 >Java Web开发

热点推荐