facelets

Custom validator with attributes in facelets

I have written a custom Validator that expects an attribute to be set. I know I have to write a Handler (TagHandler or ValidatorHandler?) to set that attribute, but I am having trouble doing it. <tag> <tag-name>validateCustom</tag-name> <validator> <validator-id>package.CUSTOM_VALIDATOR</validator-id> </validator> </...

Is it a common practice to wrap all page content in a form inside a top-level template?

There is a top-level template in my project and it defines several sub-templates nested in a form: <h:form> <ui:insert name="header"/> <ui:insert name="leftbar"/> <ui:insert name="maincontent"/> </h:form> It's not my idea actually to build application in this way. I see both its advantages and disadvantages. The biggest p...

Organizing .xhtml files in subfolders

I have a JSF 2.0 project wiht lots of .xhtml files. Due to a security filter I want to put some of the files in a /secure folder to then aply the filter on. I tried simply moving the files to a folder. But then I get an exception "/selectRole.xhtml Not Found in ExternalContext as a Resource" Do I need to add something to the faces-con...

JSF2: ui:include: Component ID must be unique

Hi, Basic question: Including a page, that contains a component with component id, multiple times cannot be done. But how can i have a reference to that component iside that included page? Example: included.xhtml .... <h:form id="foo"/> .... <!-- here i need reference to foo component of this page --> index.xhtml .... <ui:include...

Jsf How to create a Naming Container

I have a problem with duplicated ids in my JSF app. I've read in this post that one of the possible solutions is to use Naming Container. Can you give me some example how to use the Naming Container to avoid duplicated ids problem? I use Facelets. ...

JSF 2.0 (Facelets) and Struts

Hello I am a newbie with Java EE 6. I started with JSF 2.0, Facelets, Managed Beans and really liked it. It was a great switch from JSP and servlets. It also made me a confused person. It may be the lack of my knowledge, but I have many questions swirling in my mind. Are Facelets and Managed beans a direct replacement of JSP and Servle...

Preferred way to set up a JSF start page ?

Hi, I'm using JSF 2.0 to build a website. Eclipse generated the following web.xml file ... <servlet-mapping> <servlet-name>Faces Servlet</servlet-name> <url-pattern>/faces/*</url-pattern> </servlet-mapping> ... So to view my application i have to visit "localhost/myApp/faces/index.xhtml". I would prefer to view it directl...

Retrieve the fragment (hash) from a URL and inject the values into the bean

Hi! I am looking for a way to inject values from the fragment (#) of a URL into bean(JSF), in the same way query-parameter values are injected. I am using Ben Alman's Bookmarkable jQuery plugin (http://benalman.com/projects/jquery-bbq-plugin/) to create the URL fragments. I was hoping that Custom regex patterns from prettyFaces could be...

JSF 2 - f:ajax tag doesn't work

I have a problem with f:ajax tag. In my previous project, everything worked perfectly. Now I have another project and f:ajax tag doesn't work at all and I don't know why. I have this in JSF page with Facelets: <h:form> ... <h:selectOneMenu id="employeeId" value="#{employeeBean.employeeId}"> <f:selectItems value="#{employeeB...

How to create dynamic JSF 1.2 form fields

Hi. We are using JSF 1.2 and Seam 2.2. I have found some similar questions like this one, however there are so many ways this can be done that it made me more confused. We are getting a XML file that we are reading. This XML contains information on some form fields that needs to be presented. So I created this custom DynamicField.ja...

Moveable Marker Position - Refresh Marker position (GMaps4JSF 1.1.3-u3)

I'm using GMaps4JSF 1.1.3-u3 in a JavaEE 6 Application with JSF 2.0, Facelets, Mojarra 2.0.2 and Primefaces 2.1 on a Glassfish v3 app server. On a xhtml page i want to show some Markers and a moveable Marker (the current selected "station"). Its longitude and latitude positions are stored in some variables with the help of the valueChang...

Tri-object converter for selected list in JSF

We've got h:selectOneMenu that receive the value from a thirdparty thirdpartyObj.type (got a get and set) thirdpartyObj.type.codeName (got only a get and the set is called toCodeName instead) The list of option is given by the thirdpartyService codeNameBean.codeNameList (the type of the object) <h:selectOneMenu id="currentType" v...

Returning list of images on JSF page

Hi, I have a dropdown list of items a user can select from (the view is JSF). I would like for an image to appear on the same JSF page after a user selects an item from the dropdown list (i.e. A user select the word "Cat" from the dropdown list, and group of different cat images appear) How would I code this in JSF? Note* I'm using JS...

c:forEach vs ui:repeat (a.k.a ice:panelSeries)

Hello, I'm trying to avoid using c:forEach because I heard that JSTL doesn't mix well into the render phase of the JSF... I'm not sure of that claim at all. On the contrary I had to resort to using c:forEach instead of ui:repeat in many cases because the ui:repeate simply does NOT iterate on the collection.. this happened in many cases ...

JSF 2 - how to hard code the render variable to a component id

hi. i'm trying to surround a component tree section with: <mycomp id="top"> <f:ajax process=":#{component.clientId}" render=":#{component.clientId}"> ..... </f:ajax> </mycomp> but for every action i can see that the the actual expression is being held and evaluated at the poin it's written into the associated action, ...

Custom JSF component which adds new child to page "head" facet

Hi, I want to create custom component which adds new child to page "head" facet. This custom component is based on h:selectOneMenu. When used on jsf page, user can simply change the current theme. What I need this component to do is to add stylesheet child to head facet. My component has backing java. I tried to modify "head" in encod...

How to make facelets work?

I have created a new web project and enabled its JSF and Facelets capabilities on MyEclipse, then I deployed it over weblogic. Everything look fine but it does not work for me, it seems that the view-handler is not called at all. What is wrong with it? Could anyone help me? This is my web.xml: <?xml version="1.0" encoding="UTF-8"?> <we...

Date error when converting time with f:convertDateTime

Hi, I have problem with f:convertDateTime, that it seems to use the error message *javax.faces.converter.DateTimeConverter.DATE_detail* when I convert time (i.e. it should use *javax.faces.converter.DateTimeConverter.TIME_detail*). The issue, I'm guessing, is that I use a pattern, and thus it does not know if it's a date or a time that...

Ways to include a dynamically generated facelet

In current project I need to create a panel that will contain an HTML content created by the user elsewhere in the application. This content can be easily inserted like this: <h:outputText value="#{myBean.dynamicHTMLContent}" escape="false"/> An example content: <p>User text</p> Now we need to give the user more freedom and allow h...

JSF 2.0 with RAD 8.0 & WAS 7.0.0.0

Hi, I'm trying to develop JSF 2.0 applications with IBM's "RAD8 and WAS7.0.0.0". When I deployed the application via RAD 8 IDE, the application configuration options were disabled so that I could not change anything such as "class loader policy" and adding "shared library references". Once I deployed manually an exported EAR file (usi...