---
title: ":form prependId = false"
author: "javaeye_mao"
date: "2012-06-27T11:59:26Z"
tags: []
categories: ["Web前端"]
slug: "form-prependid-false"
draft: false
lastmod: "2012-06-27T11:59:26Z"
id: 1568898
url: "https://javaeye-mao.iteye.com/blog/1568898"
---

f you care to see the HTML source from your browser, you will find out that the `id` of your `input` field is `<form-id>+":"+<input-field-id>`, in your case, `j_idt7:UserId:`. Try to give your`<h:form>` some meaningful `id` in order to make some sense out of it. You can read about [JSF IDs here](http://illegalargumentexception.blogspot.com/2009/02/jsf-working-with-component-ids.html). In case you don't like it, you can turn it off by modifying your `form` tag to something like this,

```java
<h:form prependId = false> // its true by default.
```

But that might turn out to be problematic, as pointed out by [BalusC](http://stackoverflow.com/questions/4385118/jsf-2-why-the-form-id-prefix-in-the-hmessage-output/4390231#4390231) here.

Furthermore, it seems like you have never configured any validation messages yourself. Which in turn ends up with this message. Hence, a `message.properties` file is needed to have a control over message and show something more appropriate. Even then the field name should not be the part of the message, to make those validation message generic to avoid repetition. See [BalusC's answer](http://stackoverflow.com/questions/4385118/jsf-2-why-the-form-id-prefix-in-the-hmessage-output/4390231#4390231) regarding the use of `label` attribute inside the `<h:inputText>`.

 

[http://stackoverflow.com/questions/4385118/jsf-2-why-the-form-id-prefix-in-the-hmessage-output/4390231](http://stackoverflow.com/questions/4385118/jsf-2-why-the-form-id-prefix-in-the-hmessage-output/4390231)