• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Junilu Lacar
  • Martin Vashko
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Scott Selikoff
  • salvin francis
  • Piet Souris

Struts 2 and html5 input tags

 
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
 
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.
 
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

 
a fool thinks himself to be wise, but a wise man knows himself to be a fool - shakespeare. foolish tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!