aspose file tools*
The moose likes Struts and the fly likes Struts 2.1 xhtml forms rendering invalid html Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts 2.1 xhtml forms rendering invalid html" Watch "Struts 2.1 xhtml forms rendering invalid html" New topic
Author

Struts 2.1 xhtml forms rendering invalid html

E Robb
Ranch Hand

Joined: Aug 27, 2010
Posts: 111
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
Rajkamal Pillai
Ranch Hand

Joined: Mar 02, 2005
Posts: 443
    
    1

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

Joined: Aug 27, 2010
Posts: 111
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

Joined: Aug 27, 2010
Posts: 111
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
Anbarasu Aladiyan
Ranch Hand

Joined: Jun 02, 2009
Posts: 182

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.


A.A.Anbarasu
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts 2.1 xhtml forms rendering invalid html