UIX - JSF converter

Hi,
Did anyone succeded in converting BC4J+UIX project into BC4J+JSF? Available converter fails to convert even small project with one page with one table on UIX page...
Any success stories?
Leszek

Hi,
When I try to run generated jspx page through struts, I get following error in browser:
500 Internal Server Error
java.lang.IncompatibleClassChangeError
at oracle.cabo.share.xml.ParseErrorUtils.getErrorMessage(Unknown Source)
at oracle.cabo.share.xml.ParseErrorUtils.log(Unknown Source)
at oracle.cabo.ui.xml.parse.UINodeParser._parseBinding(Unknown Source)
etc.
I run it through struts because converter puts on struts my simple page. It doesn't put it on faces-config. However even when I try to run it through faces (I change url in browser by adding 'faces/' and changing extension from '.do' to '.jspx' I still get an error:
500 Internal Server Error
javax.faces.el.EvaluationException: com.sun.faces.el.impl.ElException: No function is mapped to the name "ctrl:createSortableHeaderModel"
     at com.sun.faces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:188)
     at com.sun.faces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:154)
     at oracle.adf.view.faces.bean.FacesBeanImpl.getProperty(FacesBeanImpl.java:55)
I think that converted page shouldn't contain el expressions that are used to create sortable table headers.
Anyway, converter is unable to convert so simple project into working JSF project... so it's not helping us in our work.
Leszek
P.S. I've sent simple UIX testcase to you. It's ounconverted so you may do it by yourself to be sure that the problem so not related to wrong conversion method...

Similar Messages

  • Injecting EJB to JSF Converter

    Is it possible to inject EJB (or at least EntityManager) to JSF Converter or Validator?
    I don't know if i'm missing something or is it just impossible - it works when injecting EJB into Managed Bean.
    Thanks.
    Sławek S.

    Slawek_Sobotka wrote:
    Thanks.
    So I'll redefine my question to be problem oriented:
    I have SelectItem that contains Address object.
    I have implemented AddressConverter so that it converts Adress to String simply by using it's id.
    How to convert back: from string (address's id) do Address object?Map it. Two general ways are mentioned here: [http://balusc.blogspot.com/2007/09/objects-in-hselectonemenu.html].
    I would like to load it form DB...That's a bit too expensive for less or more static data.
    Another solutions are:
    - SelectItem should contain address.id instead of address. Than no converter is need. My ManagedBean is reposnsible for translating ids do entities. Works but primitive.JSF can't help that HTTP/HTML only understands Strings (by the way, primitives are also already implicitly converted by EL, you only don't know that).
    - Converter is created by factory method of Managed Bean. MB sets address list to the converter while creating it. List shouldn't be huge if it is used in GUI.
    drawback: loading list in BB twice because converter is used while rendering and while decoding.
    - In converter try to possess MB that has EJB and call method that reutrns entities, sth like this: facesContext.getApplication().getELResolver()...Reloading static data on every request makes als no sense.
    Retoric question: what for are useful JSF Converters?To convert between Object and String, so that it can be passed through HTTP request/response and displayed/taken in HTML.

  • Parametrized JSF Converter

    Hello
    my question:
    for example i have a h:selectOneMenu, witch present the streets in the any (chose before) town
    this selection in xhtml page looks like
    <h:selectOneMenu id="town_4"     value="#{locationAddAction.street}" immediate="true">
         <f:selectItems value="#{locationAddAction.streetLookup}" />
         <fmedia:streetConverter town="#{locationAddAction.town}" />
    </h:selectOneMenu>in my project i need to convert a string into Street object stored in DB
    but there are can be many streets with the same names, but difference in town reference
    so i need the town attribute in converter
    my converter class extends javax.faces.convert.Converter
    public class StreetConverter implements Converter {
         private LocationService locationService = new LocationService();
         private Town town;
         @Override
         public Object getAsObject(FacesContext arg0, UIComponent arg1, String arg2) {
              Town town = locationService.getStreetByNameMatch(town,arg2)
              return town;
         @Override
         public String getAsString(FacesContext arg0, UIComponent arg1, Object arg2) {
              if (arg2 instanceof Street)
                   return ((Street) arg2).getName();
              return null;
         public Town getTown() {
              return town;
         public void setTown(Town town) {
                    this.town = town;
    }i registered my converter with parameter in faces-config.xml
    <converter>
              <converter-id>streetConverter</converter-id>
              <converter-class>package.StreetConverter</converter-class>
              <attribute>
                   <attribute-name>town</attribute-name>
                   <attribute-class>package.Town</attribute-class>
              </attribute>
         </converter>and create my facelet tag
    <tag>
              <tag-name>streetConverter</tag-name>
              <converter>
                   <converter-id>streetConverter</converter-id>
              </converter>
         </tag>PROBLEM:
    any request to my converter (StreetConverter, <fmedia:streetConverter>) set the new creation of my Converter
    but the initialization of "town" field happend only once in creation page (when i'm requesting whole jsf page) and any request to converter is erasing my town parameter, becouse it has been init in another converter object.
    how can i initialize town attribute in all requests to converter ?
    sorry my horrible english
    thanks =)

    Use f:attribute:<h:someComponent>
        <f:converter converterId="streetConverter" />
        <f:attribute name="town" value="#{bean.town}" />
    </h:someComponent>
    public X getAsX(FacesContext context, UIComponent component, Y value) {
        Object town = component.getAttributes().get("town");
    }Alternatively just get the bean from context:
    public X getAsX(FacesContext context, UIComponent component, Y value) {
        Bean bean = (Bean) context.getApplication().evaluateExpressionGet(context, "#{bean}", Bean.class);
        Town town = bean.getTown();
    }

  • JSF Converter - bug

    When J associate my converter to HtmlDataTable(h:dataTable) in JSF(JSP) page in 'Design' tab appear problems:
    1) in dataTable there isn't any column visable
    2) everything below dateTable in same Panel Grid aren't visable
    All this affect only 'Design' tab. In 'Source' tab everything is OK and when J run application everithing work like it should.
    Is this bug or can be fixed somehow?

    Hi.
    J solve the problem partly and here is the problem and solution:
    Problem - JDeveloper 10.1.3 have problem in showing table when code look like this:
    <h:dataTable width="350" value="#{infoBean.popular}" var="popular_">
    <h:column>
    <f:facet name="header">
    <h:panelGroup>
    <h:commandLink action="POPULAR">
    <h:outputText value="Najpopularnije"/>
    </h:commandLink>
    </h:panelGroup>
    </f:facet>
    <h:commandLink>
    <h:outputText value="#{popular_}" converter="ProductTitle"/>
    </h:commandLink>
    </h:column>
    </h:dataTable>
    Solution - When J change code to this 'Design' tab shows the table but not the text in 'outputText'(here #{popular_}):
    <h:outputText value="#{popular_}">
    <f:converter converterId="ProductTitle"/>
    </h:outputText>
    Please try this!

  • JSF Converter Error

    Hi, I have the following:
    JSF 1.2 RI
    Sun App Server 9 Update 1 Patch 1
    Models:
    public interface Model {
      int getId();
      String getName();
    public class Model1 implements Model {
      public int getId() {
        return 1;
      public String getName() {
        return "One";
    public class Model2 implements Model {
      public int getId() {
        return 2;
      public String getName() {
        return "Two";
    Controller:
    public class TestController {
      private Model model;
      private List<Model> models;
      public TestController() {
        models = new ArrayList<Model>();
        models.add(model = new Model1());
        models.add(new Model2());
      public Model getModel() {
        return model;
      public void setModel(Model model) {
        this.model = model;
      public List<SelectItem> getModels() {
        List<SelectItem> list = new ArrayList<SelectItem>();
        for (Model model : models)
          list.add(new SelectItem(model, model.getName()));
        return list;
      public Model findModel(int id) {
        for (Model model : models) {
          if (model.getId() == id)
            return model;
        return null;
    Converter:
    public class ModelConverter implements Converter {
      public Object getAsObject(FacesContext facesContext, UIComponent uiComponent, String string) {
        TestController controller = (TestController) facesContext.getExternalContext().getSessionMap().get("testController");
        return controller.findModel(Integer.parseInt(string));
      public String getAsString(FacesContext facesContext, UIComponent uiComponent, Object object) {
        return String.valueOf(((Model) object).getId());
    View:
    <%@ page contentType="text/html" %>
    <%@ page pageEncoding="UTF-8" %>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
    <html>
    <head>
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
      <title>Test JSF</title>
    </head>
    <body>
    <f:view>
      <h:messages errorStyle="color: red" infoStyle="color: green" layout="table"/>
      <h1>Test JSF</h1>
      <h:form>
        <h:panelGrid columns="2">
          <h:outputText value="Model:"/>
          <h:selectOneMenu value="#{testController.model}">
            <f:selectItems value="#{testController.models}"/>
          </h:selectOneMenu>
        </h:panelGrid>
      </h:form>
    </f:view>
    </body>
    </html>
    faces-config.xml:
    <?xml version='1.0' encoding='UTF-8'?>
    <faces-config xmlns="http://java.sun.com/xml/ns/javaee"
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd"
                  version="1.2">
      <converter>
        <converter-for-class>com.test.model.Model</converter-for-class>
        <converter-class>com.test.converter.ModelConverter</converter-class>
      </converter>
      <managed-bean>
        <managed-bean-name>testController</managed-bean-name>
        <managed-bean-class>com.test.controller.TestController</managed-bean-class>
        <managed-bean-scope>session</managed-bean-scope>
      </managed-bean>
    </faces-config>
    The problem:
    When I run the app, JSF throws the following error:
    javax.servlet.ServletException: Cannot convert com.test.model.Model2@ba30aa of type class com.test.model.Model2 to class com.test.model.Model1
    root cause
    java.lang.IllegalArgumentException: Cannot convert com.test.model.Model2@ba30aa of type class com.test.model.Model2 to class com.test.model.Model1Is there any limitation on converters to prevent using a single Converter for a base class (or interface like Model) and subclasses (like Model1 and Model2)?
    I've tried this using JSF 1.1 RI, Apache MyFaces 1.1 and the error is still there.
    Thanks!

    This sounds like Issue 442, which was resolved in 1.2_03. If I recall right, V1 P1 is 1.2_02. Please upgrade JSF to 1.2_04 [2]. The download section has an updater for GlassFish.
    [1] https://javaserverfaces.dev.java.net/issues/show_bug.cgi?id=442
    [2] https://javaserverfaces.dev.java.net/servlets/ProjectDocumentList?folderID=7089&expandFolder=7089&folderID=0

  • UIX - JSF example?

    One thing that would really help at my company to sell the idea of building UIX pages now and migrating them to JSF when the standard finalizes would be an example of what this transformation might look like. Is there any chance of a small example of a UIX page with a few interesting features and the JSF that would result from a translation?
    Thanks!

    Here is a reply from management and PMs:
    The natural extension of what we have today is that a .uix file (XML) would be making calls to JSF components instead of UIX components. This would be very much in line with your XUL example, and it means that a .uix file would be yet another way to access JSF, like JSP or XUL.
    However, we are very aware of the advantage of developer familiarity with JSP that you mentioned. It is a very important goal of ours to continue to bring UIX technology closer in line with JSP, and the most recent evidence of that was the UIX support for JSP 2.0 EL we added in JDeveloper 10g. There will be more movement in that direction once JSF is finalized and fully supported in JDeveloper, but additional details are still in the works. :)
    There will be some obvious differences between UIX and JSF. For example, JSF provides standard mechanisms for automatic event and state handling for components, and this will mean that some UIX code will no longer be needed in a JSF application. We expect to provide upgrade utilities for pages that use the UIX XML syntax, because that is one of the benefits of using XML.
    However, JSF itself is still months away from completion. Providing support for JSF in JDeveloper is tied to that, as we cannot ship support for JSF in a production release until JSF itself is production. That doesn't match well with the JDeveloper 10g schedule, but the rough schedule diagram at:
    http://radio.weblogs.com/0118231/2003/09/18.html#a155
    might give you a better idea of which release would be in line with the current JSF schedule -- JDeveloper 10g 10.0.3.
    I hope this helps. Let us know if you have more questions.

  • JSF Converter how to use property in faces-config

    I have made an Converter for my listbox, and it is working.
    Now I want to use a property to change the behavior of the converter.
    My faces-config looks like this:
    <!-- Converters -->     
    <converter>
    <converter-for class>model.PacemakerBranche</converter-for-class>
         <converter-class>cconverter.BrancheConverter</converter-class>
         <property>
              <property-name>test</property-name>
              <property-class>java.lang.String</property-class>
              <default-value>12345</default-value>
         </property>
    </converter>
    I try to set the test property to 12345.
    The setTest(String test) is not set.
    What am I doing wrong??
    My converter looks like this:
    public class BrancheConverter implements Converter {
    private String test;
    public String getTest() {
    System.out.println("getTest " + test);
    return test;
    public void setTest(String test) {
    System.out.println("setTest " + test);
    this.test = test;
    public Object getAsObject(FacesContext ctx, UIComponent component,
    String value) {
    return getMgr(ctx).getObject(model.PacemakerBranche.class, new Long(value));
    public String getAsString(FacesContext ctx, UIComponent component,
    Object object) {
    return ((BaseObject) object).getId().toString();
    private Manager getMgr(FacesContext ctx) throws HibernateException {
    return (Manager) FacesContextUtils.getWebApplicationContext(ctx).getBean("manager");
    }

    You can't use f:converter tag for setting properties.
    There are two ways you can use:
    (1) use f:attribute tag
    ex.<h:inputText value="#{...}"/>
      <f:converter converterId="...."/>
      <f:attribute name="test" value="#{...}"/>
    </h:inputText>Note that you should get the value of the attribute from the UIInput component, something like:comp.getAttributes.get("test");(2) develop a custom converter tag.

  • Reusable JSF components - bundling a converter with a text field

    I am trying to create reusable text fields for different types of data (notes, amounts, percentages) that will use a JSF converter to implement formatting.
    Here is what I have done
    - created an application in JDeveloper that contains my components as JSF declarative components
    - created the Converter classes
    - registered the converter classes in faces-config.xml of the reusable components project
    - added my Converters to the inputText fields for each of my declarative components using the property palette
    - deployed the components as a jar file using the ADF Library Jar File archive type
    - created a second application to act as a consumer of the components
    - imported the jar file into the component palette using a file system connection
    - added the jar file to the active project's component library
    - added a converter entry for the converter I am trying to use to this project's faces-config.xml
    - created a consumer jspx page and dragged and dropped the control onto the page
    I put some system.outs in the getAsString() and getAsObject() methods of the converter I am trying to use and they are not output when I run the page. I've also set breakpoints in those methods to see if they are being called.
    I have no indication that my converter is being called.
    Can someone please confirm that what I am trying to do is possible using the declarative components?
    Any insight appreciated.
    Dave

    Actually this is working. I made the incorrect assumption that getAsString() in the converter class would be called on the initial request.
    Another thing I just noticed is that it is not necessary to reference the converter in the faces-config.xml of the consuming project. Not sure how this works, but its a nice feature :)

  • UIX contents childData JSF Alternative

    I have not yet run the UIX-JSF migration utility, but still evaluating the migration options.
    What is the expected replacement for the repeating a UIX Contents by the childData attribute.
    The only alternative I see currently is to user the Standard Tag Libs and the for-loop.
    Thanks
    Pat

    Hi Pascal
    You can try something of this sort and it should work.
    <choice>
    <contents childData="${bindings.View1.rangeSet}">
    <option text="${uix.current.Bez}" value="${uix.current.Suite}"/>
    </contents>
    </choice>
    Thanks,
    Vijay V

  • Oracle UIX Framework...

    Hi everyone, I'm learning a lot about frameworks these days and I have a few questions for you guys about Oracle's UIX Framework...
    First of all, I'm under the impression that this framework is not really J2EE compliant? It uses uix files instead of jsp's so in my mind this is a disadvantage right from the start. Also, I'm under the impression that not a lot of people out there are using uix so it makes it hard to find ressourses for it.
    The VIEW part seems to have lots of limitations. Everything is stucked into a layout and it's almost impossible to use a custom 'look and feel' so all sites developed with uix have the BLAF look. Am I mistaking or you must stick with BLAF while developing with UIX?
    I know in the future that UIX will use JSF but until this is done, UIX components seem hardly customizable?
    Last but not least, I'm not under the impression that UIX is user friendly, I dont think a common java programmer can get very good in UIX within days, I'm feeling it's more a mater of months.
    I'd like to have your thoughts on UIX, advantages as well as disadvantages. Also, does anyone know if there will be a framework for JSF? Somekind of framework that will allow common programmers to use efficiently JSF without knowing all the details of JSF.
    Thanks a lot!

    Hi,
    You can use the UIX taglibs & actually create jsp files instead of UIX files.
    Infact you can plan to use UIX taglib exclusively for your view layer & use any framework for your web application i.e. for eg. struts for the forms & action handling.
    The trick really lies in integrating the UIX taglib & accessing the custom tags in your JSP pages. Further what are the complete set of jar files which one would require to assemble the complete EAR or WAR files.
    in web.xml put the following entry
    <taglib>
    <taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
    <taglib-location>/WEB-INF/struts-html.tld</taglib-location>
    </taglib>
    Better still if you are using JDeveloper (before 10.1.3 version) then you can just use the UIX wizard to create a UIX page (it shows you the preview ).
    After you have created a .uix file convert it to a .jsp file ..
    Rules are pretty simple to follow while doing this conversion..
    eg. of a simple UIX file and the equivalent JSP ..
    <?xml version="1.0" encoding="windows-1252"?>
    <page xmlns="http://xmlns.oracle.com/uix/controller"
          xmlns:ui="http://xmlns.oracle.com/uix/ui"
          xmlns:ctrl="http://xmlns.oracle.com/uix/controller"
          xmlns:html="http://www.w3.org/TR/REC-html40"
          expressionLanguage="el">
      <content>
        <dataScope xmlns="http://xmlns.oracle.com/uix/ui">
          <provider>
            <!-- Add DataProviders (<data> elements) here -->
          </provider>
          <contents>
            <document>
              <metaContainer>
                <!-- Set the page title -->
                <head title=""/>
              </metaContainer>
              <contents>
                <body>
                  <contents>
                    <form name="form">
                      <contents>
                        <tableLayout>
                          <contents>
                            <rowLayout>
                              <contents>
                                <cellFormat>
                                  <contents>
                                    <formattedText text="Login"/>
                                  </contents>
                                </cellFormat>
                                <cellFormat>
                                  <contents>
                                    <textInput name="login"/>
                                  </contents>
                                </cellFormat>
                              </contents>
                            </rowLayout>
                            <rowLayout>
                              <contents>
                                <cellFormat>
                                  <contents>
                                    <formattedText text="Password"/>
                                  </contents>
                                </cellFormat>
                                <cellFormat>
                                  <contents>
                                    <textInput name="pwd" secret="true" maximumLength="10"/>
                                  </contents>
                                </cellFormat>
                              </contents>
                            </rowLayout>
                            <rowLayout>
                              <contents>
                                <cellFormat/>
                                <cellFormat>
                                  <contents>
                                    <button text="Submit"/>
                                  </contents>
                                </cellFormat>
                              </contents>
                            </rowLayout>
                          </contents>
                        </tableLayout>
                      </contents>
                    </form>
                  </contents>
                </body>
              </contents>
            </document>
          </contents>
        </dataScope>
      </content>
      <handlers>
        <!-- Add EventHandlers (<event> elements) here  -->
      </handlers>
    </page>The equivalent JSP..
    <uix:page  expressionLanguage="el">
        <uix:dataScope >
          <uix:contents>
            <uix:document>
              <uix:metaContainer>
                <!-- Set the page title -->
                <uix:head title="Template"/>
              </uix:metaContainer>
              <uix:contents>
                <uix:body>
                  <uix:contents>
                       <uix:pageLayout>
                       <%-- Embed The JSPF here --%>
                       <%@ include file="jspf/globalTop.jspf" %>
                       <%-- Message Box --%>
                         <uix:switcher childName="<%=  isError %>">
                            <uix:case name="true">
                              <uix:messageBox automatic="false"
                                text="Error"
                                messageType="error"
                                message="Either User Name/ Or Password is wrong"/>
                            </uix:case>
                          </uix:switcher>
                       <%-- Message Box --%>
                       <%-- Body Content --%>
                         <uix:rowLayout>
                         <uix:contents>
                            <uix:form name="form" destination="login.do" method="POST">
                              <uix:contents>
                                <uix:tableLayout>
                                  <uix:contents>
                                    <uix:rowLayout>
                                      <uix:contents>
                                        <uix:cellFormat>
                                          <uix:contents>
                                            <uix:spacer width="10" height="10"/>
                                          </uix:contents>
                                        </uix:cellFormat>
                                      </uix:contents>
                                    </uix:rowLayout>
                                    <uix:rowLayout>
                                      <uix:contents>
                                        <uix:cellFormat>
                                          <uix:contents>
                                            <uix:rawText text="Login"/>
                                          </uix:contents>
                                        </uix:cellFormat>
                                        <uix:cellFormat>
                                          <uix:contents>
                                            <uix:textInput name="login" columns="10"/>
                                          </uix:contents>
                                        </uix:cellFormat>
                                      </uix:contents>
                                    </uix:rowLayout>
                                    <uix:rowLayout>
                                      <uix:contents>
                                        <uix:cellFormat>
                                          <uix:contents>
                                            <uix:spacer width="10" height="10"/>
                                          </uix:contents>
                                        </uix:cellFormat>
                                      </uix:contents>
                                    </uix:rowLayout>
                                    <uix:rowLayout>
                                      <uix:contents>
                                        <uix:cellFormat>
                                          <uix:contents>
                                            <uix:rawText text="Password  "/>
                                          </uix:contents>
                                        </uix:cellFormat>
                                        <uix:cellFormat>
                                          <uix:contents>
                                            <uix:textInput name="password" columns="10" secret="true"/>
                                          </uix:contents>
                                        </uix:cellFormat>
                                      </uix:contents>
                                      </uix:rowLayout>
                                      <uix:rowLayout>
                                        <uix:contents>
                                          <uix:cellFormat>
                                            <uix:contents>
                                              <uix:spacer width="10" height="10"/>
                                            </uix:contents>
                                          </uix:cellFormat>
                                        </uix:contents>
                                      </uix:rowLayout>
                                      <uix:rowLayout>
                                        <uix:contents>
                                          <uix:cellFormat/>
                                          <uix:cellFormat>
                                            <uix:contents>
                                               <uix:button name="admin"
                                                  text="Submit" onClick="OnSubmitForm()"/>
                                            </uix:contents>
                                          </uix:cellFormat>
                                        </uix:contents>
                                      </uix:rowLayout>
                                    </uix:contents>
                                  </uix:tableLayout>
                                </uix:contents>
                              </uix:form>
                            </uix:contents>
                          </uix:rowLayout>
                       <%-- End Of Body Content --%>
                    </uix:pageLayout>                  
                  </uix:contents>
                </uix:body>
              </uix:contents>
            </uix:document>
          </uix:contents>
        </uix:dataScope>
    </uix:page>

  • How to custom a conversion error in JSF page in JDeveloper

    According to the book "Core JavaServer Faces" p213 (fifth edition), if I add the following line to messages.properties file, and specifiy it in the faces-config.xml and .jsp file, then the displayed conversion error message should be my tailored one instead of the default. However, I still get the default error message. Besides, I didn't find "CONVERSION" variable in UIInput class. Is the book wrong? And what's the correct way?
    javax.faces.component.UIInput.CONVERSION=Please correct your input

    I didn't choose any special in JDeveloper IDE. I just selected "new" to create a file called "message.properties" and put the line there. I didn't specify converters excepts declaring the type in the Jave Beans. I guess the converting is done by the JSF framework automatically. It must be a JSF converter since I created the page as a JSF page.

  • A new approach to JSF error handling?

    Hi.
    I would like to run an idea by the community to check that I am not being crazy in doing this stuff. I would appreciate any comments, criticism or ideas.
    I was thinking about JSF's error processing mechanism, specifically about how label text gets associated with an input field. So, I am talking about this kind of stuff:
    <h:outputLabel for="firstName" value='#{msgs["applicant.search.firstName"]}: ' />
    <h:inputText id="firstName" value='#{applicantDetailsBackingBean.firstName}' required=�true�/>If the value is not entered into the input field, we will get an error message saying:
    �First Name�: is required.
    So HtmlMessageRenderer has replaced the field id in the FacesMessage with the label text by using the association set up with the 'for' attribute on the label. All of this message "decoration" work happens in the RENDER phase in a centralized location. I see a couple of weaknesses in this approach
    1) It is too late for resolving label text data if the label is inside a data table
    2) JSF establishes associations between label text and the input fields by using the label components to point to their input fields. Although this seems more natural, it limits label text sources to just the label components present on the current page (or whatever is nested under them), which makes it impossible to associate input field messages with label text that does not exist on the page in its entirety.
    Let's look at a couple examples, both of which I ran into in my application:
    1) Consider a situation in which we have a dataTable where every row consists of a student name and an input field for entering their assignment mark. The validation on the input field will be restricted to valid letter grades only. If the user enters an invalid grade, we want them to see an error message of the form: +�The mark entered for <student name> is invalid�.+ Since <student name> is dependent on the row in which the error occurred, this error message is not possible to generate with bare JSF functionality.
    2) Another situation that gets us in trouble is when the label text we want in our error message is not on the page (or not in it's entirety). For example, your page could be split up into multiple parts with those parts having input fields with the same name. We would want the error message to include the page part as well as the field name. This is not easily achieved with the bare JSF functionality.
    So to generalize, any situation where a label component with a static value throughout the lifecycle is not available will cause difficulty.
    Please correct me if I am wrong on any of these points.
    Since in my app I had a lot of complicated pages to deal with, I solved my difficulties by writing a very simple framework that I called Message Decorator Framework (MDF). It enabled me to easily construct much more detailed error messages than what the standard JSF approach seems to allows for. MDF provides a mechanism to specify the label text to be applied to a validation or a conversion message by either a literal, an el expression or via an id of another ValueHolder and all of these work in data tables.
    The idea is a s such, and this is what i would like your opinion on:
    MDF provides more flexible message decoration by adapting the opposite approach to the one used by the JSF:
    1) Message decoration is decentralized. MDF wraps converters and validators on individual input fields and performs message text replacement right on the spot in the PROCESS_VALIDATIONS phase, when all of the pertinent data for resolving the label text is still available.(i.e the components in data tables would still have the correct values for the current row being validated)
    2) The label text to be used is specified by the input field, not the label. This allows the developer to reference any text value, instead of tying them to a specific label component.
    Pictures are better than words, so here is an architectural diagram:
    http://www.imagehosting.com/out.php/i1259440_ArchitectureDiagram.png
    The framework consists of two main classes, ConverterMessageDecorator and ValidatorMessageDecorator. I will just talk about the converter part, b/c the validator part is very similar but wraps a list of validators instead of one converter.
    So ConverterMessageDecorator is a JSF converter. Its purpose is to wrap the converter that is going to do the actual conversion work and decorate the FacesMessage inside ConverterException if one was thrown.
    The converter to wrap can be either determined automatically based on the type of the value reference of the input field or specified explicitly. This converter decorates the message by replacing all instances of the input field�s id with the resolved label text. The power of this approach is that not only do you get a much more flexible way to specify what the label text is (either fieldLabel or fieldLabelComponent attributes), but now data tables are no longer a problem.
    Here are some usage examples:
    <h:inputText value='#{section33SetupBackingBean.contribution.sampleGatePct}'>
       <md:decorateConverterMessage fieldLabel= '#{msgs["section.34.setup.contribution.initial.sampling.gate.max.size"]}' />
    </h:inputText>
    �etc�
    <h:inputText value='#{section33SetupBackingBean.payment.sampleGatePct}'>
       <md:decorateConverterMessage fieldLabel= '#{msgs["section.34.setup.payment.initial.sampling.gate.max.size"]}' />
    </h:inputText>The two input fields have exactly the same labels on the screen (they are in two different parts of the page), so if we used their respective labels, the error messages would look the same for these two input fields.
    More complicated example:
    <h:dataTable value="#{paymentCalcBackingBean.currentPaymentPercentages}" var="currentPercentage" >
    <h:column>
      <ops:refDataDescription id="provinceLabelTextId" refDataType="provinceStateType"
                code="${currentPercentage.programProvince.provinceStateTypeCode}" />
    </h:column>
    <h:column>
      <h:inputText value="${currentPercentage.federalPercentage}">
    <md:decorateConverterMessage fieldLabelComponent="provinceLabelTextId"  valueRequired="true" >
       <f:converter converterId="ops.PercentageConverter" />
    </md:decorateConverterMessage>
    <md:decorateValidatorMessage fieldLabelComponent="provinceLabelTextId" >
       <f:validator validatorId="ops.PercentageValidator" />
    </md:decorateValidatorMessage>
    </h:column>
    �etc�
    </h:dataTable>This would produce errors shown in this screenshot: http://www.imagehosting.com/out.php/i1259418_Example3.png
    Here is another example that shows off what you can do by referencing other ValueHolders on the page.
    The code is exactly the same as the snippet shown above, but the inputText component is referencing a text box, so the label text is going to be whatever the user types into the text box:
    http://www.imagehosting.com/out.php/i1259467_Example4.png
    Does this approach seem reasonable to people, or am I reinventing the wheel? Please let me know.
    Val

    Try restarting the DTR application and see if the problem persists.

  • Is there a Simple Way to Reformat  Database Text with Custom Converter?

    When a database column contains a string, often the string may be stored in the database in a form that may not be suitable for viewing by the user. It is often interesting to show the user the string after it has been reformatted. Many things including phone numbers, product codes and various other application specific encodings fit into this category. The JSF Converter concept seems to be an ideal place to apply the reformatting via the application of a custom converter. In fact, many of the text books written on JSF refer to the JSF ability to support text reformatting using a custom converter. However, we have not been able to make it work in JSC2_1.
    For example, when a CachedRowSet Table Data Provider is used in a JSC2 application to show tabular data from a database, text columns from the database are automatically bound to StaticText components. Unfortunately, if the developer creates a custom converter and attaches it to the StaticText component, the converter is never called when the object to be converted is already of type String. If the object to be converted is a Date, CLOB or any other type the custom converter will be called - but not for type String. Thus the text is presented to the user directly as stored in the database witout the desired reformatting. The OutputText component on the other hand does appear to support custom converters but there is no possibility within the JSC2 IDE to substitute the OutputText component for the StaticText component in the CachedRowSet Table Data Provider.
    This situation appears to be inconsistent with the JSF specification. Does anyone know if this is a bug or a deliberate design decision or a misuse of the IDE on our part? Last question; has anyone come across a workaround?

    Try using "Examine Document" to remove the OCR output.
    Be well...

  • Convert OutputText's Number into Terabytes

    Hi,
    I have the following requirement where we display the Storage Volume size (for ex:11929649152 bytes) as an output text.
    Do we have any number format component in adf to convert this number (11929649152) into Terabytes.
    Thanks,
    Kiran

    Create a new custom jsf converter for your requirement.
    http://download.oracle.com/docs/cd/B31017_01/web.1013/b28967/web_val006.htm
    Regards,

  • Getting an error while validating with the help of domain

    This is strange. I am validating an email address column in employees table by creating a domain and then associating it with the email column in the table. This is the code
        protected void validate() {
            //  ### Implement custom domain validation logic here. ###
            int atpos = mData.indexOf('@');
            int dotpos = mData.lastIndexOf('.');
            if (atpos > -1 || dotpos > -1) {
                throw new DataCreationException(null, "Invalid Email Address", null);
        }But while committing records, I am receiving the following error:
    Cannot convert testmailid of type class java.lang.String to class model.common.DomainEmail
    Can anyone help me?
    Oh yes, I am using JDev 11.1.2.3

    I suspect that you are using an <af:inputText> with no converter for entering the email on the page. The purpose of a converter would be to convert the String value entered by the user in the field to another datatype (e.g. to model.common.DomainEmail type) which is expected by the model layer (e.g. by the target VO attribute). If there is no such converter, JSF does not perform any datatype conversion and it tries to assign the java.lang.String value to the VO attribute (which is of model.common.DomainEmail datatype), so a type casting error occurs. If that is the case, then you should implement and attach a proper JSF converter to the <af:inputText> component.
    Dimitar

Maybe you are looking for

  • Best Practices: iPad/MacBookPro synching for video production in education

    My organization just bought 14 Macbook Pros and 14 iPads Minis. Our goal is to have students in single-day classes use the iPads to film something, then synch/export the video to a MacBook Pro where they can then edit that video in iMovies. Once that

  • SMQ2 (Inbound Queue) : Error occurred during character conversion

    Hi, In SMQ2 an Inbound Queue has failed with status text "Error occurred during character conversion". The XML message inside this queue is in waiting status with status text " Scheduled for Outbound Processing" . Even after cancelling this message f

  • Thunderbolt to Ethernet problem

    I have a new MBP with retina. Whenever I plug in the thunderbolt to ethernet connector the usb stops working. Any fixes for this?

  • Organising itunes folders

              I have discovered the iTunes Music folder (inside the iTunes folder in the Music folder) does not reflect the Library or playlists in iTunes: items are either missing from any particular folder; in other folders; or duplicated in other fold

  • Drag and drop movies out of Aperture?

    I imported my movies into Aperture and now I can't get them back out.  I tried to drag and drop them to the desktop but it only creates an 'info' file that's only a few kb large.  I want to move about 300 files out of Aperture and into iMovie where I