如何使用 Struts 2 在 JSP 上获取 User-Agent 标头
如何使用 Struts 2 获取 JSP 上的 User-Agent 标头?
提前致谢!
How can I obtain the User-Agent header on JSP, using Struts 2?
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果我的假设是正确的,您希望 User-Agent 标头来处理多个视图,例如桌面和移动设备(仅假设)
有多种方法可以查找有关使用代理的详细信息。我想到的一种简单方法是简单的 JSTL,
另一种是纯JSP代码
,如果我的假设是正确的,最好的解决方案是创建一个 拦截器< /a> 可以改变返回值基于客户端的用户代理的代码。
可以根据您的要求提供任何其他输入。
If my assumptions are right you want to have the User-Agent header to deal with multiple view say desktop and mobile (only assumption)
There are various way to find details about use agent.One easy way came to my mind is simple JSTL
another is plain JSP code
and if my assumption is right the best possible solution is to create an interceptors that can change the return code based on the user-agent of the client.
Any other inputs can be provided based on your requirements.