• 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

Struts 2.1 xhtml forms rendering invalid html

 
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a very simple form with two hidden fields. Because the form has hidden fields the html that is being rendered by struts is invalid. Is there a way or call to keep hidden fields out of the table that struts renders? I want to be able to keep all the validation that struts provides.

Struts Form


Renderd Page:



This is invalid html as the hidden fields are directly after the <table> element. I prefer to keep the hidden fields out of the table all together.

Thanks,
Earl
 
Ranch Hand
Posts: 479
1
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Earl,

In your STRUTS form there is no table element specified. I am not sure how the table tags are generated. STRUTS to my understanding does not generate formatting elements.

Cheers,
Raj.
 
E Robb
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Struts 2.1.8.1 is generating the table for the formatting as you can see from the code used in the JSP & what is actually rendered to the browser. My understanding is this is standard behavior. I just would like to know how to keep the hidden fields out of the table struts generates so I wont have non compliant html.

Here is good tutorial on struts forms http://struts.apache.org/2.2.1/docs/struts-2-form-tags.html but it doesnt say anything about hidden fields. I'd just like my html to be valid


Is definately not valid

Thanks,
Earl
 
E Robb
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have also gone through fairly thoroughly Apache Struts 2 by dave newton & Struts 2 in action. I see no mention of the XHTML theme & hidden fields or a way around the invalid html that struts writes.

Additionally have done quite a bit of googling and see no mention of this.

Thanks,
Earl
 
Ranch Hand
Posts: 182
Eclipse IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

E Robb wrote:Is there a way or call to keep hidden fields out of the table that struts renders? I want to be able to keep all the validation that struts provides.

We can overcome this by using css_xhtml theme and keeping the struts2 elements inside a table.
 
reply
    Bookmark Topic Watch Topic
  • New Topic