shnoit
یک شنبه 10 آذر 1387, 10:11 صبح
سلام
میخواستم ببینم مشکل و ایراد کار نکردن این دوتا فایل چی هست:ناراحت:
اولی:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>enjoy...</title>
</head>
<body>
<div style="text-align:center">
<form action="" method="post">
<input type="text" name="numstudent" />
<input type="hidden" name="searchstudent" value="searchstudent" />
<input type="submit" value="جستجو" /></form></div>
<div style="text-align:center; font-family:Tahoma; font-size:11; color:#FF0000;" dir="rtl">
<%
String codeGroups[]={"100","200","300"};
String nameGroups[]={"کامپیوتر","برق","مواد"};
String year,group,number;
String str=request.getParameter("numstudent");
String message="Code Group is InCorrect";
year=str.substring(0,2);
group=str.substring(2,5);
number=str.substring(5,7);
boolean flag=false;
int i;
for(i=0;i<3;i++){
if(group.compareTo(codeGroups[i])==0){
flag=true;
break;
}
}
if(flag){
%>
<b>سال ورود : </b><%= year %><br />
<b>رشته تحصیلی: </b><%= nameGroups[i] %><br />
<b>شماره : </b><%= number %>
<%
}
else{
%>
<%= message %>
<%
}
%>
</div>
</body>
</html>
دومی:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<form action="Calculation.jsp" method="post">
Num1 : <input name="Num1" type="text"><br>
Num2 :<input name="Num2" type="text"><br>
Operator :<input type="text" name="Operator"><br>
<input type="submit" value="Calculate">
</form>
<body>
<%
String strnum1,strnum2,stroperator;
char operator;
int num1,num2,res=0;
strnum1=request.getParameter("Num1");
strnum2=request.getParameter("Num2");
stroperator=request.getParameter("Operator");
num1=Integer.parseInt(strnum1);
num2=Integer.parseInt(strnum2);
operator=stroperator.charAt(0);
switch(operator){
case '+':
res=num1+num2;
break;
case '*':
res=num1*num2;
break;
case '-':
res=num1-num2;
break;
case '/':
res=num1/num2;
break;
default :
;
}
%>
<%= res %>
</body>
</html>
ممنون میشم اگه کمکم کنین.:قلب::قلب:
میخواستم ببینم مشکل و ایراد کار نکردن این دوتا فایل چی هست:ناراحت:
اولی:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>enjoy...</title>
</head>
<body>
<div style="text-align:center">
<form action="" method="post">
<input type="text" name="numstudent" />
<input type="hidden" name="searchstudent" value="searchstudent" />
<input type="submit" value="جستجو" /></form></div>
<div style="text-align:center; font-family:Tahoma; font-size:11; color:#FF0000;" dir="rtl">
<%
String codeGroups[]={"100","200","300"};
String nameGroups[]={"کامپیوتر","برق","مواد"};
String year,group,number;
String str=request.getParameter("numstudent");
String message="Code Group is InCorrect";
year=str.substring(0,2);
group=str.substring(2,5);
number=str.substring(5,7);
boolean flag=false;
int i;
for(i=0;i<3;i++){
if(group.compareTo(codeGroups[i])==0){
flag=true;
break;
}
}
if(flag){
%>
<b>سال ورود : </b><%= year %><br />
<b>رشته تحصیلی: </b><%= nameGroups[i] %><br />
<b>شماره : </b><%= number %>
<%
}
else{
%>
<%= message %>
<%
}
%>
</div>
</body>
</html>
دومی:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<form action="Calculation.jsp" method="post">
Num1 : <input name="Num1" type="text"><br>
Num2 :<input name="Num2" type="text"><br>
Operator :<input type="text" name="Operator"><br>
<input type="submit" value="Calculate">
</form>
<body>
<%
String strnum1,strnum2,stroperator;
char operator;
int num1,num2,res=0;
strnum1=request.getParameter("Num1");
strnum2=request.getParameter("Num2");
stroperator=request.getParameter("Operator");
num1=Integer.parseInt(strnum1);
num2=Integer.parseInt(strnum2);
operator=stroperator.charAt(0);
switch(operator){
case '+':
res=num1+num2;
break;
case '*':
res=num1*num2;
break;
case '-':
res=num1-num2;
break;
case '/':
res=num1/num2;
break;
default :
;
}
%>
<%= res %>
</body>
</html>
ممنون میشم اگه کمکم کنین.:قلب::قلب: