Return-Path: X-Original-To: apmail-struts-user-archive@www.apache.org Delivered-To: apmail-struts-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D5F3411FA3 for ; Thu, 11 Sep 2014 11:31:48 +0000 (UTC) Received: (qmail 72573 invoked by uid 500); 11 Sep 2014 11:31:47 -0000 Delivered-To: apmail-struts-user-archive@struts.apache.org Received: (qmail 72536 invoked by uid 500); 11 Sep 2014 11:31:47 -0000 Mailing-List: contact user-help@struts.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Struts Users Mailing List" Reply-To: "Struts Users Mailing List" Delivered-To: mailing list user@struts.apache.org Received: (qmail 72521 invoked by uid 99); 11 Sep 2014 11:31:46 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 11 Sep 2014 11:31:46 +0000 X-ASF-Spam-Status: No, hits=3.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS,URI_HEX X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of mgainty@hotmail.com designates 65.55.111.88 as permitted sender) Received: from [65.55.111.88] (HELO BLU004-OMC2S13.hotmail.com) (65.55.111.88) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 11 Sep 2014 11:31:21 +0000 Received: from BLU172-W12 ([65.55.111.73]) by BLU004-OMC2S13.hotmail.com with Microsoft SMTPSVC(7.5.7601.22724); Thu, 11 Sep 2014 04:31:19 -0700 X-TMN: [M982Tt+BwgWrzjwAfhcq9sKh6VMkUFMC] X-Originating-Email: [mgainty@hotmail.com] Message-ID: Content-Type: multipart/alternative; boundary="_484a8426-17a0-46b5-91b9-411edb3c50d4_" From: Martin Gainty To: Struts Users Mailing List Subject: RE: Struts 2 and automatic ids Date: Thu, 11 Sep 2014 07:31:19 -0400 Importance: Normal In-Reply-To: <8A1C9D52-9B3A-4FD5-8036-5CC243E5F8A5@uta.fi> References: <8A1C9D52-9B3A-4FD5-8036-5CC243E5F8A5@uta.fi> MIME-Version: 1.0 X-OriginalArrivalTime: 11 Sep 2014 11:31:19.0805 (UTC) FILETIME=[E85972D0:01CFCDB3] X-Virus-Checked: Checked by ClamAV on apache.org --_484a8426-17a0-46b5-91b9-411edb3c50d4_ Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable = =20 > From: heikki.hyyro@uta.fi > Subject: Struts 2 and automatic ids > Date: Thu=2C 11 Sep 2014 02:13:44 +0300 > To: user@struts.apache.org >=20 > Hi all=2C >=20 > I recently began to audit a Struts 2.3.16.1 application that I am maintai= ning. While running the pages through the HTML markup validation test at ht= tp://validator.w3.org/=2C I noticed a problem: Struts 2 seems to automatica= lly generate id=92s to many elements related to forms=2C and sometimes this= results in a page that has several elements with identical auto generated = id. This then leads to a markup validation error. So far the only way I hav= e found to get around this is to explicitly generate own unique ids=2C but = this feels like a stupid solution. Is it not possible to prevent Struts fro= m auto generating ids to forms and some elements within them? >=20 > I have tried to google for some solution but have found nothing useful. I= n case it matters=2C the application in question uses the basic Struts =94s= imple theme=94 globally=2C but the same problem occurs also with the "xhtml= theme". MG>reference for id is here http://www.w3.org/TR/html401/struct/global.html#adef-id MG>the 'functions' the (generated) id plays are illustrated here: The (unique) =0A= id attribute has several functions in HTML: =0A= =0A= As a style sheet selector.As a target anchor for hypertext=0A= links.As a means to reference a particular element from a script.As the nam= e of a declared OBJECT element.For general purpose processing by user agent= s (e.g. for identifying fields=0A= when extracting data from HTML pages into a database=2C translating HTML=0A= documents into other formats=2C etc.). =20 MG>struts generates HTML tags using themes which means you *can* create a c= ustom theme as seen here http://www.mkyong.com/struts2/working-with-struts-2-theme-template/ MG>If you *dont* want to create a new custom theme you can refactor existin= g xhtml.ftl to set id=3D"" MG>can you indicate why you want to disable Struts generation of id for HTM= L tag? MG>if set id=3D"" then you would disable references to 'id' so the id refer= ence would not resolve? MG>http://struts.1045723.n5.nabble.com/Struts-tags-ID-generation-td3476228.= html Best regards=2C >=20 > Heikki MG>Martin = --_484a8426-17a0-46b5-91b9-411edb3c50d4_--