使用Java进行HTML5 Localstorage访问 [英] HTML5 Localstorage access using Java

查看:994
本文介绍了使用Java进行HTML5 Localstorage访问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以直接使用Java访问localstorage对象?如果是,如何?

Is it possible to access localstorage object using Java directly? If yes how?

更新:我知道localstorage是客户端,java是服务器端,但我在网上读到GWT有api允许读取localstorage。 / p>

Update: I am aware that localstorage is client side and java is server side but I read on net that GWT have api that allow to read localstorage.

推荐答案

本地存储,如其名称所示,在本地存储信息,这意味着在浏览器中,在客户端。 servlet过滤器在服务器端执行。无法访问服务器端的本地存储。

The local storage, as its name indicates, stores information locally, which means in the browser, at client-side. The servlet filter executes at server-side. There is no way to access the local storage at server-side.

如果需要从servlet过滤器访问存储在本地存储中的某些ID,则从JavaSCript中的本地存储中检索此ID,并发送包含此ID的请求到服务器。

If you need to access some ID stored in the local storage from a servlet filter, then retrieve this ID from the local storage in JavaSCript, and send a request containing this ID to the server.

这篇关于使用Java进行HTML5 Localstorage访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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