0
votes

I really dont know how is this possible. It must be a bad configuration... The ice:inputRichText is rendered only after simple forward, but not after form action (h:commandButton). Nothing is rendered and the Firebug says this: ReferenceError: renderEditor is not defined new ActiveXObject('Microsoft.XMLHTTP');

Here is my code: home.xhtml

    <h:form>
        <h:commandButton action="index2" value="index2"/>
    </h:form>

index2.xhtml

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ice="http://www.icesoft.com/icefaces/component"
      >
    <h:head>
        <title>RDFa test</title>
    </h:head>
    <h:body> 
        <h:form prependId="false">
            <ice:inputRichText/>
        </h:form>
    </h:body>
</html>

pom.xml:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
    <artifactId>Impetus</artifactId>
    <groupId>com.dusek</groupId>
    <version>1.0-SNAPSHOT</version>
</parent>

<groupId>com.dusek</groupId>
<artifactId>Impetus-web</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>

<name>Impetus-web</name>

<properties>
    <endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <!--netbeans.hint.deploy.server>gfv3ee6</netbeans.hint.deploy.server-->
</properties>

<dependencies>
    <dependency>
        <groupId>org.icefaces</groupId>
        <artifactId>icefaces</artifactId>
        <version>3.2.0</version>
    </dependency>
    <dependency>
        <groupId>org.icepush</groupId>
        <artifactId>icepush</artifactId>
        <version>3.2.0</version>
    </dependency>
    <dependency>
        <groupId>org.icefaces</groupId>
        <artifactId>icefaces-compat</artifactId>
        <version>3.2.0</version>
    </dependency>
    <dependency>
        <groupId>com.dusek</groupId>
        <artifactId>Impetus-ejb</artifactId>
        <version>1.0-SNAPSHOT</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>${project.groupId}</groupId>
        <artifactId>Impetus-ejb</artifactId>
        <version>${project.version}</version>
    </dependency>
    <dependency>
        <groupId>javax</groupId>
        <artifactId>javaee-web-api</artifactId>
        <version>6.0</version>
        <scope>provided</scope>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.3.2</version>
            <configuration>
                <source>1.6</source>
                <target>1.6</target>
                <compilerArguments>
                    <endorseddirs>${endorsed.dir}</endorseddirs>
                </compilerArguments>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.1.1</version>
            <configuration>
                <failOnMissingWebXml>false</failOnMissingWebXml>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <version>2.1</version>
            <executions>
                <execution>
                    <phase>validate</phase>
                    <goals>
                        <goal>copy</goal>
                    </goals>
                    <configuration>
                        <outputDirectory>${endorsed.dir}</outputDirectory>
                        <silent>true</silent>
                        <artifactItems>
                            <artifactItem>
                                <groupId>javax</groupId>
                                <artifactId>javaee-endorsed-api</artifactId>
                                <version>6.0</version>
                                <type>jar</type>
                            </artifactItem>
                        </artifactItems>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>
<repositories>
    <repository>
        <url>http://anonsvn.icefaces.org/repo/maven2/releases/</url>
        <id>icefaces-core</id>
        <layout>default</layout>
        <name>Repository for library ICEfaces Core (3.2.0)</name>
    </repository>
    <repository>
        <id>unknown-jars-temp-repo</id>
        <name>A temporary repository created by NetBeans for libraries and jars it could not identify. Please replace the dependencies in this repository with correct ones and delete this repository.</name>
        <url>file:${project.basedir}/lib</url>
    </repository>
</repositories>

web.xml

<?xml version="1.0" encoding="UTF-8"?>

http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"> javax.faces.PROJECT_STAGE Development javax.faces.STATE_SAVING_METHOD server javax.faces.FACELETS_SKIP_COMMENTS true org.icefaces.mandatoryResourceConfiguration org.icefaces.ace.gmapKey AIzaSyAATyWVqT2qNusNGmcVTyQ0QmymkpU-B5o javax.faces.VALIDATE_EMPTY_FIELDS false com.icesoft.faces.gmapKey AIzaSyAcAbAa7AL1DLU0785OeWn2byf4XOsm7KM Faces Servlet javax.faces.webapp.FacesServlet 1 Resource Servlet com.icesoft.faces.webapp.CompatResourceServlet 1 Faces Servlet .xhtml
Resource Servlet /xmlhttp/
30 home.xhtml

and faces-config.xml:

<?xml version='1.0' encoding='UTF-8'?>

<!-- =========== FULL CONFIGURATION FILE ================================== -->

<faces-config version="2.1"
              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_2_1.xsd">

    <application>
        <resource-bundle>
            <base-name>text.labels</base-name>
            <var>msg</var>
        </resource-bundle>
    </application>
    <navigation-rule>
        <navigation-case>
            <from-outcome>success</from-outcome>
            <to-view-id>/loggedin.xhtml</to-view-id>  
        </navigation-case>
        <navigation-case>
            <from-outcome>logout</from-outcome>       
            <to-view-id>/logout.xhtml</to-view-id>  
        </navigation-case>
    </navigation-rule>
</faces-config>
1
"The ice:inputRichText is rendered only after simple forward, but not after form action (h:commandButton).". What does this mean? I assume that you are missing the resources (javascript files) for the rich text editor. In case you are working with Ajax and the editor is not being displayed from the first time the page is accessed, then those resources will be missing in case you "lazy load" it via ajax.noone
If I jump to the page with inputRichText by h:link, everything works fine. If I use h:commandButton actiion, nothing is rendered. It really looks like missing js scripts. I dont want to make AJAX action - but it is possible, that JSF do that as an optimalization...Petr Dušek

1 Answers

0
votes

I have found the solution! Thank you very much, noone, you have identified the problem...

ICEfaces adds Ajax capabilities to JSF (even simply adding the icefaces.jar to a JSF application adds Ajax by affecting the necessary changes in the page markup!). The result is that interactions with the components automatically trigger the use of Ajax during form submission.

Here is the whole description: http://www.icesoft.org/wiki/display/ICE/Disabling+Ajax There is also a tutorial, how to manually disable AJAX.

I am really very upset! I have been looking for the solution for 3 days...