Struts2 datetimepicker not showing

10,961

Solution 1

The later versions of struts2 require: <%@ 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 datetimepicker It's best if you consult struts.apache.org and ensure you are using the documentation at the correct version, things change!

Solution 2

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

Share:
10,961
vale4674
Author by

vale4674

Updated on June 29, 2022

Comments

  • vale4674
    vale4674 almost 2 years

    I followed THIS but had no luck.

    My .jsp file has in head tag:

    <s:head theme="ajax" />
    

    and in body tag

    <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 (script tags and other are generated....)

    Any ideas?

    EDIT:

    Following Quaternion's answer:

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

    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.jar separately and add it into your WEB-INF/lib folder (you can downlad it here --> struts-2.1.2-lib.zip --> struts2-dojo-plugin-2.1.2.jar).

    After that you just use sx tag for your datetimepicker.

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