Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [faces-dev] Consider deprecating and dropping h:form prependId
  • From: Manfred Riem <m_riem@xxxxxxxxxxx>
  • Date: Sun, 5 Jan 2025 16:27:51 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=lufP9XsOlNekRDVOFil1o8JbgOReckDnOa9+tpTCeH0=; b=X5DDCZzwHFArCHIVUXIeYAOhoHKHKJOOE0JPrYmfJeaLc61tcmQ5lDB9bjLfG+wcM83Gi/q4kTwwX26ixHjiBFKMavNbGtw8YJDdPLLp8Ug6otM0MtWvyyOO+OkJ2mtgt9Ah3HN0s6LrqwXDZp3w8Z2auIPjEIqmA5Ixe0QCEcvi+y/SF9QJyPfl/vQCE62CpDCu3fFql+B12SiIO6hVWeZmQSZ2Np2nlcGNnEhzKFk1Nj3p5mR8XfeK5T3Tk1iIQ5fuS8zLjIqGk6mt0I4zhjiXGcwWSMrK+ZSNCJmcCxStElkzHQCCmWfPYxeWhj99Tl6IdHrNIBpsK1VdxBEW2Q==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=leL6UYSHQXAKNrpyHb2fzwiikAzkKt/GZLKr0CnhmQ8h4a8jdoSxVZSai332kSU+tfQtuRzr+Hom1tVTbWqk1uBELudqZpStUoIjiJrK2ehk4uz29/A2o/UBSKjQJn5b4e8Y6bohVwlXUd3xkMaDdL6mLBXoGRcgSR3gimrluOg++Nea0Npoo0ieY0MK0RV6NeHPs1lr/yLAsjyaUNuIXl0oArYoThd5+dujY7t5NzrlbmAB06hxzE4KcIdw1X4JeI7/+Wmg0GErAjRuzpKamCY8xbF6fJavR21qcF574ln+OpDZ/z0dVyHEgYMnOIsRWV1OYjMNe13rK+WkTjyxAw==
  • Delivered-to: faces-dev@xxxxxxxxxxx
  • List-archive: <https://www.eclipse.org/mailman/private/faces-dev/>
  • List-help: <mailto:faces-dev-request@eclipse.org?subject=help>
  • List-subscribe: <https://www.eclipse.org/mailman/listinfo/faces-dev>, <mailto:faces-dev-request@eclipse.org?subject=subscribe>
  • List-unsubscribe: <https://www.eclipse.org/mailman/options/faces-dev>, <mailto:faces-dev-request@eclipse.org?subject=unsubscribe>
  • Thread-index: AQHbXqMdDOJxWXSaT0e1ZPTtT6N7QbMIYDHw
  • Thread-topic: [faces-dev] Consider deprecating and dropping h:form prependId

Go for it!

 

From: faces-dev <faces-dev-bounces@xxxxxxxxxxx> On Behalf Of Bauke Scholtz via faces-dev
Sent: Saturday, January 4, 2025 6:21 AM
To: faces developer discussions <faces-dev@xxxxxxxxxxx>
Cc: Bauke Scholtz <balusc@xxxxxxxxx>
Subject: [faces-dev] Consider deprecating and dropping h:form prependId

 

All,

 

Historically, `<h:form prependId="false">` was introduced in JSF 1.2 as sort of patch in order to be able to submit to the predefined URI `j_security_check` using a JSF form because that URI expects the exact input field names `username` and `password` without any (generated) prefix.

Since the introduction of programmatic login API `HttpServletRequest#login()` in Servlet 3.0, released at the same time as JSF 2.0, the `prependId=false` has become unnecessary as people can just invoke `HttpServletRequest#login()` in a backing bean action instead of explicitly submitting to the predefined URI `j_security_check`. Moreover, using `prependId=false` breaks the in JSF 2.0 introduced `f:ajax` and composite components as well as the in JSF 2.3 introduced `f:websocket` because it causes the `findComponent()` to not anymore work within naming containers, see also among others https://github.com/jakartaee/faces/issues/573

These days, people don't anymore use `<h:form prependId="false">` specifically to be able to submit to `j_security_check`, but they essentially abuse `prependId=false` generally to be able to use ids in CSS selectors without the need to escape them. But these people actually need to be re-educated about CSS best practices so that they don't anymore need ids in CSS selectors for non-unique elements/components, see also among others https://stackoverflow.com/a/5882502

All in all, using `<h:form prependId="false">` in JSF 2.x or newer is a red flag and is always discommended. We should deprecate the attribute and eventually remove it so people won't anymore fall into the trap. Do note that this attribute is absent in all naming container components other than `UIForm` and the community never reasonably requested for standardizing it in `NamingContainer`.

 

If there are no objections I will proceed merging https://github.com/jakartaee/faces/pull/1991

 

Cheers, B


Back to the top