voyent
Messages posted by: karinchen  XML
Profile for karinchen -> Messages posted by karinchen [14]
Author Message
Hi saran,

You have probably solved the problem meanwhile, but you could do stuff like:

jQuery:
Code:
var mini= parseInt(jQuery("[id$=amount1]").val()); 


- an element whose "id" attribute ends with "amount1"

- or even [id*=amount1] - "id" attribute contains "amount1"

Cheers,
Karina
Hi Mircea!

Thank you very much, this actually appears to be working fine for our case!

One question: The second parameter which is a String will be output to the generated code just as it is, like:

Code:
JavascriptContext.addJavascriptCall(FacesContext.getCurrentInstance(), "add(3,4)");


means probably:
Code:
 <script type="text/javascript">
 add(3,4);
 </script>


If you want to have several JS methods, then I noticed you have to have like:
Code:
JavascriptContext.addJavascriptCall(FacesContext.getCurrentInstance(), "add(3,4)[b];[/b]");

Code:
JavascriptContext.addJavascriptCall(FacesContext.getCurrentInstance(), "add(5,6)");



So you have to append a colon after each call besides the last.

Thank you very much for your help!
Karina
Hey Micah,


How did you go about this in the end?
Many thanks,
Karina
Hi!

Looking at the method's signature ( Ice.onAsynchronousReceive(id, callback) ), I would expect to be possible to use it for a specific JSF element (like a commandLink) on my page, not just the entire body.
In docs it says that 'id' is "the identifier of an element that is the parent or the child of the element owning the bridge instance (most of the time is the `body' element)" - ok, just most of the time :)

However, the callback appears to be called for every JSF action, no matter what is passed in as id.

I'll try to explain what we're doing:

What we want is to execute a Javascript snippet on click of a link (plain HTML link) and the HTML link also triggers a JSF action (by triggering a click event on a JSF commandLink with a specific id - this is done by jQuery); however, it's important that the javascript snippet is executed *after* the server action has finished.

The HTML link has therefore an on-click handler which does like:

Code:
jQuery(JSFcommandLinkId).trigger('click'); 
 // this causes the server action to be done


Code:
 <h:commandLink id="JSFcommandLinkId" action="#{myBean.doSomethingWhichMustBeReadyBeforeJavascriptSnippet}/>


and we're calling
Code:
Ice.onAsynchronousReceive("JSFcommandLinkId", globalCallBackHandler);


would call the callback on each JSF action on the page. We're using Icefaces 1.8.2, however, the page has JSF tags. Icefaces is mainly used as the view-handler of our pages which are Facelets pages from some portlets deployed in Liferay.

Any help appreciated!
Karina

PS. I know it sounds like a crazy mix here, I feel we're approaching it wrong - all we want is the JSF action of a commandLink to be ready before another javascript is called.
Hi back!

I tried to set log level from Glassfish - see
http://wiki.glassfish.java.net/Wiki.jsp?page=FaqConfigureLogging.
For com.icesoft I set log level INFO. However, I keep getting lots of TRACE messages in server.log.

However, they say there that:
"If you use the java.util.logging system in your own application, then you can add properties here to affect your loggers directly."

From this post http://jira.icefaces.org/browse/ICE-2599
I understand Icefaces uses commons-logging for the moment, so I'm afraid the Glassfish log levels do not apply to ICEfaces classes.

Nevermind, I thought there's a logging properties file where I can set log levels to INFO or something like that but couldn't find such one in ICEfaces 1.8.

Any clue?
Thanks,
Karina
Hi everyone!

I'm using Netbeans 6.5.1 with ICEFaces 1.8 plugin and am developing Facelets portlets under a Glassfish+Liferay-5.1.1 bundle.

View handler is com.icesoft.faces.facelets.D2DFaceletViewHandler and I'm also using IceFaces Portlet Bridge. Problem is that my Glassfish server.log soon gets filled and rotated cause of too many TRACE level error messages coming from following classes which I found in the 1.8 icefaces.jar:

BridgeExternalContext
DomResponseWriter
ContextEventRepeater
SendUpdate
ImplementationUtil

Logs look like:
13:06:46,883 TRACE [DOMResponseWriter:599] Appending attribute[name: title; value: Remove field] into element[tag: a; attributes: ]

So it's describing in every tiny detail my DOM tree.
Nice, but can I somehow decrease the log level so I get fewer DOM-tree logs and can see my own application's logs better?

Thanks!
Karina
Thanks for the reply. We do actually right now successfully deploy portlets into Liferay using the ICEFaces portlet bridge and will perhaps come back with questions related to IPC.

--br,
Karina
Hi!

In the meantime, is there any way to use the JSF 1.2 Portlet Bridge
Code:
 com.sun.faces.portlet.FacesPortlet
 

in an ICEFaces Portlets web application?
We are currently deploying on Liferay (latest Glassfish-Liferay bundle) and as soon as we change the ICEFaces to the JSF Portlet Bridge, our pages are unviewable (only some weird unreadable characters) on screen.

Thanks,
Karina
Should I understand from the above that something like:

Code:
 <ice:selectOneMenu id="id1" 
 value="#{MyController.items}"
 valueChangeListener="#{MyController.OnChangeItem}" 
 partialSubmit="true">
        <f:selectItems value="#{MyController.items}"/>
 </ice:selectOneMenu>
 


would only update the drop down menu if its current selection is changed and has no effect upon the rest of the page?

Thank you,
Karina
Hi again!

Just coming back cause we found kindof a workaround:

if we have a file which we do NOT want to be processed by ICEFaces renderer:

Code:
 com.icesoft.faces.facelets.D2DFaceletViewHandler
 


then we will place before its <application> tag in faces-config.xml smth like:

Code:
 <application>
         <view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
     </application>
 


In web.xml we will map our files to Faces (standard) Servlet:

Code:
 <servlet-mapping>
         <servlet-name>Faces Servlet</servlet-name>
         <url-pattern>*.abc</url-pattern>
     </servlet-mapping>
 


meaning that an URI ending with .abc will be handled by the Faces Servlet and rendered by Facelets without ICEFaces.

BR,
karina
If I understood correctly, then:

through com.icesoft.faces.facelets.D2DFaceletViewHandler, ICEFaces can render Facelets xhtml pages. That was working for xhtml pages which do have a <html> root tag.

How about Facelets files with an <ui:component> root tag? Are these supposed to be rendered as well?

My file looks like:

[code]
<?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">
<ui:component
xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core">

<ui:repeat value="#{CustomerSearch.filteredCustomers}" var="customer">
#{customer.name}|#{customer.id}
</ui:repeat>

</ui:component>

That gives a NPE when it encounters expression #{CustomerSearch.filteredCustomers}:

javax.faces.FacesException: Problem in renderResponse: javax.el.ELException: /pages/customerSearch.xhtml @12,75 value="#{CustomerSearch.filteredCustomers}": java.lang.NullPointerException
at com.icesoft.faces.facelets.D2DFaceletViewHandler.renderResponse(D2DFaceletViewHandler.java:294)



thank you!
karina
Hi again!

Finally, a sample application IceFaces + Facelets worked. We've done a lot of trials, but I think the real deal were following actions:

0. add library Facelets ICEfaces RunTime 1.7.2 to the project's classpath
1. in faces-config.xml, the facelets view handler should be the one of IceFaces, that means replace
com.sun.facelets.FaceletViewHandler
with
com.icesoft.faces.facelets.D2DFaceletViewHandler
2. final mappings in web.xml are as follows:
<servlet-mapping>
<servlet-name>Persistent Faces Servlet</servlet-name>
<url-pattern>/xmlhttp/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Persistent Faces Servlet</servlet-name>
<url-pattern>*.iface</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Persistent Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
3. the welcome file presently is an index.jsp which does nothing but a forward to index.xhtml which is the actual welcome page.
Not sure how to avoid that last part...

What do you think, is this the way to go?
Karina
Hi again,

thank you for the replies. I tries with
http://localhost:8080/WebApplication3/template-client.iface and I do get the UnsupportedOperationException as specified by gmichalk.

http://localhost:8080/WebApplication3/template-client.xhtml does render the xhtml (facelets tags) indeed and it shows both the texts within the
<ui:define> tags for the body but also those out of <ui:define> (which shouldn't be displayed cause they don't belong to any template part).


However, after inserting a
<ice:ouputText> tag
into the .xhtml, that one is not displayed.

Is it possible to combine facelets and icefaces elements in the same .xhtml file?
The mappings I use are like:


<servlet-mapping>
<servlet-name>Persistent Faces Servlet</servlet-name>
<url-pattern>/xmlhttp/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Persistent Faces Servlet</servlet-name>
<url-pattern>*.iface</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Persistent Faces Servlet</servlet-name>
<url-pattern>*.jspx</url-pattern>
</servlet-mapping>


I also tried to map the .xhtml to Persistent Faces Servlet, but that brought the UnsupportedOperation exception up again.

Thanks again,
Karina
Hi!

Same thing happens to me - I have a new web application in Netbeans 6.5, I select ICEFaces and Facelets as frameworks (no JSF). However, right after creation, right click-ing the project and going to "Frameworks" shows:
ICEFaces, Java Server Faces and Facelets.

The default welcome page welcomeJSF.iface isn't displayed, but a
HTTP Status 404 - /WebApplication2/welcomeJSF.xhtml
instead.

Further, accessing
http://localhost:8080/WebApplication2/template-client.xhtml
(the Netbeans-generated one)
where simply tried to display a text using
Code:
 <ice:outputText value="someOutputText"/>
 

does not show this text.
A "view page source" show that the ice: tag hasn't been interpreted - it's still there as <ice:outputText> tag, although the xhtml file does include the ice XML http://www.icesoft.com/icefaces/component namespace.

Is a hierarchical structure like:
<f:view>
<ice:outputHtml>
<ice:outputHead>
a. s. o. in the XHTML required?
Or maybe some other Facelets-ICEFaces configs?



Thank you,
Karina
 
Profile for karinchen -> Messages posted by karinchen [14]
Go to:   
Powered by JForum 2.1.7ice © JForum Team