Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts 2.1 xhtml forms rendering invalid html

 
E Robb
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
  • 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
 
Rajkamal Pillai
Ranch Hand
Posts: 445
1
Java Spring
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
 
Anbarasu Aladiyan
Ranch Hand
Posts: 182
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic