Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts 2 and html5 input tags

 
Nancy C Johnson
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How would I code <input type=email into Struts sytnax? I don't see anything but S:textfield
Thank You

Nancy Johnson
 
Manjesh Patil
Ranch Hand
Posts: 42
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Struts2 as of now does not seems to be supporting HTML5. you have to use s:textfield only.
here is the list of HTML elelments that struts2 tags can render....


http://struts.apache.org/2.0.6/docs/ui-tag-reference.html



regards
Manjesh
 
Nancy C Johnson
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you. Do you think Struts 2 will begin to support HTML5 tags in the near future?

Thank you.

Nancy Johnson
 
Manjesh Patil
Ranch Hand
Posts: 42
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I wish some plugin would come up though I do not see any roadmap for struts2 on their official site.
 
Marc Bouvier
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can make your own taglib extending textfield. and using a different template which only aim is to replace
<input type="text"
by
<input type="date"


If you need more attributes (date range ...) you may need to add them in the tld descriptor and in the component class.

In your own tld file (here WEB-INF/tlds/mytld.tld) :


Tag class : DateFieldTag, we just extend Struts2 TextFieldTag and use our own component DateField instead of TextField



Component class : We extend Struts2 TextField component and make it use our own template (datefield) which will find datefield.ftl template



Do not forget to create a template for your taglib (here simple/datefield.ftl)




Then you will have to include your tld in your web.xml file




And use it in your JSP page

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic