JSF 2.0: Parameterizable Converter

Hey there,
I have implemented a custom converter for type String that checks the user input for forbidden characters. Additionally I 'm looking for a possibility to set a type parameter to change the list of forbidden characters depending on the input type.
I found some articles with different proposals for solution, but the easy ones don 't work and the less easy ones seem to me to be some kind of JSF 1.x solution.
That 's what I tried:
I added a property and an attribute node for my converter in my faces-config.xml, just to see if one that will work:
<converter>
<converter-id>secureStringConverter</converter-id>
<converter-class>de.unioninvestment.phoenix.tc.security.SecureStringConverter</converter-class>
<attribute>
<attribute-name>type</attribute-name>
<attribute-class>java.lang.String</attribute-class>
<default-value>Kontonummer</default-value>
</attribute>
<property>
<property-name>maxLength</property-name>
<property-class>int</property-class>
<default-value>1024</default-value>
</property>
</converter>
I added the Java Bean properties type and maxLength to my converter class.
I tried several ways to set the type inside my facelet:
<h:inputText id="belegnummer" value="#{nachrichtenBean.belegNr}" label="Belegnummer" >
<f:converter converterId="secureStringConverter" type="Belegnummer" >
</f:converter>
</h:inputText>
<h:inputText id="laufendeNummer" value="#{nachrichtenBean.laufendeNr}" label="Laufende Nummer" >
<f:converter converterId="secureStringConverter" >
<f:attribute name="type" value="LaufendeNummer" />
</f:converter>
</h:inputText>
<h:inputText id="kundennummer" value="#{nachrichtenBean.kundenNr}" label="Kundennummer" >
<f:converter converterId="secureStringConverter" >
</f:converter>
<f:attribute name="type" value="Kundennummer" />
</h:inputText>
I found some articles telling me that I have to provide a tag lib for my custom converter and I found some articles saying that I have to implement a tag handler, too. Honestly, I don 't wand to do neither of these... :-) Fact is now: The default values in the faces-config.xml are not set and the values in the facelet are not set, neither.
Any hint? Any good tutorial covering converter parameters?
Thanks,
Stephan

Post your code. It worked in 1.2.

Similar Messages

  • 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 :)

  • Jsf newbie :: converter and navigation issues

    Hi,
    Iam facing a problem in my first jsf application.
    Iam using jsf 1.1 and tomcat 5.5.7
    I have a UserBean with a single attribute userName (which has public getter and setter methods).
    * I have an index.jsp that redirects to login.faces.
    * I have the appropriate servlet url-mapping in my web.xml that maps *.faces to the FacesServlet
    Here's the code for login.jsp
    <f:view>
       <h:form>
             <h3>Please enter your name </h3>
         <table>
          <tr>
              <td>Name:</td>
            <td><h:inputText id = "name" value="#{user.userName}"/></td>
         </tr>               
         </table>
         <p><h:commandButton value="Login" action="welcome"/>
         </p>
         </h:form>
       </body>
    </f:view>Next I have a welcome.jsp which simply outputs Hello <userName>
    <f:view>
      <h:form>
         <h:outputText value="#{user.userName}"></h:outputText>
      </h:form>
    </f:view>And this is my faces-config.xml
    <?xml version="1.0"?>
    <!DOCTYPE faces-config PUBLIC
      "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
      "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
    <faces-config>
         <managed-bean>
              <managed-bean-name>user</managed-bean-name>
              <managed-bean-class>com.myjsf.UserBean</managed-bean-class>
              <managed-bean-scope>session</managed-bean-scope>
         </managed-bean>
         <navigation-rule>
              <from-view-id>/index.jsp</from-view-id>
              <navigation-case>
                   <from-outcome>welcome</from-outcome>
                   <to-view-id>/welcome.jsp</to-view-id>
              </navigation-case>
         </navigation-rule>
    </faces-config>Now when I start my application , the index page redirects me to login.faces. I believe the FacesServlet intercepts this call, strips of .faces and forwards to login.jsp. Login.jsp is displayed correctly, so far so good. However from here on, I have all kinds of problems
    1. Should the <from-view-id> be /index.jsp (my actual url) or /login.jsp (the url to which index.jsp forwards me to). Actually both seem to work (or not work depending on how you look at it :( )
    2. Anyways whatever I set it to, the login.jsp is displayed correctly. The action attribute of the commandButton tag is set to 'welcome' which matches with the <from-outcome> value in navigation rule in faces-config.xml and I would have expected the welcome.jsp to load on form submit.
    But the form just reloads itself on clicking submit.
    I googled around and discovered that this may be due to validation errors or conversion errors and adding <h:messages/> would indicate the error source. AQccordingly I added it and got this o/p
    " "name": " Conversion Error setting value 'Duke' for 'null Converter'. To cut a long agony story short, I found that I have to define a converter for some data types for validation and/or display. But all I have is a String property. Doesnt jsf provide a default Converter ?
    3. I couldnt get my app to work when I put my jsps in a folder and access them as /<foldername>/jsp in my faces-config.xml. Isnt this possible ? Should all jsps be under the root folder ?
    Will be thankful for any help.
    cheers,
    ram.
    2. Whenever I click on

    Thanks for the reference , I shall definitely go through it.
    My immediate concern is to get the first program working.
    Here is my source code for the bean.
    package com.myjsf;
    import java.io.Serializable;
    public class UserBean implements Serializable {
        private String userName;  
        public String getUserName() {
            return userName;
        public void setName(String userName) {
            this.userName = userName;
    }Here's my login.jsp which comes up fine
    <f:view>
       <h:form>
         <h:messages/>
             <h3>Please enter your name.</h3>               
                 Name: <h:inputText id = "userName" value="#{user.userName}"/><br>
                  <h:commandButton value="Login" action="welcome"/>
         </h:form>
      </f:view>Here's my faces-config.xml
    <faces-config>
         <managed-bean>
              <managed-bean-name>user</managed-bean-name>
              <managed-bean-class>com.myjsf.UserBean</managed-bean-class>
              <managed-bean-scope>session</managed-bean-scope>
         </managed-bean>
         <navigation-rule>
              <from-view-id>/login.jsp</from-view-id>
              <navigation-case>
                   <from-outcome>welcome</from-outcome>
                   <to-view-id>/welcome.jsp</to-view-id>
              </navigation-case>
         </navigation-rule>
    </faces-config>     And this is the error that I get
    "userName": Conversion error occurred. The page gets displayed again. One thing I noticed was that in the html - view source the action attribute of the form tag is set to /myjsf/faces/login.jsp. Shouldnt it be welcome.jsp rather ?
    Iam at my wits end. I have decided to write a Converter which may solve my problem, but is it required ?
    Please help.
    Thanks,
    Ram.

  • Jsf api to convert utf-8 to original text

    Hi guys,
    For instance, a user enter &#36335; in a text field then I convert this chinese character to utf-8 using javascript:encodeURIComponent to %E8%B7%AF and pass it as a parameter to the next page where the url will look like example :
    http://www.google.com/search?q=%E8%B7%AF
    so when I get %E8%B7%AF in backing bean, how should I convert back to &#36335; in order to pass to database to search? any jsf api able to convert it?
    Thanks & regards,
    Plant more tree
    Use emission free car

    help....pls help...

  • 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&#322;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.

  • JSF-EL expansion inside of object using ADF in a JSP

    JSF-EF will not convert to text inside of <object><param>
    I have an existing JSP application that uses an Applet. There is a lot of <% %> code that is passed to the Applet using the <param> tag.
    My code goes as follows:
    <%@ page stuff%>
    <%@taglib stuff%>
    <f:loadBundle stuff/>
    <%
    a lot of ugly java code that I've already ported to a Managed Bean like
    String WORKS = "WORKS";
    %>
    <f:view>
    <afh:html><afh:body><f:view><afh:head>blah</afh:head>
    <afh:body><af:form><af:panelPage>
    a lot of <f:facets>
    <h:panelGrid columns="1">
    <f:column>
    <f:verbatim escape="false">
    <af:outputText value="#{MyBean.WorksFine}"/>
    </f:verbatim>
    </f:column>
    <f:column>
    <f:verbatim escape="false">
    <object classid="234" and more object stuff>
    <param name="WORKS" value="WORKS"/>
    <param name="<%=WORKS%>" value="<%=WORKS%>" />
    <param name="#{MyBean.FAILS}" value="#{MyBean.FAILS}" />
    </object>
    </f:verbatim>
    </f:column>
    </f:panelGrid>
    and so on to
    </f:view>
    To make a long story short my new implementation depends on being able to rid my JSP of all the <% %> stuff so that I can perform magic in my Managed Beans and then pass it to the third party applet.
    I've tried using the <applet> tag and the <jsp:plugin> tags instead of the <object> tag and have the same problem. I also tried removing the escape="false" property from the <f:verbatim> tag. When I look at the Source in the Browser I see the #{MyBean.FAILS} instead of the value it holds. I can successfully use the JSF-EL references inside of a <f:verbatim> tag as long as I refer to it outside of the <object> tag. Once inside the <object> tag the expression is not evaluating.
    My questions are:
    (1) Is there anyway to use a JSF-EL expression inside of an <object> or <param> tag?
    (2) Can you suggest another way that I might pass my Managed Bean properties to the Applet?
    (3) As a worst case, is there anyway that I can access my Managed Bean Properties from inside the <% %> code?
    Thanks. Mark

    Since object and param are not JSF tags, there is no way to access JSF-EL.
    As for accessing the managed beans, you should be able to do so as long as you know they've been instantiated at the point in the page where you make the reference and they are in a scope that you can access from JSP land (like session or application).
    Not the answer you wanted, but I hope it helps.

  • How to read xml data from jsf,

    Hi
    I would like to know how to read data in an xml so as we can display that data onto the jsf page to the user, say as a data table, or in an output txt box etc...

    This is nothing JSF-special. Just convert XML to objects (DTO's) and then use them in JSF.
    There are several ways to crawl the XML tree. JXPath and DOM4J are popular.

  • Conversion error occured

    conversion error occured while using h:selectmanyListbox tag.

    Have the exact same problem, am using Rational Application Developer 6 (WSAD 6) in combination with websphere 6. I have a datatable (server side component) which is based on a javabean collection. The javabean has an Integer attribute "id". I'm presenting the "id" as a hidden field which works fine. when I submit the form containing the table I want to bind the hidden field to a requestScope variable. But before it hits my code I already get the table:0:hidden1: Conversion error occured.
    Have tried without converter, with numberConverter and a Custom convertor (which is called and works correctly (as in it doesn't generate the Conversion error)).
    So the conversion error is generated after my own custom convertor is called. Which part of the JSF code has to convert the field after mine is done ???
    And I'm also doing this on 1 page (maybe that's something to look at....)
    Hendri

  • Xhtml file type association (facelets)

    Hi,
    Is it possible to change JDevelopers xhtml file type recognition and associate it with JSP type. I'm using third party JSF/Facelet framework, which requires use of .xhtml extension for facelet pages.
    Unfortunately JDeveloper does not allow to change a file type for this extension using Tools > Preferences > File Types. Since it treats files as html, JDev does not provide JSF tags in component pallete.
    Thanks,
    Noel.

    Facelets may be used with JSF JSP pages in XML syntax instead of XHTML.
    To develop a Facelets application in JDeveloper 10.1.3 with JSPs.
    1. Add Facelets JAR files to a Facelets project.
    <facelets-1.0.12>/ jsf-facelets.jar
    <JDeveloper10.1.3>/jsf-ri/jsf-api.jar
    <JDeveloper10.1.3>/jsf-ri/jsf-impl.jar
    <JDeveloper10.1.3>/jakarta-struts/lib/ commons-beanutils.jar
    <JDeveloper10.1.3>/jakarta-struts/lib/ commons-collections.jar
    <JDeveloper10.1.3>/jakarta-struts/lib/ commons-digester.jar
    <JDeveloper10.1.3>/jakarta-struts/lib/ commons-logging.jar
    <facelets-1.0.12>/lib/el-ri.jar
    <facelets-1.0.12>/lib/el-api.jar
    2. Create a JSF JSP page. Convert the JSP page to JSP XML Sytax by adding
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:ui="http://java.sun.com/jsf/facelets"> </jsp:root>
    xmlns:ui="http://java.sun.com/jsf/facelets" is the Facelets namespace.
    3. To faces-config.xml add:
    <application>
    <view-handler>
    com.sun.facelets.FaceletViewHandler
    </view-handler>
    </application>
    4. To web.xml add
    <context-param>
    <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
    <param-value>.jsp</param-value>
    </context-param>
    In web.xml file, also specify the servlet mapping for the Faces Servlet.
    <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.jsp</url-pattern>
    </servlet-mapping>
    5. To JSP page add tags from Facelets namespace.
    6. Facelets navigation is similar to JSF navigation, and is specified in faces-config.xml.

  • Iterating dataTable

    Hi
    I have my existing application non-JSF and I am converting it to JSF one by one (one class/jsp every day). My Current application is simply JSP and Java Bean
    .I have my backend data stored in hardware boxes (RAID subsystems)
    Currently I have all my getAPIs returning hashtable and that hashtable I am iterating on the JSP.
    In JSF I kind of know that we can use JSF dataTable element. with that I can bind one of the method in my Java Bean (which currenly returns a hashtable). but this method will work to iterate hashtable on JSP without writing any loop logic?
    Thanks
    Urvish

    Thanks a lot
    that helps a lot
    --Urvish                                                                                                                                                                                                                           

  • 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();
    }

  • Issue in converting Struts view to JSF view using struts-faces integration

    Hi All,
    I am facing a issue in my Sruts to JSF conversion application using struts-faces.jar integration library.
    Need expert's help desperately as I am not able to use <s:form> tag in my new jsf page to call a struts action.
    I want to call a struts action from my web page designed using JSF,
    but it seems impossible without using <s:form> tag from struts-faces integration library.
    Please suggest how to resolve this...
    I am using WSAD 5.1 IDE with inbuilt Test environment WebSphere server
    JSF Version: Sun's RI 1.1
    Struts framework: 1.2.6
    Struts-Faces Integration Library version: 1.0
    I have configured a controller element in struts-config.xml file as has been suggested by different online
    documents I studied:
    <controller>
    <set-property property="processorClass"
    value="org.apache.struts.faces.application.FacesRequestProcessor"/>
    </controller>
    But configuring a controller does not allow my test server to start up properly and due to errors the ActionServlet also becomes unavailable.
    If I comment the controller and start the test server it starts fine but then I cannot access the converted jsf page which contains the <s:form action="/xxxxx.do"> tag.
    If now I get back to <h:form> tag instead of <s:form> tag with a <h:commandButton action="xxxx.do"/> for form submission in my jsf page, I see the html page generated with all components but now checking the html source generated I see
    <form action="/contextName/jspFolder/sameDisplayedPage.jsf"> which is not valid and never gets called successfully.
    I think someways I need to use the <s:form> tag with the controller configured properly to use the struts-faces integration library's request processor, to get things working. But HOW???
    Following is the error I get if I use the <controller> tag element in struts-config.xml file and start the server.
    This error appears on starting the server without accessing any application's jsp web page
    [6/12/06 15:31:14:109 IST] 3e311815 ActionServlet E org.apache.struts.action.ActionServlet Unable to initialize Struts ActionServlet due to an unexpected exception or error thrown, so marking the servlet as unavailable. Most likely, this is due to an incorrect or missing library dependency.
    [6/12/06 15:31:14:109 IST] 3e311815 ActionServlet E org.apache.struts.action.ActionServlet TRAS0014I: The following exception was logged java.lang.IllegalAccessError: org.apache.commons.digester.SetPropertyRule tried to access method org/apache/commons/beanutils/BeanUtils.setProperty(Ljava/lang/Object;Ljava/lang/String;Ljava/lang/Object;)V
    at org.apache.commons.digester.SetPropertyRule.begin(SetPropertyRule.java:198)
    at org.apache.commons.digester.Rule.begin(Rule.java:200)
    at org.apache.commons.digester.Digester.startElement(Digester.java:1273)
    at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
    at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown Source)
    at org.apache.xerces.impl.dtd.XMLDTDValidator.emptyElement(Unknown Source)
    at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
    at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
    at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
    at org.apache.commons.digester.Digester.parse(Digester.java:1548)
    at org.apache.struts.action.ActionServlet.parseModuleConfigFile(ActionServlet.java:736)
    at org.apache.struts.action.ActionServlet.initModuleConfig(ActionServlet.java:685)
    at org.apache.struts.action.ActionServlet.init(ActionServlet.java:331)
    at javax.servlet.GenericServlet.init(GenericServlet.java:258)
    at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doInit(StrictServletInstance.java:82)
    at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._init(StrictLifecycleServlet.java:147)
    at com.ibm.ws.webcontainer.servlet.PreInitializedServletState.init(StrictLifecycleServlet.java:270)
    at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.init(StrictLifecycleServlet.java:113)
    at com.ibm.ws.webcontainer.servlet.ServletInstance.init(ServletInstance.java:189)
    at javax.servlet.GenericServlet.init(GenericServlet.java:258)
    at com.ibm.ws.webcontainer.webapp.WebAppServletManager.addServlet(WebAppServletManager.java:870)
    at com.ibm.ws.webcontainer.webapp.WebAppServletManager.loadServlet(WebAppServletManager.java:224)
    at com.ibm.ws.webcontainer.webapp.WebAppServletManager.loadAutoLoadServlets(WebAppServletManager.java:542)
    at com.ibm.ws.webcontainer.webapp.WebApp.loadServletManager(WebApp.java:1277)
    at com.ibm.ws.webcontainer.webapp.WebApp.init(WebApp.java:283)
    at com.ibm.ws.webcontainer.srt.WebGroup.loadWebApp(WebGroup.java:387)
    at com.ibm.ws.webcontainer.srt.WebGroup.init(WebGroup.java:209)
    at com.ibm.ws.webcontainer.WebContainer.addWebApplication(WebContainer.java:987)
    at com.ibm.ws.runtime.component.WebContainerImpl.install(WebContainerImpl.java:136)
    at com.ibm.ws.runtime.component.WebContainerImpl.start(WebContainerImpl.java:356)
    at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:418)
    at com.ibm.ws.runtime.component.DeployedApplicationImpl.fireDeployedObjectStart(DeployedApplicationImpl.java:787)
    at com.ibm.ws.runtime.component.DeployedModuleImpl.start(DeployedModuleImpl.java:354)
    at com.ibm.ws.runtime.component.DeployedApplicationImpl.start(DeployedApplicationImpl.java:575)
    at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:271)
    at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:249)
    at com.ibm.ws.runtime.component.ContainerImpl.startComponents(ContainerImpl.java:536)
    at com.ibm.ws.runtime.component.ContainerImpl.start(ContainerImpl.java:413)
    at com.ibm.ws.runtime.component.ApplicationServerImpl.start(ApplicationServerImpl.java:125)
    at com.ibm.ws.runtime.component.ContainerImpl.startComponents(ContainerImpl.java:536)
    at com.ibm.ws.runtime.component.ContainerImpl.start(ContainerImpl.java:413)
    at com.ibm.ws.runtime.component.ServerImpl.start(ServerImpl.java:183)
    at com.ibm.ws.runtime.WsServer.start(WsServer.java:128)
    at com.ibm.ws.runtime.WsServer.main(WsServer.java:225)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:41)
    at java.lang.reflect.Method.invoke(Method.java:386)
    at com.ibm.ws.bootstrap.WSLauncher.main(WSLauncher.java:94)
    at com.ibm.etools.websphere.tools.runner.api.ServerRunnerV5$1.run(ServerRunnerV5.java:97)
    [6/12/06 15:31:14:188 IST] 3e311815 WebGroup E SRVE0020E: [Servlet Error]-[ActionServlet]: Failed to load servlet: javax.servlet.UnavailableException: org.apache.commons.digester.SetPropertyRule tried to access method org/apache/commons/beanutils/BeanUtils.setProperty(Ljava/lang/Object;Ljava/lang/String;Ljava/lang/Object;)V
    at org.apache.struts.action.ActionServlet.init(ActionServlet.java:366)
    at javax.servlet.GenericServlet.init(GenericServlet.java:258)
    at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doInit(StrictServletInstance.java:82)
    at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._init(StrictLifecycleServlet.java:147)
    at com.ibm.ws.webcontainer.servlet.PreInitializedServletState.init(StrictLifecycleServlet.java:270)
    at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.init(StrictLifecycleServlet.java:113)
    at com.ibm.ws.webcontainer.servlet.ServletInstance.init(ServletInstance.java:189)
    at javax.servlet.GenericServlet.init(GenericServlet.java:258)
    at com.ibm.ws.webcontainer.webapp.WebAppServletManager.addServlet(WebAppServletManager.java:870)
    at com.ibm.ws.webcontainer.webapp.WebAppServletManager.loadServlet(WebAppServletManager.java:224)
    at com.ibm.ws.webcontainer.webapp.WebAppServletManager.loadAutoLoadServlets(WebAppServletManager.java:542)
    at com.ibm.ws.webcontainer.webapp.WebApp.loadServletManager(WebApp.java:1277)
    at com.ibm.ws.webcontainer.webapp.WebApp.init(WebApp.java:283)
    at com.ibm.ws.webcontainer.srt.WebGroup.loadWebApp(WebGroup.java:387)
    at com.ibm.ws.webcontainer.srt.WebGroup.init(WebGroup.java:209)
    at com.ibm.ws.webcontainer.WebContainer.addWebApplication(WebContainer.java:987)
    at com.ibm.ws.runtime.component.WebContainerImpl.install(WebContainerImpl.java:136)
    at com.ibm.ws.runtime.component.WebContainerImpl.start(WebContainerImpl.java:356)
    at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:418)
    at com.ibm.ws.runtime.component.DeployedApplicationImpl.fireDeployedObjectStart(DeployedApplicationImpl.java:787)
    at com.ibm.ws.runtime.component.DeployedModuleImpl.start(DeployedModuleImpl.java:354)
    at com.ibm.ws.runtime.component.DeployedApplicationImpl.start(DeployedApplicationImpl.java:575)
    at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:271)
    at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:249)
    at com.ibm.ws.runtime.component.ContainerImpl.startComponents(ContainerImpl.java:536)
    at com.ibm.ws.runtime.component.ContainerImpl.start(ContainerImpl.java:413)
    at com.ibm.ws.runtime.component.ApplicationServerImpl.start(ApplicationServerImpl.java:125)
    at com.ibm.ws.runtime.component.ContainerImpl.startComponents(ContainerImpl.java:536)
    at com.ibm.ws.runtime.component.ContainerImpl.start(ContainerImpl.java:413)
    at com.ibm.ws.runtime.component.ServerImpl.start(ServerImpl.java:183)
    at com.ibm.ws.runtime.WsServer.start(WsServer.java:128)
    at com.ibm.ws.runtime.WsServer.main(WsServer.java:225)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:41)
    at java.lang.reflect.Method.invoke(Method.java:386)
    at com.ibm.ws.bootstrap.WSLauncher.main(WSLauncher.java:94)
    at com.ibm.etools.websphere.tools.runner.api.ServerRunnerV5$1.run(ServerRunnerV5.java:97)
    (same error message re-iterates/repeats itself... and finally -
    Error 503: Failed to load target servlet [ActionServlet] comes in web-browser
    Following is the error which I get if I comment the <controller> element in the struts-config.xml file
    and use a <s:form action="xxxxx.do"> in the struts converted jsf page. The web-server starts fine, but
    accessing the jsf page givers error as:
    [6/12/06 15:38:00:781 IST] 696f19de WebGroup I SRVE0180I: [Sample Struts-JSF integration application] [training2] [Servlet.LOG]: /jsp/welcomeF.jsp: init
    [6/12/06 15:38:01:219 IST] 696f19de WebGroup E SRVE0026E: [Servlet Error]-[]: java.lang.NullPointerException
    at org.apache.struts.faces.renderer.FormRenderer.encodeBegin(FormRenderer.java:114)
    at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:683)
    at javax.faces.webapp.UIComponentTag.encodeBegin(UIComponentTag.java:591)
    at javax.faces.webapp.UIComponentTag.doStartTag(UIComponentTag.java:478)
    at org.apache.jsp._welcomeF._jspService(_welcomeF.java:207)
    at com.ibm.ws.webcontainer.jsp.runtime.HttpJspBase.service(HttpJspBase.java:89)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at com.ibm.ws.webcontainer.jsp.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:344)
    at com.ibm.ws.webcontainer.jsp.servlet.JspServlet.serviceJspFile(JspServlet.java:662)
    at com.ibm.ws.webcontainer.jsp.servlet.JspServlet.service(JspServlet.java:760)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
    at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
    at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
    at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
    at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
    at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
    at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
    at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:974)
    at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:555)
    at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:200)
    at com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322)
    at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:130)
    at org.apache.struts.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:130)
    at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
    at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
    at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
    at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
    at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
    at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
    at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
    at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
    at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
    at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
    at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:974)
    at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:555)
    at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:200)
    at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1054)
    at org.apache.struts.action.RequestProcessor.internalModuleRelativeForward(RequestProcessor.java:992)
    at org.apache.struts.action.RequestProcessor.processForward(RequestProcessor.java:551)
    at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:209)
    at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1192)
    at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:412)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
    at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
    at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
    at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
    at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
    at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
    at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
    at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:974)
    at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:555)
    at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:200)
    at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:119)
    at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:276)
    at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
    at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:182)
    at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334)
    at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
    at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:618)
    at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:439)
    at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:593)
    Finally if I change my <s:form action="xxxxx.do"> tag to
    <h:form>
    <h:commandButton id="submit" action="xxxx.do" value="Submit" />
    I see the webpage coming up in the browser (no controller element used in struts-config.xml file this time)
    But in the html source of this html created from jsf I see
    <form id="_id2" method="post" action="/training2/jsp/welcomeF.faces" enctype="application/x-www-form-urlencoded">
    here form's action attribute is pointing to the same displayed page with the context name prefixed. I
    assume it is because jsf could not resolve the "xxxx.do" action to anything so set it to the same displayed page.
    May be I am wrong as usual...
    Below is the simple struts jsp page which I need to convert to jsf page as I am converting only the View part of application.
    I want to use the same struts beans and application logic at the back-end. At front-end I need UIComponents from JSF to be used.
    Following is the struts jsp page
    <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1" %>
    <%@ taglib prefix="html" uri="/WEB-INF/lib/struts-html.tld" %>
    <%@ taglib prefix="bean" uri="/WEB-INF/lib/struts-bean.tld" %>
    <html:html>
    <html:base/>
    <html:messages id="messages" />
    <font style="color:red; font=weight:italic; font-family: century gothic">
    <html:errors/>
    </font>
    <BODY>
    <P>Sample Struts and JSF integration example</P>
    <P>This one is being displayed via Struts specific tags</P>
    <html:form action="validateUser.do">
    <bean:message key="label.name" /> : <html:text property="name" />
    <bean:message key="label.password" /> : <html:password property="password" />
    <bean:message key="label.age" /> : <html:text property="age" />
    <bean:message key="label.city" /> : <html:text property="city" />
    <bean:message key="label.address" /> : <html:text property="address" />
    <html:submit property="submit" value="Show info via Struts" />
    </html:form>
    </BODY>
    </html:html>
    I have converted it into the following jsf page
    <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1" %>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
    <%@ taglib uri="http://struts.apache.org/tags-faces" prefix="s" %>
    <f:view>
    <HTML><BODY>
    <f:verbatim><P>Sample Struts and JSF integration example</P></f:verbatim>
    <f:verbatim><P>This one is being displayed via JSF tags</P></f:verbatim>
    <h:form> <!-- Want to use s:form tag instead of this h:form tag -->
    <h:inputText id="name" value="#{userForm.name}" /><f:verbatim>
    </f:verbatim>
    <h:inputSecret id="password" value="#{userForm.password}" /><f:verbatim>
    </f:verbatim>
    <h:inputText id="age" value="#{userForm.age}" /><f:verbatim>
    </f:verbatim>
    <h:inputText id="city" value="#{userForm.city}" /><f:verbatim>
    </f:verbatim>
    <h:inputText id="address" value="#{userForm.address}" /><f:verbatim>
    </f:verbatim>
    <h:commandButton id="submit" action="#{user.facesAction}" value="Show info via Struts" />
    </h:form>
    </BODY></HTML>
    </f:view>
    I am very hopeful of some answer from respected group experts, please help me.
    I am in urgency of course but would not push for immed. response like other, just want some help for sure that is going to
    be extremely valuable to me. Anticipating a helping hand...
    Thanks and Regards
    Vishal Sharm
    Time's fun when you're having flies � Kermit, the Frog
    -------------------------------------------------------------------------

    I've managed to get this working Ok from JDeveloper:
    See:
    http://www.groundside.com/blog/content/DuncanMills/J2EE+Development/?permalink=573FDB6F8D918B9704907899635CABB1.txt
    http://www.groundside.com/blog/content/DuncanMills/J2EE+Development/?permalink=2B04ACE99A6437EDED775F15553D1DED.txt
    Basically you just have to fiddle around with Library settings to get this working OK.
    As to how useful this is, well that's up to you - I'd not regard Faces + Struts as a must use combination, rather it's a can mix if you really need to. Look at Faces and Faces navigation first and see if that actually gives you enough before you start to look at mixing.

  • Converter for converting all HTML tags to JSF tags

    hai all,
    i am new to JSF. i need a suggestions to convert all my HTML pages to JSF pages bcoz i was already created more pages in HTML and now i want to convert all the pages to JSF. can u give any suggestion plz post it here or send me a mail to [email protected]
    thanks in advance,
    regards,
    V.Sabarish

    hi roman,
    thanks for ur reply. it converts the file but the links r not converting....so can u suggest me another way for converting a HTML tags to JSF tags.

  • Strategy for converting HTML mockups to JSF

    This is a summary of our front-end development process:
    - designers create PNG mockups
    - UXers create HTML mockups
    - developers create final JSF
    Now, these HTML mockups are pretty complete. They use all our in-house JavaScript widgets, production CSS files, responsive design, accesibility requirements, SEO-friendly code, proper semantics etc. So basically the final HTML we need from the JSFs has to nail these mockups, otherwise widgets might not work, styles might not appear correctly, accesibility errors might crop in and SEO might suffer. The developers tend to have limited experience in HTML/JavaScript/CSS/accesibility, especially compared to the UXers, so the less they can do to screw up the HTML the better.
    With this in mind we tell our developers to just convert the very minimum to JSF. So that basically means forms & form elements and the occasional loop. For example we tell them to avoid h:dataTable and just use the given HTML table and a loop - for some reason (probably lack of experience) we found it very difficult to nail the right HTML in terms of thead, tbody, th and td (or to get a rowspanned "There are no results" output for empty lists). We even tell them to use straight EL instead of h:outputText (unless they really need it) for i18n literals or form outputs. Then there is the added complication in that we use HTML5 (currently using a RenderKit for that). I also prefer to avoid tying my HTML to a given technology: I don't want my JavaScript/CSS to depend on JSF (or PrimeFaces or whatever) output, I want it to depend on what we consider the "correct" HTML in terms of semantics (ie, unobtrusive frameworks).
    Would you say this is a correct strategy? I find it helps reduce developer workload (less to convert), reduces front-end errors (less to screw up), and might it also reduce memory footprint on the server (less component tree)? Or am I missing something?

    Hi!
    You can import your html page into project.
    1) Click 'File->Add Existing Item->Web Page'.
    2) In field 'File or URL' enter path to your html.
    3) Check that 'Convert HTML tags to JSF Components' checkbox is checked.
    4) Click OK.
    Your HTML page will be transformed to JSP page.
    Thanks,
    Roman.

  • Convert JSF Page to PDF

    i need to convert a JSF Page into a PDF Document .
    any ideas how to do that?

    SACHINLINUX wrote:
    BalusC wrote:
    Why are you hijacking other's topic and acting like you're the topic starter? You're rude.Mr Balu. kindly tell the solution if you have instead of dictating rules. As far as rudeness concern i never seen a person rude like you.
    Sachin KokchaMr Sachin Mr. BalusC is tellign right thing it is not your topic as well as you are telling that you have only one login name. So no need to act like the topic starter.
    Every forum has it's own rules so please kindly obey these rules.
    Gantu

Maybe you are looking for