• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Struts2 - textfield - required attribute doesn't work

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi to all,
I use this code

and the following html code is generated:


Why I don't see the attribute required="required" in generated html?
Thanks to all.
 
Ranch Hand
Posts: 300
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Macro,

requried attribute will just put the asterisk sign in form. It will provide the mark * to you form field.

It will generate the
when you set the required=true in the jsp.

Regards
Jatan
 
marco pavone
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your reply.
I checked out the generated html code and I don't see the span you mentioned or other * symbol, at least with "simple" struts theme.
The "required=true" seems to not have any effect...
 
jatan bhavsar
Ranch Hand
Posts: 300
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Marco,

Can you please post your whole jsp Please?

Regards
Jatan

 
marco pavone
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sure.
You can find the required="true" at <s:textfield id="field1" .....
Thanks.

 
jatan bhavsar
Ranch Hand
Posts: 300
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Marco,

<s:textfield id="field1" name="registration.field1" cssClass="largeTextField" maxlength="20" required="true" title="test"/>

put the label attribute in your textfield.. like

. it will work and also you will be able to see the span and * in view source code.

Search in the apache site for the textfield and its attributes . you will get the answer.

Jatan
 
reply
    Bookmark Topic Watch Topic
  • New Topic