主题:各位大哥大姐们帮帮忙谢谢了小弟这相有礼了先
[em1]我刚学jsp不太好,要求做有循环有判断的作业,我本想做输入年月日告诉你是这年的第几天,可是老师给的例子就有这个,例子是用if编的,我就想改个switch的,可是运行不队,我给你的附件有我自己的程序你看看,是输入月日告诉你是什么星座的,还有一个是别人告诉我的判断闰年的,各位帮我看看怎么改,星座的还可以做成什么大同小异的,我觉得意义不好,拜托了!
一运行,点提交,就不是到应该的jsp页,而是像出错了,到了有文件名字的白页.
要是运行给的例子就可以顺利运行程序.
那是不是还是程序的问题,不是环境设置的问题
[em2]
以下是jsp的代码
<%
string month =request.getParameter("month");
string data =request.getParameter("data");
int m=Integer.parseInt(month);
int n=Integer.parseInt(data);
out.print(m);
out.print(n);
switch(m)
case 1: switch(n)
{case n<=21: out.print("shuiping");break;
case n>=22: out.print("tianxie");break;}break;
case 2: switch(n)
{case n<=21: out.print("tianxie");break;
case n>=22: out.print("muyang");break;}break;
case 3: switch(n)
{case n<=20: out.print("my");break;
case n>=21: out.print("by");break;}break;
case 4:switch(n)
{case n<=21: out.print("tianxie");break;
case n>=22: out.print("muyang");break;}break;
case 5: switch(n)
{case n<=21: out.print("tianxie");break;
case n>=22: out.print("muyang");break;}break;
case 6: switch(n)
{case n<=21: out.print("tianxie");break;
case n>=22: out.print("muyang");break;}break;
case 7:switch(n)
{case n<=21: out.print("tianxie");break;
case n>=22: out.print("muyang");break;}break;
case 8: switch(n)
{case n<=21: out.print("tianxie");break;
case n>=22: out.print("muyang");break;}break;
case 9: switch(n)
{case n<=21: out.print("tianxie");break;
case n>=22: out.print("muyang");break;}break;
case 10: switch(n)
{case n<=21: out.print("tianxie");break;
case n>=22: out.print("muyang");break;}break;
case 11: switch(n)
{case n<=21: out.print("tianxie");break;
case n>=22: out.print("muyang");break;}break;
case 12: switch(n)
{case n<=21: out.print("tianxie");break;
case n>=22: out.print("muyang");break;}break;
}
%>
以下是html的原码
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0129)http://mail.sina.com.cn/cgi-bin/attachment.cgi/unknowme/text/html/1111845064.64649.FreeMX158.sina.com.cn:2,S.a03.html/panduan.htm -->
<HTML><HEAD><TITLE>循环判断</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<STYLE type=text/css>BODY {
BACKGROUND-IMAGE: url(images/bei.gif)
}
.style1 {
FONT-WEIGHT: bold; FONT-SIZE: 18px; COLOR: #003399
}
.style3 {
FONT-SIZE: 16px
}
.style4 {
COLOR: #6699cc
}
.style5 {
FONT-FAMILY: "黑体"
}
</STYLE>
<SCRIPT language=JavaScript type=text/JavaScript>
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</SCRIPT>
<jsp code="Class1.class" height=300 width=500>
</jsp>
<META content="MSHTML 6.00.2900.2604" name=GENERATOR></HEAD>
<BODY>
<TABLE height=389 width=572 align=center border=0>
<TBODY>
<TR>
<TD colSpan=2><SPAN class=style1>输入年,月,日,就可以知道是该年中的哪一天,快来试试吧~</SPAN></TD></TR>
<TR>
<TD colSpan=2 height=46> </TD></TR>
<TR>
<TD height=35 rowSpan=2>
<P>请输入</P>
<FORM name=form1 action=jsppanduan.jsp method=post>
<P>年: <INPUT id=year name=year> </P>
<P>月: <INPUT id=month name=month> </P>
<P>日: <INPUT id=data name=data> </P>
<P align=center><INPUT type=submit value=提交 name=Submit><INPUT type=reset value=重置 name=Submit2> </P></FORM></TD>
<TD width=363>
<DIV align=right><SPAN class=style3> <SPAN
class=style5>如查询 2000年2月20日</SPAN></SPAN></DIV>
<DIV align=right><SPAN class=style3> <SPAN class=style5>分别在文本框填入 2000 ,2,
20 </SPAN></SPAN></DIV></TD></TR>
<TR>
<TD> </TD></TR>
<TR>
<TD colSpan=2 height=54>
</DIV></DIV></TD></TR></TBODY></TABLE>
<P> </P></BODY></HTML>
一运行,点提交,就不是到应该的jsp页,而是像出错了,到了有文件名字的白页.
要是运行给的例子就可以顺利运行程序.
那是不是还是程序的问题,不是环境设置的问题
[em2]
以下是jsp的代码
<%
string month =request.getParameter("month");
string data =request.getParameter("data");
int m=Integer.parseInt(month);
int n=Integer.parseInt(data);
out.print(m);
out.print(n);
switch(m)
case 1: switch(n)
{case n<=21: out.print("shuiping");break;
case n>=22: out.print("tianxie");break;}break;
case 2: switch(n)
{case n<=21: out.print("tianxie");break;
case n>=22: out.print("muyang");break;}break;
case 3: switch(n)
{case n<=20: out.print("my");break;
case n>=21: out.print("by");break;}break;
case 4:switch(n)
{case n<=21: out.print("tianxie");break;
case n>=22: out.print("muyang");break;}break;
case 5: switch(n)
{case n<=21: out.print("tianxie");break;
case n>=22: out.print("muyang");break;}break;
case 6: switch(n)
{case n<=21: out.print("tianxie");break;
case n>=22: out.print("muyang");break;}break;
case 7:switch(n)
{case n<=21: out.print("tianxie");break;
case n>=22: out.print("muyang");break;}break;
case 8: switch(n)
{case n<=21: out.print("tianxie");break;
case n>=22: out.print("muyang");break;}break;
case 9: switch(n)
{case n<=21: out.print("tianxie");break;
case n>=22: out.print("muyang");break;}break;
case 10: switch(n)
{case n<=21: out.print("tianxie");break;
case n>=22: out.print("muyang");break;}break;
case 11: switch(n)
{case n<=21: out.print("tianxie");break;
case n>=22: out.print("muyang");break;}break;
case 12: switch(n)
{case n<=21: out.print("tianxie");break;
case n>=22: out.print("muyang");break;}break;
}
%>
以下是html的原码
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0129)http://mail.sina.com.cn/cgi-bin/attachment.cgi/unknowme/text/html/1111845064.64649.FreeMX158.sina.com.cn:2,S.a03.html/panduan.htm -->
<HTML><HEAD><TITLE>循环判断</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<STYLE type=text/css>BODY {
BACKGROUND-IMAGE: url(images/bei.gif)
}
.style1 {
FONT-WEIGHT: bold; FONT-SIZE: 18px; COLOR: #003399
}
.style3 {
FONT-SIZE: 16px
}
.style4 {
COLOR: #6699cc
}
.style5 {
FONT-FAMILY: "黑体"
}
</STYLE>
<SCRIPT language=JavaScript type=text/JavaScript>
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</SCRIPT>
<jsp code="Class1.class" height=300 width=500>
</jsp>
<META content="MSHTML 6.00.2900.2604" name=GENERATOR></HEAD>
<BODY>
<TABLE height=389 width=572 align=center border=0>
<TBODY>
<TR>
<TD colSpan=2><SPAN class=style1>输入年,月,日,就可以知道是该年中的哪一天,快来试试吧~</SPAN></TD></TR>
<TR>
<TD colSpan=2 height=46> </TD></TR>
<TR>
<TD height=35 rowSpan=2>
<P>请输入</P>
<FORM name=form1 action=jsppanduan.jsp method=post>
<P>年: <INPUT id=year name=year> </P>
<P>月: <INPUT id=month name=month> </P>
<P>日: <INPUT id=data name=data> </P>
<P align=center><INPUT type=submit value=提交 name=Submit><INPUT type=reset value=重置 name=Submit2> </P></FORM></TD>
<TD width=363>
<DIV align=right><SPAN class=style3> <SPAN
class=style5>如查询 2000年2月20日</SPAN></SPAN></DIV>
<DIV align=right><SPAN class=style3> <SPAN class=style5>分别在文本框填入 2000 ,2,
20 </SPAN></SPAN></DIV></TD></TR>
<TR>
<TD> </TD></TR>
<TR>
<TD colSpan=2 height=54>
</DIV></DIV></TD></TR></TBODY></TABLE>
<P> </P></BODY></HTML>