是否可以在 Java Web 应用程序中获取客户端 os 用户名? [英] Is it possible to get client os user name in java web application?

查看:27
本文介绍了是否可以在 Java Web 应用程序中获取客户端 os 用户名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的网站托管在本地服务器上,该网站由多个本地用户访问,当我尝试使用 java 代码时,我希望他们访问特定页面时获取访问此页面的客户端/用户的 os 用户:

i have website hosted on local server and this website is accessed by several local users, and i want when they access specific page to get the os user for the client/user accessing this page, when i tried the java code:

String currentUser=System.getProperty("user.name"); 

它获取服务器而不是客户端的 os 用户名.

it gets the os user name for the server not the client.

请告知如何实现,谢谢.

please advise how to accomplish that, thanks.

推荐答案

使用 java 方法 request.getRemoteUser() 做到了.

using java method request.getRemoteUser() did the trick.

这篇关于是否可以在 Java Web 应用程序中获取客户端 os 用户名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆