|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
Java编译的是字节码,跟C++相反,启动不够快,效率不够高,难以精确控制内存,但是优点是编程比C++容易,代码比较安全但是容易留下性能隐患,跨平台靠字节码在各个平台复制(一处编译到处调试)servletimportjava.io.*;
importjavax.servlet.*;
importjavax.servlet.http.*;
importjava.util.*;
publicclassShowAllFormDataextendsHttpServlet{
publicvoiddoGet(HttpServletRequestrequest,
HttpServletResponseresponse)
throwsServletException,IOException{
response.setContentType("text/html");
PrintWriterout=response.getWriter();
Stringtitle="显现一切的Form变量的值";
out.println("<HTML><HEAD><TITLE>"+title+"</TITLE></HEAD>"+
"<BODYBGCOLOR="#FDF5E6">
"+
"<H1ALIGN=CENTER>"+title+"</H1>
"+
"<TABLEBORDER=1ALIGN=CENTER>
"+
"<TRBGCOLOR="#FFAD00">
"+
"<TH>变量称号<TH>变量值");
EnumerationparamNames=request.getParameterNames();
while(paramNames.hasMoreElements()){
StringparamName=(String)paramNames.nextElement();
out.println("<TR><TD>"+paramName+"
<TD>");
String[]paramValues=request.getParameterValues(paramName);
if(paramValues.length==1){
StringparamValue=paramValues[0];
if(paramValue.length()==0)
out.print("<I>NoValue</I>");
else
out.print(paramValue);
}else{
out.println("<UL>");
for(inti=0;i<paramValues.length;i++){
out.println("<LI>"+paramValues[i]);
}
out.println("</UL>");
}
}
out.println("</TABLE>
</BODY></HTML>");
}
publicvoiddoPost(HttpServletRequestrequest,
HttpServletResponseresponse)
throwsServletException,IOException{
doGet(request,response);
}
}
java也能做一些底层语言开发做的事情(难度很高,不是java顶尖高手是做不来的), |
|