Timer in JSF

hi.. i am in need of using a timer in my JSF page. The requirement is similar to that of online Examination where time decrements.... will i be able to use a timer in my JSF page...
Help Me out... Thanksssssss

i Just now came to know about meta refresh tags after ur post...thanks for it.......
well i used sessiontimeout in js to give the user an alert message after some time....
in what are the other situations it can be used????
i have a doubt....will sessiontimeout with delay of 5 seconds or so work after the browser is closed..... i want it to work few seconds after the browser is closed....
well about the metarefresh tag... i want to redirect the user to another page after specified time from the database.... can i retrieve and assign content value there...
ur info about meta refresh data was helpfull thanksssssss........
waiting for ur reply

Similar Messages

  • How to display date and time on jsf page

    Hi,
    how to display date and time on jsf page
    we are using 11.2.0.0 jdeveloper on windows.
    thanks
    Edited by: user12187801 on 26-Jul-2012 01:42

    Your question is certainly lacking some information.
    If you want a constantly updating date/time - then JavaScript is your best bet, and Google would find you examples like [url http://www.webestools.com/scripts_tutorials-code-source-7-display-date-and-time-in-javascript-real-time-clock-javascript-date-time.html]this
    If you meant something else, then it's back to you to explain.

  • Display specific row to display multiple time in jsf table 11.1.1.2.0 with

    HI ALL,
    I'm using jdeveloper 11.1.1.2.0 with ADF 11g.
    I have to display the values in jsf frm table where i'm using DislayCertDetailVO . In dis VO i'm having a column no.of certificaties .taking dis column value when i navigate to other page jsf by selecting a specific row. here i have to display the selected row in multiple times based on the no.of.certificates column value.
    I want to display specific row to display multiple time to repeat same row in a table in jsf based on the value from bean or table in database.
    Edited by: user9010551 on Apr 28, 2010 6:14 AM
    Edited by: user9010551 on Apr 28, 2010 10:33 PM

    Hi, Trying it once more to give more clarity of my scenario.
    I have to navigate from 1 screen to the other by picking a given table record/row from the 1st screen. While displaying the record on the 2nd screen the catch is that, I have to display it as many times as the value in a cell of the selected record.
    eg.
    screen 1
    col1   col2     col3
    2 order1 item1
    [next]
    On clicking next it should look like
    screen2
    col1           col2            col3           col4
    order1 item1
    order1 item1
    where col3 and col4 will be editable by the user and col1 is the value depends how many times i have repeat the row/record
    Hope this give more clarity.

  • How to apply a simple javascript into JSF

    Hi everyone. This is my first time using JSF and i am abit confuse in applying some simple javascript into my JSF. Actually, i just want to add a simple function that is to disable user from input some certain textfield (h:inputText) based on the selection in the combo box (h:selectOneMenu).
    The javascipt that i would like to apply in the JSF coding is shown as below:-
    <HTML>
    <TITLE>Example of onChange Event Handler</TITLE>
    <HEAD>
    <SCRIPT LANGUAGE="JavaScript">
    function textField()
    if(document.myform.mcDonald.value=="disable")
    document.myform.data.disabled=true;
    if(document.myform.mcDonald.value=="enable")
    document.myform.data.disabled=false;
    </SCRIPT>
    </HEAD>
    <BODY>
    <H3>Example of onChange Event Handler</H3>
    <form name="myform">
    <SELECT NAME="mcDonald" onChange="textField()">
    <OPTION VALUE="enable">Enable
    <OPTION VALUE="disable">Disable
    </SELECT>
    <input type="text" name="data" value="10" size=10 disabled="true" >
    </form>
    </BODY>
    </HTML>

    You need to use the id's of the components in the hierarchy. This is actual working code:
    // Javascript
              function actionedStatus_onchange(formObj, fieldValue) {
                   formObj.elements['foureye:tabExceptions:unresolvedOnly'].disabled = (fieldValue != 'all');
                   formObj.elements['foureye:tabExceptions:unresolvedOnly'].checked = (fieldValue == 'all');
    // JSF
                   <x:selectOneMenu id="actionedStatus" styleClass="detailBondField" value="#{exceptionsBean.actionedStatus}"
                             onchange="actionedStatus_onchange(this.form, this.value)">
                        <f:selectItems value="#{lookupBean.actionedStatusList}"/>
                   </x:selectOneMenu>
    In this case, the root component form is 'foureye' (a subview), followed by 'tabExceptions' (a form), followed by a checkbox 'unresolvedOnly' that I want to manipulate. Here I am disabling the checkbox and setting the value dependent on the value of the selectOneMenu

  • Faces/JSF vs Forms Application ?

    Hi All,
    I need to compare Forms based application with Faces/JSF based application, in term of performance.
    (The fact of proprietary vs open standard is not the consideration)
    Could any body please give comments on the points below :
    1) Initial Load, Forms has heavy initial load, can I say that Faces/JSF has much lighter initial Load ?
    2) Response Time, Faces/JSF has better response time than Formss ?
    3) Bandwidth Requirement, Faces/JSF need less bandwidth than Forms ?
    Thank you for your help,
    xtanto

    Its a pretty difficult question to answer since generally speaking they target different styles of application.
    As a general observation - being a "thin" client - JSF will be faster in that there is no initial download like Forms has with the Forms JAR file. Forms will also load e JVM which takes time as well...
    Response time is a difficult one as well since you tend, again, to have different expectation with the different UI technologies...
    I guess what we really need to do is get to the bottom of why you asking the question; if you are about to make a development decision there may be other factors which weight more heavily.
    Regards
    Grant Ronald
    Product Management

  • JSF newbie question - ServletException - Method not found

    I just started learning JSF (and JSP) by following the tutorial:
    JSF for nonbelievers: Clearing the FUD about JSF
    http://www-128.ibm.com/developerworks/library/j-jsf1/
    I'm getting a ServletException and I'm not sure why. Instead of starting the tutorial over, I'd like to learn what I'm doing wrong.
    The exception is:
    exception
    javax.servlet.ServletException: Method not found: [email protected]()
    root cause
    javax.el.MethodNotFoundException: Method not found: [email protected]()In the calculator.jsp page (a simple page with two form fields), I noticed that when I type CalcBean., my IDE (NetBeans) only autocompletes the class variables and neither of the methods (add and multiply). I quickly searched and someone suggested restarting the server. This did not fix my problem. I must be doing something completely wrong or I missed something in the tutorial. If you don't mind, please read the simple files below and see if you can spot anything wrong. Please keep in mind this is my first time using JSF (and JSP for that matter). If you can suggest a better newbie tutorial, please do! Thanks
    web.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app version="2.5" 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-app_2_5.xsd">
        <context-param>
            <param-name>com.sun.faces.verifyObjects</param-name>
            <param-value>false</param-value>
        </context-param>
        <context-param>
            <param-name>com.sun.faces.validateXml</param-name>
            <param-value>true</param-value>
        </context-param>
        <context-param>
            <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
            <param-value>client</param-value>
        </context-param>
        <servlet>
            <servlet-name>Faces Servlet</servlet-name>
            <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
            <load-on-startup>1</load-on-startup>
            </servlet>
        <servlet-mapping>
            <servlet-name>Faces Servlet</servlet-name>
            <url-pattern>/faces/*</url-pattern>
        </servlet-mapping>
        <session-config>
            <session-timeout>
                30
            </session-timeout>
        </session-config>
        <welcome-file-list>
         <welcome-file>
                index.jsp
            </welcome-file>
        </welcome-file-list>
    </web-app>
    faces-config.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <!-- =========== FULL CONFIGURATION FILE ================================== -->
    <faces-config version="1.2" 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">
      <managed-bean>
        <description>
                    The "backing file" bean that backs up the calculator webapp
                </description>
        <managed-bean-name>CalcBean</managed-bean-name>
        <managed-bean-class>secondapp.controller.CalcBean</managed-bean-class>
        <managed-bean-scope>session</managed-bean-scope>
      </managed-bean>
      <navigation-rule>
        <from-view-id>/calculator.jsp</from-view-id>
        <navigation-case>
          <from-outcome>success</from-outcome>
          <to-view-id>/results.jsp</to-view-id>
        </navigation-case>
      </navigation-rule>
    </faces-config>
    secondapp.controller.CalcBean.java
    package secondapp.controller;
    import secondapp.model.Calculator;
    * @author Jonathan
    public class CalcBean {
        private int firstNumber;
        private int secondNumber;
        private int result;
        private Calculator calculator;
        /** Creates a new instance of CalcBean */
        public CalcBean() {
            setFirstNumber(0);
            setSecondNumber(0);
            result = 0;
            setCalculator(new Calculator());
        public String add(int a, int b) {
            result = calculator.add(a,b);
            return "success";
        public String multiply(int a, int b) {
            result = calculator.multiply(a,b);
            return "success";
        // <editor-fold desc=" Accessors/Mutators ">
        public int getFirstNumber() {
            return firstNumber;
        public void setFirstNumber(int firstNumber) {
            this.firstNumber = firstNumber;
        public int getSecondNumber() {
            return secondNumber;
        public void setSecondNumber(int secondNumber) {
            this.secondNumber = secondNumber;
        public int getResult() {
            return result;
        public void setCalculator(Calculator calculator) {
            this.calculator = calculator;
        // </editor-fold>
    secondapp.model.Calculator
    package secondapp.model;
    * @author Jonathan
    public class Calculator {
        /** Creates a new instance of Calculator */
        public Calculator() {
        public int add(int a, int b) {
            return a+b;
        public int multiply(int a, int b) {
            return a*b;
    calculator.jsp
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
    <html>
        <head><title>Calculator Test</title></head>
        <body bgcolor="white">
            <h2>My Calculator</h2>
            <f:view>
                <h:form id="calcForm">
                    <h:panelGrid columns="3">
                        <h:outputLabel value="First Number" for="firstNumber" />
                        <h:inputText id="firstNumber" value="#{CalcBean.firstNumber}" required="true" />
                        <h:message for="firstNumber" />
                        <h:outputLabel value="Second Number" for="secondNumber" />
                        <h:inputText id="secondNumber" value="#{CalcBean.secondNumber}" required="true" />
                        <h:message for="secondNumber" />
                    </h:panelGrid>
                    <h:panelGroup>
                        <h:commandButton id="submitAdd" action="#{CalcBean.add}" value="Add" />
                        <h:commandButton id="submitMultiply" action="#{CalcBean.multiply}" value="Multiply" />
                    </h:panelGroup>
                </h:form>
            </f:view>
        </body>
    </html>

    In the future, please add some line breaks so I don't have to scroll horizontally to read your post.
    The problem is that the CalcBean.add/.multiply method is requiring two parameters. This method should be parameter-less. When talking about action methods, they should return String and not take any parameters.
    So, remove the parameters. You collect a firstNumber and a secondNumber from the user. These are the numbers you want to add (or multiply). Use those values (instead of the parameters) to calculate the result.
    The code changes aren't too complicated. I'd write them out for you, but you seem interested in learning (which is great by the way!). Let me know if you need more help on this.
    CowKing
    ps - I see more problems with the code, and I haven't given you all the answers. I know, I'm mean. You'll learn better if you try to fix things on your own first. I've just given you enough info to overcome the immediate issue. =)

  • JDev JSF Reformatter Bug

    Hi all,
    Been meaning to post about this for some time but never found the time :-)
    Using JSF, if I have an outputText with the escape attribute set to false and the value set to &amp;nbsp; (because I want to put a non breaking space on my page) everything is great until I reformat the JSP. Upon reformatting, the &amp;nbsp; is replaced with a normal space, and JDev complains of a malformed input character on that line in the JSP.
    The system is still usable, although the nbsp doesn't show in the output page of course.
    Just a minor annoyance ;-)
    Ta,
    Steve.

    We're tracking this via bug ID 2789824 - if you have a support contract, this is visible on http://metalink.oracle.com.
    Thanks,
    Brian
    JDev Team

  • Intention of JSF (web applications or web sites?)

    Hi,
    I want to write a web application that has a similar look and feel to todays desktop applications. Thus I don't need a typical web site look (title on the top, navigation bar etc.) but a more desktop look (a menu bar on the top, a status bar on the bottom etc.)
    Although I like JSF I am not sure, if this framework is the best for this job. Thus I wanted to ask, if you can tell me the intention of JSF:
    Is it to build web sites or is it also to build web applications without the typical web site look and feel? With JSF both is possible of course. And with the adequat JavaScript library on the client side it looks very nice (e.g. ExtJS).
    But was this one of the intentions of JSF? Or was it primarily to build usual web sites with a page flow etc.? And maybe another framework is better for what I am going to do?
    I only don't want to use a JSF for something it has not been made for.
    Greetings
    Mike

    wpafbuser1 wrote:
    I don't see what the point is in making a distinction between web sites and web apps. Are you trying highlight the difference between say Apache vs. JBoss?I'm not sure what you mean by "the difference between say Apache vs. JBoss" but here's what I meant. When I think a web site, I think of a site where the interaction tends to be more reading, clicking from page to the next, etc., like, for example a news site. With a web app, I tend to think of statefulness, business processes, etc, like an online accounting system, content management system, etc. The distinction is probably pretty academic, though...
    Well you need to decide if you're making a simple web site that serves static content or i fyou're making an application with a GUI. There's a big difference.Exactly.
    For a desktop-like application, I say web browsers in general are a bad choice. I'd use Web Start if possible and write a GUI. In any case, Hehe. That's a completely different (though very valid argument(
    AJAX is the last thing I'd use (now you're writing HTML, XML, AJAX, Java, etc..). Echo2 provides 1 single API rather than hacking several. Flex, while I haven't used much, seems to also provide a much cleaner solution. Fair enough, and that's not an uncommon opinion. I'm probably somewhere in the middle, but, for what I've been asked to do since the web 2.0 hype started, Ajax has been sufficient. I'm not Echo2 expert, but isn't that just an HTML/JS interface with a Java backend with Ajaxy operations? For really, really complex and dynamic UIs Flex (or JavaFX :) might be more appropriate.
    Again, I haven't used JSF so I can't say much about it. But I see lots of projects all the time and JSF seems to be slow for adoption so far. Just my personal experience.Hmm. I've used it for about three years now, fwiw, and really, really like it. Which probably isn't worth much. I will admit, though, that JSF isn't always the right tool (thus the discussion here). As far as adoption goes, it seems to be growing much faster than the other frameworks out there, but I may have tinted glasses... ;)

  • ConvertDateTime: caching TimeZone: possible JSF bug?

    Hi all,
    I'm outputing a date field utilizing the timezone attribute of the convertDateTime tag. When I change the viewing timezone, the convertDateTime tag seems to be caching the old timezone value.
    Is anyone else encountering this issue? Is it a Bug? Is there a work around?
    Thanks all,
    Here is some test code I wrote to expose the bug...
    public class TimeZoneTest {
        private static final Log LOGGER = LogFactory.getLog(TimeZoneTest.class);
        private TimeZone timeZone = TimeZone.getTimeZone("GMT");
        private Date currentTime = new Date();
        private SelectItem[] availableTimeZones;
        public TimeZone getTimeZone() {
            return timeZone;
        public void setTimeZone(String timeZone) {
            this.timeZone = TimeZone.getTimeZone(timeZone);
        public Date getCurrentTime() {
            return currentTime;
        public SelectItem[] getAvailableTimeZones() {
            if (null == availableTimeZones) {
                availableTimeZones = new SelectItem[3];
                availableTimeZones[0] = new SelectItem("GMT","GMT");
                availableTimeZones[1] = new SelectItem("PST","PST");
                availableTimeZones[2] = new SelectItem("EST","EST");
            return availableTimeZones;
    }The JSP:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <%@ page contentType="text/html;charset=UTF-8" language="java" %>
    <%@ taglib prefix="f" uri="http://java.sun.com/jsf/core" %>
    <%@ taglib prefix="h" uri="http://java.sun.com/jsf/html" %>
    <META HTTP-EQUIV="Pragma" CONTENT="no-cache"/>
    <META HTTP-EQUIV="Expires" CONTENT="-1"/>
    <f:view>
        <html xmlns="http://www.w3.org/1999/xhtml">
            <body>
                <h:form>
                    <h:panelGrid columns="2">
                        <h:outputText value="TimeZone:"/>
                        <h:outputText value="#{timeZoneTest.timeZone.ID}"/>
                        <h:outputText value="Current Time:"/>
                        <h:outputText value="#{timeZoneTest.currentTime}">
                            <f:convertDateTime pattern="MM/dd/yyyy HH:mm:ss z" timeZone="#{timeZoneTest.timeZone}"/>
                        </h:outputText>
                        <h:outputText value="Change Time Zone:"/>
                        <h:selectOneMenu value="#{timeZoneTest.timeZone.ID}"
                                         onchange="submit()">
                            <f:selectItems value="#{timeZoneTest.availableTimeZones}"/>
                        </h:selectOneMenu>
                    </h:panelGrid>
                </h:form>
            </body>
        </html>
    </f:view>

    Thanks for the reply.
    It appears the "F" tags are read in once per session. In my real testcase, if I start a new session the dates show in the correct timezone. So I believe this means that any evaluated value bindings for the "F" tags would be stored at the session scope.
    IMO - this is a major design flaw. Why allow for dynamic value binding expressions on a component that isn't fully evaluated when the tree is rendered?
    The only way around this seems to be a custom tag.
    So here is my crude outputDate custom tag - I hope this helps someone.
    Disclaimer: I only tested the three attributes I made: not sure if the component is as fully functional as say a h:outputText tag.
    Cheers,
    Jason V.
    The Tag:
    public class OutputDateTag extends UIComponentTag {
        private static final Log LOGGER = LogFactory.getLog(OutputDateTag.class);
        private String pattern;
        private String timeZone;
        private String value;
        private static final String TIME_ZONE_ATTRIBUTE = "timeZone";
        private static final String PATTERN_ATTRIBUTE = "pattern";
        private static final String VALUE_ATTRIBUTE = "value";
        public void setPattern(String pattern) {
            this.pattern = pattern;
        public void setTimeZone(String timeZone) {
            this.timeZone = timeZone;
        public void setValue(String value) {
            this.value = value;
        public String getRendererType() {
            return null;
        public String getComponentType() {
            return "com.mycompany.presentation.components.UIOutputDate";
         * Sets the 3 expected attributes:
         * <pre>
         * value: should evaluate to a java.util.Date object.
         * timeZone: should evaluate to a java.util.TimeZone object.
         * pattern: should evaluate to a String and be a compatiable form for a SimpleDateFormat object.
         * </pre>
         * {@inheritDoc}
         * @param component {@link UIComponent} whose properties are to be overridden
        @SuppressWarnings({"unchecked"})
        protected void setProperties(UIComponent component) {
            super.setProperties(component);
            FacesContext context = FacesContext.getCurrentInstance();
            Application application = context.getApplication();
            //pattern
            Map attributes = component.getAttributes();
            if (isValueReference(pattern)) {
                ValueBinding patternValueBinding = application.createValueBinding(pattern);
                component.setValueBinding(PATTERN_ATTRIBUTE, patternValueBinding);
            } else {
                attributes.put(PATTERN_ATTRIBUTE, pattern);
            //time zone
            if (isValueReference(timeZone)) {
                ValueBinding timeZoneValueBinding = application.createValueBinding(timeZone);
                component.setValueBinding(TIME_ZONE_ATTRIBUTE, timeZoneValueBinding);
            } else {
                attributes.put(TIME_ZONE_ATTRIBUTE, timeZone);
            //value
            if (isValueReference(value)) {
                ValueBinding valueBinding = application.createValueBinding(value);
                component.setValueBinding(VALUE_ATTRIBUTE, valueBinding);
            } else {
                attributes.put(VALUE_ATTRIBUTE, value);
            LOGGER.debug("pattern = " + pattern);
            LOGGER.debug("timeZone = " + timeZone);
            LOGGER.debug("value = " + value);
         * <p>Release any resources allocated during the execution of this
         * tag handler.</p>
        public void release() {
            super.release();
            value = null;
            timeZone = null;
            pattern = null;
    }The TagLib:
        <tag>
            <name>outputDate</name>
            <tagclass>com.prenet.presentation.tags.OutputDateTag</tagclass>
            <bodycontent>empty</bodycontent>
            <attribute>
                <name>value</name>
                <required>true</required>
                <rtexprvalue>false</rtexprvalue>
            </attribute>
            <attribute>
                <name>pattern</name>
                <required>true</required>
                <rtexprvalue>false</rtexprvalue>
            </attribute>
            <attribute>
                <name>timeZone</name>
                <required>true</required>
                <rtexprvalue>false</rtexprvalue>
            </attribute>
            <attribute>
                <name>binding</name>
            </attribute>
            <attribute>
                <name>id</name>
            </attribute>
            <attribute>
                <name>rendered</name>
            </attribute>
        </tag>The Component:
    public class UIOutputDate extends UIOutput {
        private static final Log LOGGER = LogFactory.getLog(UIOutputDate.class);
        private static final String TIME_ZONE_ATTRIBUTE = "timeZone";
        private static final String PATTERN_ATTRIBUTE = "pattern";
        private static final String VALUE_ATTRIBUTE = "value";
        public UIOutputDate() {
            //we render ourself... thanks.
            setRendererType(null);
         * Uses the timeZone and pattern attributes to pass to a  SimpleDateFormat object to get a String
         * representation of the Date value.
         * @throws NullPointerException {@inheritDoc}
        public void encodeBegin(FacesContext context) throws IOException {
            ResponseWriter writer = context.getResponseWriter();
            Locale locale = context.getViewRoot().getLocale();
            Map attributes = getAttributes();
            Date value = (Date) getValue();
            TimeZone toTimeZone = (TimeZone) attributes.get(TIME_ZONE_ATTRIBUTE);
            String pattern = (String) attributes.get(PATTERN_ATTRIBUTE);
            DateFormat format = new SimpleDateFormat(pattern, locale);
            format.setTimeZone(toTimeZone);
            String dateString = format.format(value);
            writer.writeText(dateString, VALUE_ATTRIBUTE);
    }The Test JSP (note: that there are some fixes to my original post)
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <%@ page contentType="text/html;charset=UTF-8" language="java" %>
    <%@ taglib prefix="f" uri="http://java.sun.com/jsf/core" %>
    <%@ taglib prefix="h" uri="http://java.sun.com/jsf/html" %>
    <%@ taglib prefix="p" uri="http://www.mycompany.com/jsfTaglib" %>
    <META HTTP-EQUIV="Pragma" CONTENT="no-cache"/>
    <META HTTP-EQUIV="Expires" CONTENT="-1"/>
    <f:view>
        <html xmlns="http://www.w3.org/1999/xhtml">
            <body>
                <h:form>
                    <h:panelGrid columns="2">
                        <h:outputText value="TimeZone:"/>
                        <h:outputText value="#{timeZoneTest.timeZoneId}"/>
                        <h:outputText value="Current Time (Standard JSF):"/>
                        <h:outputText value="#{timeZoneTest.currentTime}">
                            <f:convertDateTime pattern="MM/dd/yyyy HH:mm:ss z" timeZone="#{timeZoneTest.timeZone}"/>
                        </h:outputText>
                        <h:outputText value="Current Time (Custom TAG):"/>
                        <p:outputDate value="#{timeZoneTest.currentTime}" pattern="MM/dd/yyyy HH:mm:ss z" timeZone="#{timeZoneTest.timeZone}"/>
                        <h:outputText value="Change Time Zone:"/>
                        <h:selectOneMenu value="#{timeZoneTest.timeZoneId}" onchange="submit()">
                            <f:selectItems value="#{timeZoneTest.availableTimeZones}"/>
                        </h:selectOneMenu>
                    </h:panelGrid>
                </h:form>
            </body>
        </html>
    </f:view>The Testing Backing Bean:
    public class TimeZoneTestVC {
        private static final Log LOGGER = LogFactory.getLog(TimeZoneTestVC.class);
        private String timeZoneId = "UTC";
        private SelectItem[] availableTimeZones;
        public TimeZone getTimeZone() {
            TimeZone timeZoneByName = TimeZone.getTimeZone(timeZoneId);
            return timeZoneByName;
        public String getTimeZoneId() {
            return timeZoneId;
        public void setTimeZoneId(String timeZoneId) {
            this.timeZoneId = timeZoneId;
        public Date getCurrentTime() {
            return new Date();
        public SelectItem[] getAvailableTimeZones() {
            if (null == availableTimeZones) {
                String[] availableIDs = TimeZone.getAvailableIDs();
                Arrays.sort(availableIDs);
                availableTimeZones = new SelectItem[availableIDs.length];
                int i = 0;
                for (String zoneId : availableIDs) {
                    availableTimeZones[i] = new SelectItem(zoneId, zoneId);
                    i++;
            return availableTimeZones;
    }

  • Asycronous page load with JSF

    We are looking to develop a portlet/widget type page in JSF (2.0) and would like to set it up so that each widget load concurrently. So the intial page would render and then each component would render after that. It doesn't appear that we can have more than one ajax call execute at a time with JSF. I was wondering what is the best way to accomplish this. I know iframes would work, but I am a little reluctant to go down that path. Are there any other ways this can be done with a standard JSF application?

    The trouble with JSF is that it is oriented on the business side of things and not the front-end; what you have here however is a strong front-end requirement. I'll be very blunt there: if these sort of requirements are important then JSF is not the right choice for this application.
    You mention portlets; something like this is perhaps an option?
    http://www.hascode.com/2011/07/creating-portlets-with-java-server-faces-2-and-liferay/
    I don't know if this solves your requirement of asynchronously loading widgets though.

  • Problems with combination of ADF Faces, Tomahawk, Facelets and MyFaces

    Hello,
    I am trying to combine all things named in the Subject and run into several problems:
    1. ADF Render Kit forces the Tomahawk Components to be rendered in a wrong way or stop there functionality.
    Example 1: The clickable parts of the t:dataScroller Tag can not be accessed because an empty a Tag will be rendered after the outputText.
    Example 2: The t:commandSortHeader Tag can be clicked but the table content will not be sorted anymore.
    The given examples works if i remove the default-render-kit-id element from the faces-config.xml
    2. The ad:table Tag runs into an ClassCastException, only when I put a simple example code snipped into my xhtml file.
    Code snipped:
    <af:table>
    <af:column>
    <f:facet name="header">
    <af:outputText value="Firstname"/>
    </f:facet>
    </af:column>
    <af:column>
    <f:facet name="header">
    <h:outputText value="Lastname"/>
    </f:facet>
    </af:column>
    </af:table>
    The stack trace look like this:
    java.lang.ClassCastException at oracle.adfinternal.view.faces.renderkit.core.xhtml.DesktopTableRenderer._renderRegularColumns(DesktopTableRenderer.java:1029)
         at oracle.adfinternal.view.faces.renderkit.core.xhtml.DesktopTableRenderer.renderSingleRow(DesktopTableRenderer.java:109)
         at oracle.adfinternal.view.faces.renderkit.core.xhtml.TableRenderer.encodeAll(TableRenderer.java:229)
         at oracle.adfinternal.view.faces.renderkit.core.xhtml.DesktopTableRenderer.encodeAll(DesktopTableRenderer.java:79)
         at oracle.adfinternal.view.faces.renderkit.core.CoreRenderer.encodeEnd(CoreRenderer.java:159)
         at oracle.adf.view.faces.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:624)
         at oracle.adf.view.faces.component.UIXCollection.encodeEnd(UIXCollection.java:438)
         at oracle.adfinternal.view.faces.renderkit.RenderUtils.encodeRecursive(RenderUtils.java:54)
         at oracle.adfinternal.view.faces.renderkit.core.CoreRenderer.encodeChild(CoreRenderer.java:232)
         at oracle.adfinternal.view.faces.renderkit.core.CoreRenderer.encodeAllChildren(CoreRenderer.java:255)
         at oracle.adfinternal.view.faces.renderkit.core.xhtml.PanelPartialRootRenderer.renderContent(PanelPartialRootRenderer.java:65)
         at oracle.adfinternal.view.faces.renderkit.core.xhtml.BodyRenderer.renderContent(BodyRenderer.java:117)
         at oracle.adfinternal.view.faces.renderkit.core.xhtml.PanelPartialRootRenderer.encodeAll(PanelPartialRootRenderer.java:147)
         at oracle.adfinternal.view.faces.renderkit.core.xhtml.BodyRenderer.encodeAll(BodyRenderer.java:60)
         at oracle.adfinternal.view.faces.renderkit.core.CoreRenderer.encodeEnd(CoreRenderer.java:159)
         at oracle.adf.view.faces.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:624)
         at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:242)
         at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:239)
         at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:239)
         at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:521)
         at oracle.adfinternal.view.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:157)
         at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:352)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:107)
         at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
         at oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl._invokeDoFilter(AdfFacesFilterImpl.java:367)
         at oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl._doFilterImpl(AdfFacesFilterImpl.java:336)
         at oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl.doFilter(AdfFacesFilterImpl.java:196)
         at oracle.adf.view.faces.webapp.AdfFacesFilter.doFilter(AdfFacesFilter.java:87)
         at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:16)
         at org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(ExtensionsFilter.java:122)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:659)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:330)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:830)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:285)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:126)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:186)
         at java.lang.Thread.run(Thread.java:534)
    I followed all steps for the ADF installation and the suggested steps for using ADF with Facelets.
    Used versions:
    - Oracle ADF Faces 10.1.3 Early Access
    - myFaces 1.1.1
    - Facelets 1.1.1
    - oc4j 10.1.2.0.2
    Has somebody try to use these things together, too?
    Thanks,
    Carsten

    Hi,
    Inside our fusion applications(ADF/Webcenter) using combination of JSTL and ADF Faces is good practice or pitfal?
    To suggest a a rule of thumb: Try ADF Faces on-board functionality first before reaching out to JSTL. The difference between JSF in general and JSTL is that the JSTL expressions are evaluated at page compile time wheras JSF expressions are evaluated deferred. This difference may have an impact to PPR refreshes and the data rendering (which in many cases I assume you can fix by setting the ADF Faces component content delivery to immediate instead of deferred). On a training slight I flagged JSTL with a "heads up" alert because of this
    Frank

  • Using a4j to load a rich:dataTable after the page loads

    I have a rich:dataTable that calls a session bean which executes an SQL query to generate the data to be displayed in the table. Something simple like:
    <rich:dataTable rowClasses="evenRow,oddRow"
    rows="30"
    value="#{Bean.items}"
    var="items">
    where Bean.getItems() performs an SQL query and returns List<Item>.
    The problem is that the query takes a long time to execute (~45 seconds) and I'd like the page to initially load while the query is being executed, displaying a spinner while it loads. Once the query is done, I'd like to update the initially empty table using ajax.
    I set up a spinner using a4j:status and it works fine after the page initially loads (using a rich:datascroller).
    However, the page will not initially load until the query completes, which is a problem because the query is so slow. What happens is the user clicks on the "List Items" tab from my site's homepage, sits there on the same page for 45 seconds with absolutely no visual indication that anything is happening, and then finally is taken to the list of items page.
    What is needed to make the dataTable load via AJAX the first time, as well as all subsequent times?
    Thanks!
    Edited by: rcrowell on Sep 8, 2008 5:42 PM

    rcrowell wrote:
    The issue isn't the PK of the table; the query is joining across many tables and aggregating data from one table in particular with millions of rows. The table has paging, but again that won't help the timinig issues due to the aggregation that must be performed on a large table.
    Surely there must be a way to get the dataTable to always load its data via ajax, and not only after the first time.Well JSF does not have AJAX built-in, so why would there be? Perhaps one of the AJAX-based frameworks has this. I imagine it wouldn't be hard to do with the existing AJAX frameworks even without a built-in component specifically for it. Trigger an AJAX action on load which rerenders a panel which will only contain the dataTable upon the rerendering.
    >
    I think I could do it by adding a 'dataTableRendered' variable to the bean and using a jsFunction to set this variable to True when the page loads, but I'm looking for a better way. (I'm also not 100% sure this would do what I want.)

  • Storing an "indicator" to control behaviour during submit()

    Hello,
    I'm developing a JSF page in which I need to access some data from a database and use the data to control the GUI (components) behaviour as well as behaviour during submit().
    I have a backing bean for my JSF page and bound a number of GUI components to properties on the backing bean. I also have getters and setters for those properties.
    In the getter for one of the properties (bound to a GUI component -- in fact, an HtmlOutputLabel), I did the following:
    -- read data from the database (this is successful)
    -- got the HttpSession object from the FacesContext: session = (HttpSession)FacesContext.getCurrentInstance().getExternalContext().getSession(false);
    -- set an attribute in the session object: session.setAttribute("firstReviewDone", new Boolean(firstReviewComplete));

    I don't see anything obviously wrong in what you posted; however I would make a couple of suggestions.
    First, don't do work in getters. The getters will be invoked a number of times as JSF works through the lifecycle. If you need to initialize something it is generally better to use a @PostConstruct method.
    Second, rather than using the session directly, the JSF approach would be to use a session scoped bean. Make a simple bean that holds your attribute (I'm sure you will add others later) and configure it as a session bean. Then inject it into your original bean. (You might find that in this approach it makes more sense to do the @PostConstruct in the new bean.)
    Incorporate the above or not, but if at the end of that (potentially null) process it still isn't working I would suggest posting the code here and not just snippets and descriptions.

  • Af:table with tags JSTL.

    Hi guys,
    I'm tried to use JSTL (c:if) inside component ADF Rich Client (af:table) and it shown me a error message.
    Is possible using JSTL with ADF? If is possible, you have a sample? Or a idea for solution this case?
    The code that I'm creating is:
    <?xml version='1.0' encoding='UTF-8'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
              xmlns:f="http://java.sun.com/jsf/core"
              xmlns:h="http://java.sun.com/jsf/html"
              xmlns:c="http://java.sun.com/jsp/jstl/core"
              xmlns:fn="http://java.sun.com/jsp/jstl/functions"
              xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
      <jsp:directive.page contentType="text/html;charset=UTF-8"/>
      <f:view>
        <af:document id="d1">
          <af:form id="f1">
            <af:table value="#{valueTable.paises}" var="row" rowBandingInterval="0"
                      id="t2" varStatus="status">
              <c:if test="#{status.count == 1}">
                <af:forEach items="#{valueTable.paises}" var="cvalue" varStatus="teste">
                  <af:column sortable="false" headerText="#{cvalue}" align="start" id="c7">
                    <af:outputText value="#{cvalue}#{fn:length(valueTable.paises)}" id="ot6"/>
                  </af:column>
                </af:forEach>
              </c:if>
              <c:if test="#{status.count > 1}">
                <af:forEach items="#{valueTable.paises2}" var="cvalue2" varStatus="teste2">
                  <af:column sortable="false" headerText="#{cvalue2}" align="start" id="c7">
                    <af:outputText value="#{cvalue2}#{fn:length(valueTable.paises2)}" id="ot6"/>
                  </af:column>
                </af:forEach>
              </c:if> 
            </af:table>
          </af:form>
        </af:document>
      </f:view> Another information:
    I tried using af:switcher but af:switcher only can to be use inside in af:treeTable it can't to be use inside in af:table.

    Hi,
    the problem with this is that JSTL is parsed at compile time whereas JSF statements are evaluated at runtime. So while you can use JSTL, you can't for the use case you list here.
    What about this (forget about your JSTL)
    <af:forEach items="#{valueTable.paises}" var="cvalue" varStatus="teste">
      <af:switcher defaultFacet="equal" facetName="#{status.count > 1? 'larger' : 'equals'}">
           <f:facet name="larger">
                 <af:column sortable="false" headerText="#{cvalue2}" align="start" id="c7">
                    <af:outputText value="#{cvalue2}#{fn:length(valueTable.paises2)}" id="ot6"/>
                  </af:column>
                  </af:column>
           </f:facet>
           <f:facet name="equals">
                   <af:column sortable="false" headerText="#{cvalue}" align="start" id="c7">
                    <af:outputText value="#{cvalue}#{fn:length(valueTable.paises)}" id="ot6"/>
           </f:facet>
      </afSwitcher>
    </af:forEach> Note that chances are that the table doesn't like the switcher as it expects a column. However, I didn't try it ;-)
    The alternative would be to use
    <af:forEach items="#{valueTable.paises}" var="cvalue" varStatus="teste">  
                 <af:column sortable="false" headerText="#{status.count > 1?  cvalue2 : cvalue}" align="start" id="c7">
                    <af:outputText value="#{cvalue2}#{fn:length(valueTable.paises2)}" id="ot6" rendered=#{status.count > 1}/>
                    <af:outputText value="#{cvalue}#{fn:length(valueTable.paises)}" id="ot7" rendered=#{!status.count > 1}/>
                </af:column>
    </af:forEach> Frank
    Edited by: Frank Nimphius on May 14, 2010 5:13 PM
    Edited by: Frank Nimphius on May 14, 2010 5:14 PM

  • Problems in using Creator

    *) I reinstalled the studio creator and I invoked the existing
    project. At the first time, the JSF components in the design appears.
    Once I close the creator and open the same project,the design
    is not appearing but the coding only appears.This is happening in RedHat Linux. What is the issue here.
    *) When I run the project, during deploying the project I get error message
    that "port conflict for sunapp server 8080".
    *) I installed the project in /opt/Creator under linux, my project directory is in /home/user/Projects.once i created the project and invoked at second
    time it is opening as read only unable to run.
    *) When I tend to open the project, I received a message "project already open"
    but I can't find any projects open.

    Hi,
    Please update the IDE to update 6 and try.
    Do you have have any other appserver instance running on your machine?
    when you get a messege "project already open", see if you can find the page1.jsp and other files in project navigator,if so double click on page1.jsp
    regards
    MJ

Maybe you are looking for

  • Raw Files from LR do not open automatically in Photoshop raw processor

    I like to edit my images in Photoshop. Could you please advise why after I upload raw files into LR and using photoshop as external editor, the file opens but not in the PS (photoshop) raw processor. I have to work around this by first finding the im

  • (Synology, ReadyNAS, or Airport Extreme)+External

    I just recently switched to Mac. I had a big desktop, my girlfriend had a very old macbook, so we are dumping both and just bought a MB Air. We need some external storage and my initial idea was an Airport Extreme + an external harddrive and using th

  • Function with dynamics cursor.

    Hi everybody, I'm trying to write a function having as argument as SQL query(or a part of it). This SQL query should generate a cusror within the function. All the way would have the generated cusror always the same structure. CREATE OR REPLACE FUNCT

  • Adding columns to content query

    I have created a Content Query that retrieves all of my tasks from my site collection that meets my filter criteria.  However, The Item Views are incredibly limited (basically just the title).  I want to add ~5-7 additional columns to the query, such

  • WRT54GP2 security settings for HP Ipaq 111 handheld

    I have a home wireless network, using a Linksys WRT54GP2 wireless router. I'm trying to secure the network, with has 3 wireless systems, my home PC, a notebook, and my Ipaq 111. I can get my home PC and the notebook to work when I setup the WRT54GP2