如何在JSP页面中传递Raphaeljs变量?
我能够从 JavaScript 获取一个值,它使用 Raphaeljs 并将其发送到 Servlet/JSP 页面以进行显示和显示。 DB相关工作。请为此协助我。
I'm in a position to get a value from JavaScript, which uses Raphaeljs and send it to a Servlet/JSP page for Display & DB related work. Kindly assist me for that.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您必须为此执行 AJAX。确保加载 jQuery,这样就很容易做到。
只需收集 var 值并使用 .get 或 .post 将其发送到 JSP。然后,您可以在 JSP 中添加对发送的值的验证,并对其执行任何您想要的操作。
希望这有帮助!
豪尔赫·C.
You are going to have to do AJAX for this one. Be sure to load jQuery so is easy to do it.
Simply collect the var value and send it to the JSP using .get or .post. Then you can add your validation in the JSP for the value sent and do whatever you want with it.
Hope this helps!
Jorge C.
据我了解,这与拉斐尔无关。
您需要确保您了解客户端和服务器端之间的区别。 Javascript 在浏览器中运行客户端(假设我们不是在谈论用 JS/nodejs 编写的服务器端应用程序),而 JSP 在服务器上执行
如果您通过 JS 收集值并希望服务器处理它,那么您可以使用 AJAX 请求将其发送到服务器(不会重新加载页面)或操作表单并提交(这将是 GET 或 POST 请求,并将重新加载整个页面)。
在服务器上,您可以接受这些值并处理它们,然后呈现响应。
对于 Ajax 请求,您可以查看 jQuery。
As far as i understand this is not Raphael related.
What you need to make sure is, that you understand the difference between client and server side. Javascript runs client side (given we're not talking about a server side application written with JS/nodejs) in the browser while JSPs are executed on the server
If you collect values via JS and want the server to process it then you you can either send it to the server with an AJAX request (which wont reload the page) or manipulate a form and submit it (which will be a GET or a POST request then and will reload the whole page).
On the server you can accept the values and process them and then render the response.
For Ajax request you could look at jQuery.