Browser Capabilities Component可以检测浏览器的这些功能
它支持17种属性,其中
Cookies:检测cookies功能
Vbscript:
Javascript:
Jscript:
JavaApplets:
这些功能不用多说了吧
它支持17种属性,其中
Cookies:检测cookies功能
Vbscript:
Javascript:
Jscript:
JavaApplets:
这些功能不用多说了吧
import java.util.Enumeration;
import java.util.Date;
import javax.servlet.*;
import javax.servlet.http.*;public class SessionDemo extends HttpServlet { public String getServletInfo() {
return "SessionDemo version 1.9: a sample servlet from vqSoft";} public void dostuff (HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
HttpSession tsession=req.getSession(true);
res.setContentType("text/html");
ByteArrayOutputStream buffer=new ByteArrayOutputStream();
PrintWriter os=new PrintWriter(buffer);
//PrintWriter os=new PrintWriter(res.getOutputStream());
Integer sessioncounter=(Integer) tsession.getValue("sessioncounter");
if (sessioncounter==null)
sessioncounter=new Integer(1);
else
sessioncounter=new Integer(sessioncounter.intValue()+1);
tsession.putValue("sessioncounter", sessioncounter);
if (req.getParameter("submitdata")!=null) {
tsession.putValue(req.getParameter("name"), req.getParameter("value"));}
os.println("<head><title>Session demonstration</title></head>");
os.println("<body bgcolor=#add8af>");
os.println("<table border=0 cellspacing=0 cellpadding=2 cols=3 width=100%>");
os.println("<tr><td valign=top>");
os.println("<h1 align=center>Session demonstration</h1>");
os.println("<hr>");
os.println("<p>This page was generated by <i>SessionDemo</i> version 1.9, a sample servlet supplied with <a href=http://www/vqsoft.com/vq/server/index.html><i>vq</i>Server</a>. ");
os.println("<i>SessionDemo</i> illustrates <i>vq</i>Server's support for JavaSoft sessions. ");
os.println("During a session, the server can keep track of data between HTTP requests.</p>");
os.println("<p><a href="+res.encodeUrl("/servlet/vq.demos.SessionDemo")+">");
os.println("Access this servlet and session using URL encoding.</a><p>");
os.println("<hr>");
os.println("<h3>Request parameters</h3>");
os.println("Requested session ID: "+req.getRequestedSessionId()+"<br>");
os.println("Session ID from cookie: "+req.isRequestedSessionIdFromCookie()+"<br>");
os.println("Session ID from URL: "+req.isRequestedSessionIdFromUrl()+"<br>");
os.println("Valid session requested: "+req.isRequestedSessionIdValid()+"<br>");
os.println("<hr>");
os.println("<h3>Session parameters</h3>");
os.println("Actual session ID: "+tsession.getId()+"<br>");
os.println("Creation time: "+(new Date(tsession.getCreationTime())).toString()+"<br>");
os.println("Last access time: "+(new Date(tsession.getLastAccessedTime())).toString()+"<br>");
os.println("New session: "+tsession.isNew()+"<br>");
os.println("<hr>");
os.println("<h3>Session data</h3>");
os.println("Counter: "+sessioncounter.toString());
String[] tdata=tsession.getValueNames();
for (int i=0; i<tdata.length; i++)
if (!tdata[i].equals("sessioncounter"))
os.println("<br>"+tdata[i]+": "+tsession.getValue(tdata[i]).toString());
os.println("<hr>");
os.println("<h3>Add data to this session</h3>");
os.println("<form action="+res.encodeUrl("/servlet/vq.demos.SessionDemo")+" method=post>");
os.println("<table border=0>");
os.println("<tr>");
os.println("<td align=right>Name:</td>");
os.println("<td align=left><input type=edit name=name size=40></td>");
os.println("</tr>");
os.println("<tr>");
os.println("<td align=right>Value:</td>");
os.println("<td align=left><input type=edit name=value size=40></td>");
os.println("</tr>");
os.println("<tr>");
os.println("<td></td>");
os.println("<td align=center><input type=reset name=reset value=Reset><input type=submit name=submitdata value=Ok></td>");
os.println("</tr>");
os.println("</table>");
os.println("<p><hr></p>");
os.println("<p><i>SessionDemo</i> version 1.9. <i>SessionDemo</i> and <a href=http://www/vqsoft.com/vq/server/index.html><i>vq</i>Server</a> are copyright © 1997-99 Steve Shering and <i>vq</i>Soft.");
os.println("</td>");
os.println("<td width=20></td>");
os.println("<td valign=top width=150>");
os.println("<a href=/index.html><img src=/vq/server/icons/utab.gif border=0 height=15 width=15>Home page</A>");
os.println("</td>");
os.println("</table>");
os.println("</body></html>");
os.flush();
res.setContentLength(buffer.size());
buffer.writeTo(res.getOutputStream());}
public void doGet (HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
dostuff(req, res);} public void doPost (HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
dostuff(req, res);}}
访问http://168.168.18.11:81/etechbase/advsearch.php将您的问题输入查询内容框,选择不同的精确程度,即可以找到你所需要的答案。效果还是可以的。
to kosisiyo:"Browser Capabilities Component"是什么?我没听说过。
to skyyoung:其实你告诉我查HttpServletRequest的函数就行了,不过我还是没发现如何检测脚本功能是否支持(打开)。