在jsp中检测按键 [英] Detecting Key Press in jsp

查看:89
本文介绍了在jsp中检测按键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用jsp构建的基于Web的程序上有一个菜单栏.通常,我的公司使用Java脚本添加功能,但是我一直在阅读JSTL,并且想知道是否存在一种方法来确定是否使用JSTL同时按下了两个键.另外,在将Scriplet修订为JSTL时,是否要遵循任何通用规则或约定?

I have a menu bar on a web based program that is built using jsp. Usually, my company uses java scriplets to add functionality, but I have been reading about JSTL and was wondering if there was a way to determine if two keys were pressed simultaneously using JSTL. Also, is there any general rules or conventions to be followed when revising scriplets into JSTL?

推荐答案

我认为没有任何方法可以使用JSTL检测键输入.据我所知,JSTL是这五种类型标记的集合:

I don't think there is any way to detect key input using JSTL. As far as I know JSTL, it is a collection of these five types of tags:

核心标签::用于访问变量,迭代对象和(几乎)您希望用编程语言编写的所有标准循环和if-else语句.

Core Tags: used for accessing variables, iterating objects, and (almost) all of the standard loops and if-else statements that you would expect in a programming language.

格式化标签:日期,字符串等

SQL标签:数据库内容

XML标签:与核心类似,但对于xml

XML tags: like core, but for xml

JSTL功能:诸如containsjoinsplitsubstring等的功能

JSTL Functions: Functions like contains, join, split, substring etc

您可以在此处了解更多信息: http://www.tutorialspoint.com/jsp /jsp_standard_tag_library.htm

You can read more about it here: http://www.tutorialspoint.com/jsp/jsp_standard_tag_library.htm

创建键侦听器的最佳选择是javascript.请查看此帖子以获取更多信息:检测到多个键jQuery中的单个按键事件

Your best bet for creating a key listener, is javascript. Take a look at this post for more info: Detect multiple keys on single keypress event in jQuery

对于您的问题的另一部分,我特别发现在stackoverflow上已经存在两个答案,这是最有帮助的:
如何避免JSP文件中的Java代码?
如何避免在我的JSP页面中使用scriptlet?

For the other part of your question, I have found particularily two answers already existing on stackoverflow, to be most helpful:
How to avoid Java code in JSP files?
How to avoid using scriptlets in my JSP page?

如评论中所述,JSTL在Web应用程序的服务器端工作.用户输入发生在客户端,因此不在JSTL的范围内. Javascript是必经之路.

As mentioned in the comments, JSTL works on the server side of a web application. user input happens on the client side, and is therefore out of scope for JSTL. Javascript is the way to go.

这篇关于在jsp中检测按键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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