java Struts2 日期时间选择器未显示

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4282143/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-30 05:40:18  来源:igfitidea点击:

Struts2 datetimepicker not showing

javajspdojostruts2datetimepicker

提问by vale4674

I followed THISbut had no luck.

我跟着这个,但没有运气。

My .jspfile has in headtag:

我的 。jsp文件在head标签中有:

<s:head theme="ajax" />

and in bodytag

并在正文标签中

<s:datetimepicker name="dateOfBirth" label="Format (yyyy-MM-dd)" displayFormat="yyyy-MM-dd"/>

But it is not showing, here is the picture:

但它没有显示,这是图片:

picture

图片

My generated HTML source code contains all necessary lines like in example(scripttags and other are generated....)

我生成的 HTML 源代码包含所有必要的行,如示例(生成脚本标签和其他......)

Any ideas?

有任何想法吗?

EDIT:

编辑:

Following Quaternion's answer:

按照四元数的回答:

I was using, struts2-core-2.0.12.jarwhich recognized <s:datetimepicker />tag but wasn't showing in my jsppage. After replacing struts2-core-2.0.12with newer one struts2-core-2.2.1.jar, <s:datetimepicker />tag wasn't recognized.

我正在使用struts2-core-2.0.12.jar识别<s:datetimepicker />标记但未显示在我的jsp页面中。更换后的struts2核心-2.0.12与较新的一个Struts2的核心- 2.2.1.jar<s:datetimepicker />标记无法识别。

After putting <%@ taglib prefix="sx" uri="/struts-dojo-tags" %>in head of the file it wasn't recognized as my tag library. Based on THIS, you should download struts2-dojo-plugin-2.1.2.jarseparately and add it into your WEB-INF/libfolder (you can downlad it here--> struts-2.1.2-lib.zip--> struts2-dojo-plugin-2.1.2.jar).

放入<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>文件头后,它没有被识别为我的标签库。基于,您应该单独下载struts2-dojo-plugin-2.1.2.jar并将其添加到您的WEB-INF/lib文件夹中(您可以在这里下载--> struts-2.1.2-lib.zip-- > struts2-dojo-plugin-2.1.2.jar)。

After that you just use sxtag for your datetimepicker.

之后,您只需为日期时间选择器使用sx标签。

IMPORTANT: Don't forger to put <sx:head/>in head tag of your jsppage --> examples here.

重要提示:不要伪造者把<sx:head/>你的头标记的JSP页面- >例子在这里

采纳答案by Quaternion

The later versions of struts2 require: <%@ taglib prefix="sx" uri="/struts-dojo-tags" %>

更高版本的 struts2 需要: <%@ taglib prefix="sx" uri="/struts-dojo-tags" %>

Then of course change the tag namespace, using:

然后当然更改标签命名空间,使用:

<sx:datetimepicker name="dateOfBirth" label="Format (yyyy-MM-dd)" displayFormat="yyyy-MM-dd"/>

See Struts2 datetimepickerIt's best if you consult struts.apache.org and ensure you are using the documentation at the correct version, things change!

请参阅Struts2 datetimepicker最好咨询 struts.apache.org 并确保您使用的是正确版本的文档,事情会发生变化!

回答by manju

use sx:head tag in the head section of jsp.

在jsp的head部分使用sx:head标签。

回答by Jinesh Parekh

Are you sure you have <%@ taglib prefix="s" uri="/struts-tags" %> included? I miss that at times wondering why things do not show up.

您确定包含 <%@ taglib prefix="s" uri="/struts-tags" %> 吗?我想念有时想知道为什么事情没有出现。