欢迎来到代码驿站!

JSP代码

当前位置:首页 > 软件编程 > JSP代码

jsp 获取客户端的浏览器和操作系统信息

时间:2021-05-15 09:06:03|栏目:JSP代码|点击:
string agent = request.getheader("user-agent");
stringtokenizer st = new stringtokenizer(agent,";");
st.nexttoken();
//得到用户的浏览器名
string userbrowser = st.nexttoken();
//得到用户的操作系统名
string useros = st.nexttoken();
取得本机的信息也可以这样:
操作系统信息
system.getproperty("os.name"); //win2003竟然是win xp?
system.getproperty("os.version");
system.getproperty("os.arch");
?g?[器:
request.getheader("user-agent")
再送个红包
request.getheader(“user-agent”)返回客户端浏览器的版本号、类型
getheader(string name):获得http协议定义的传送文件头信息,
request. getmethod():获得客户端向服务器端传送数据的方法有get、post、put等类型
request. getrequesturi():获得发出请求字符串的客户端地址
request. getservletpath():获得客户端所请求的脚本文件的文件路径
request. getservername():获得服务器的名字
request.getserverport():获得服务器的端口号
request.getremoteaddr():获得客户端的ip地址
request.getremotehost():获得客户端电脑的名字,若失败,则返回客户端电脑的ip地址
request.getprotocol():
request.getheadernames():返回所有request header的名字,结果集是一个enumeration(枚举)类的实例
request.getheaders(string name):返回指定名字的request header的所有值,结果集是一个enumeration(枚举)类的实例

上一篇:JSP中的PreparedStatement对象操作数据库的使用教程

栏    目:JSP代码

下一篇:Hibernate识别数据库特有字段实例详解

本文标题:jsp 获取客户端的浏览器和操作系统信息

本文地址:http://www.codeinn.net/misctech/121832.html

推荐教程

广告投放 | 联系我们 | 版权申明

重要申明:本站所有的文章、图片、评论等,均由网友发表或上传并维护或收集自网络,属个人行为,与本站立场无关。

如果侵犯了您的权利,请与我们联系,我们将在24小时内进行处理、任何非本站因素导致的法律后果,本站均不负任何责任。

联系QQ:914707363 | 邮箱:codeinn#126.com(#换成@)

Copyright © 2020 代码驿站 版权所有