I’m trying to convert inputText to java.net.URL in JSF page:
...
<h:form>
<h:inputText value="${myBean.url}" />
<h:commandButton type="submit" value="go" />
</h:form>
...
My backed bean is:
import java.net.URL;
@ManagedBean public class MyBean {
public URL url;
}
Should I implement the converter from scratch or there is some other way?
Yes, you need to implement a
Converter. It’s not that hard for this particular case:Put it somewhere in your project. Thanks to the
@FacesConverterit’ll register itself automagically.