A JSF Problem

hi
i had created a simple login page page in which two outputlabel two inputext,and two buttons are added using html table but this page submit page is not working here is my code of this page.the name of this page is welcomeJSF.jsp
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<%@taglib prefix="ui" uri="http://www.sun.com/web/ui"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <f:view>
            <h:form id="loginForm">
            <table align="left" border="1" cellspacing="1" cellpadding="1">
                    <tr>
                        <td>
                            <h:outputText id="label1" rendered="true" value="Login Name"/>
                            <h:inputText id="text1" rendered="true" value=""/>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <h:outputText id="label2" rendered="true" value="Password"/>
                            <h:inputText id="text2" rendered="true" value=""/>
                        </td>
                    </tr>
                 <tr>
                       <td>
                               <h:commandButton id="button1" action="login" value="Submit"/>
            <h:commandButton id="button2" type="reset" value="Reset"/>
                       </td>
                 </tr>
            </table>
            </h:form>
        </f:view>
    </body>
</html>and this is the facesconfigure file
<?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>
<managed-bean-name>test</managed-bean-name>
<managed-bean-class>com.test.Test</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
<navigation-rule>
<from-view-id>/welcomeJSF.jsp</from-view-id>
<navigation-case>
<from-outcome>login</from-outcome>
<to-view-id>/Login.jsp</to-view-id>
</navigation-case>
</navigation-rule>
</faces-config>

not workin means when i submit this page it does not navigate to the specified page as i have given in navigation.xml file.

Similar Messages

  • JSF problem

    Hi
    I have problems when deploying enterprise applications to Sun Java System Application Server 9 that contain JSF pages. The scenario is the following:
    I developed an enterprise application using Oracle JDeveloper 10.1.3. My EAR archive contains an EJB module (with BMP Entity Beans according to 2.1 spec) and a WAR module (using JSF 1.1). The app works fine in this IDE.
    I've tried to migrate the EAR to Sun Java System Application Server 9. When I upload the EAR to this server, it indicates that deploying is successful, according to the server log. But when I try to access the application through the web browser, an exception is thrown:
    HTTP Status 500 -
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    org.apache.jasper.JasperException: jsp.error.beans.property.conversion
    Seems like if JSF pages are not compiled correctly when they're contained in an enterprise application.
    If I only deploy the WAR, I can access the application, I mean, the index.jsp page is compiled and shown in the web browser. However, the app still doesn't work, because it needs the EJB module. That's why I need to deploy the entire enterprise application as an EAR.
    Seems like if Sun Java System Application Server 9 has problems when a deployed EAR contains JSF pages.
    I don't know if this is a bug or I'm missing any descriptor or something like that. Hope you can help me please.

    Hi, I experimented the same problem. Do you find some solution?
    Thanks in advance.

  • Java Server Faces - JSF - Problem

    Hi,
    I have a problem to run an example of jsf application!
    I'm using Apache Tomcat/6.0.10 and the application is deployed!
    -------------** Excuse me for my english, I'm Italian **----------
    When I run the application, the browser (Mozilla) show me this error:
    java.lang.IllegalStateException: Application was not properly initialized at startup, could not find Factory: javax.faces.context.FacesContextFactory
    Can you help me for run correctly this application ?

    The problem is likely that the JSF classes are not available to your application server.

  • JSF problems with Javascript

    Hi everyone!!
    The situation is this: I have a datable with one of its columns make an h:commanLink, which has two f:params, its actionListener is a function of a ManagedBean. This is JSF, not MyFaces. In IE, When the link is pressed, it shows a javascript error: " 'elements.idVar' is null or it's not an object ", however in Firefox, it works perfectly. I have been looking for the problem and it have to do with this:
    </form><a href="# onclick="clearFormHiddenParams_formResultado('formResultado');document.forms['formResultado'['formResultado:_idcl'].value='formResultado:dtTablaResultados:0:_id10';document.forms['formResultado']['idVar'].value='37';document.forms['formResultado']['idMun'].value='168'; document.forms['formResultado'].submit(); return false;"><span id="formResultado:dtTablaResultados:0:itColumna3" title="AREA COSECHADA EN CULTIVOS PERMANENTES">1,230</span></a></td>
    </tr>
    <tr class="standardTable_Row2">
    <td><span id="formResultado:dtTablaResultados:1:itColumna1" style="text-align:center;" title="C&oacute;digo Municipio">718</span></td>
    <td><a href="javascript:void(0)" onclick="javascript:window.opener.opener.showLink('SASAIMA')"><span id="formResultado:dtTablaResultados:1:itColumna2_l" title="Municipio">SASAIMA</span></a></td>
    <td><form id="formResultado:dtTablaResultados:1:_id9" method="post" action="/ConsultaEstadisticasGeo/resultadoConsulta.jsf" enctype="application/x-www-form-urlencoded">
    <input type="hidden" name="com.sun.faces.VIEW" id="com.sun.faces.VIEW" value="_id39:_id41" /><input type="hidden" name="formResultado:dtTablaResultados:1:_id9" value="formResultado:dtTablaResultados:1:_id9" /><input type="hidden" name="idVar" /><input type="hidden" name="idMun" /><input type="hidden" name="formResultado:_idcl" />
    <script type="text/javascript">
    <!--
    function clearFormHiddenParams_formResultado_dtTablaResultados_1__id9(curFormName) {
    var curForm = document.forms[curFormName];
    curForm.elements['idVar'].value = null;
    curForm.elements['idMun'].value = null;
    curForm.elements['formResultado:_idcl'].value = null;
    //-->
    </script>
    the way JSF manage the params. The error, acdording to the message shonw by IE is in this line: curForm.elements['idVar'].value = null;
    The code of the JSP is this:
    <h:commandLink     actionListener="#{consultaEstadisticasMB.detalleEstadistica}">
         <f:param name="idVar" value="#{consultaEstadisticasMB.idColumna3}" id="idVar" />
         <f:param name="idMun" value="#{registro[0]}" id="idMun" />
         <h:outputText title="#{consultaEstadisticasMB.columna3}" id="itColumna3" value="#{registro[2]}" />
    </h:commandLink>
    Waht can i do? (Not using MyFaces, because I can�t do that)
    Thanks for your answers!!

    I have run into this same problem with javascript and the colon. I am not sure if the colon is a valid character for a javascript identifier (one would think the RI developers would have checked it out though!?!).
    Anyway, my workaround is to search through the Javascript DOM for the widget you want to obtain a reference to, using part of its id. After all, you know its id, you just can't use it as a javascript reference. In your Javascript code, do something like:
        var inputWidgets = document.getElementsByTagName("input");
        var targetInput;
        for(var i = 0; i < inputWidgets.length; i++)
           var inputId = inputWidgets.id;
    if(inputId.indexOf("yourInputId") != -1)
    targetInput = inputWidgets[i];
    break;
    It's a lot of effort to just get a reference to a form widget....but it works (I pasted in the code and changed it a bit, so it might not work as is, but at least it demonstrates the idea).

  • Beginner's JSF problems

    Hi - I'm a beginner at using JSF. I've worked with Java and Struts, and I'm comfortable with Netbeans. I'm working through some example code from one of the JSF books and I'm having the following problems:
    1) The following code simply doesn't work...
    <h:commandLink action="logout">
    <h:graphicImage url="images/logout.gif"
    styleClass="header-icon"
    alt="Logout" />
    <h:outputText value="Logout" styleClass="header-command" />
    </h:commandLink>
    This code should load the 'logout' JSP page. The navigation is set correctly.
    I replaced this code with the following line, and it does exactly what I want - load the JSP page:
    <h:commandButton title="Logout" value="Logout" action="logout"/>
    What have I done wrong with the command link? The page prints the link, and it looks like it can be selected (when the mouse moves over it) but it won't go to the logout page...
    2) I added a button, which I want to gray out based on a value in the 'User' javabean. This works (arbitrarily):
    <h:commandButton title="Admin" value="Admin"
    action="admin" disabled="false" />
    But this doesn't:
    <h:commandButton id="cmd_Admin" title="Admin" value="Admin" acti
    on="admin" disabled="#{user.admin}" />
    The 'user' variable maps to a bean class named 'User'. The routine
    "public boolean user.isAdmin() " gets called, and logs a message that it is about to return a value of 'false'. But the button is not grayed out, and in fact the generated HTML code does not have a 'disabled' entry. I'm obviously not getting the right information back from the bean - or I'm calling the wrong routine entirely... What should I be doing in this case?
    Thanks in advance.
    nbc

    Your command button should have an "action" parameter
    that points to a method in the backing bean. No .. This is not the problem .. The action="#{myBean.action}" where action() returns a String will just be expressed to action="returnedString" and then the navigationhandler will pick up the String value to handle navigation.
    And now the real problem with commandLink: such a construction just works here. Probably you've made a typo somewhere else? Which JSF version are you using? Ive tested it at 1.1_02 and 1.2_02. The basic example i've used looks like:
    test.jsp<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <f:view>
        <html>
        <head>
        </head>
        <body>
        <h:form>
            <h:commandLink action="logout">
                <h:graphicImage url="logout.gif" />
                <h:outputText value="logout" />
            </h:commandLink>
        </h:form>
        </body>
        </html>
    </f:view>logout.jsp<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <f:view>
        <html>
        <head>
        </head>
        <body>
            <h:outputText value="You're logged out." />
        </body>
        </html>
    </f:view>faces-config.xml navigation:<navigation-rule>
        <navigation-case>
            <from-outcome>logout</from-outcome>
            <to-view-id>logout.jsf</to-view-id>
        </navigation-case>
    </navigation-rule>And now the problem with EL in the disabled attribute: this also just works here.
    JSF<h:form>
        <h:commandButton value="action" action="#{myBean.action}" disabled="#{myBean.disabled}" />
    </h:form>MyBeanpublic void action() {
        System.out.println("action");
    public boolean isDisabled() {
        return true;
    // this also works
    public Boolean getDisabled() {
        // null or Boolean.FALSE will be handled as false and Boolean.TRUE will be handled as true
    }Probably you're doing something wrong again?

  • JAVASCRIPT AND JSF PROBLEM REFRESHING PAGE PROBLEM

    Hello everyone, I am currently using visual JSF and javascript to to disable a fileupload component when a radio button is clicked. I don't have any problems getting it to work if I need to disable a button, a textfield or other visual JSF components. For some reason, i can't disable the fileupload component and I get this error when the JAVASCRIPT is called:
    Error: document.getElementById("form1:fileUpload1").refresh is not a function
    Source File: http://localhost:8080/TestSingleEvent/theme/com/sun/webui/jsf/suntheme4_2-080320/javascript/webui.js
    Line: 22
    My javascript code is the following:
    document.getElementById("form1:fileUpload1").refresh("form1:radioButton1");return false;
    I would appreciate some help here. Why is it that when I replace the fileUpload with i.e a textfield i don't get errors..
    Is it something to do with the webui.js ?
    Many thanks.

    There is no such thing as refresh() in the [DOM element|http://developer.mozilla.org/en/DOM/element]. How did you come to this? Did you a wild guess in the around without reading the docs? Don't do that.
    What exactly do you want to achieve? Reset its value? Then set the 'value' property to null. Disable the element? Then set the 'disabled' property to true.
    I've been helpful enough with this offtopic question. If you still stucks, please continue at a Javascript oriented forum. There's one at under each webdeveloper.com.

  • JPA & visual JSF problem

    Hello, everybody :),
    I'm new to Java Web Development, and I'm in big trouble, :) and I'm on the edge of despair. I'll appreciate any help.
    Here is the problem - I've been trying for hours to do something like [ this|http://www.netbeans.org/kb/60/web/web-jpa.html] tutorial example but it is not working for me!
    I've changed it a bit - I'm using MySQL, I created a few Entity classes from the database, I created controllers from them (right click -> JPA controller Classes from Entity Class). I've bounded the table (from the example) as it was said and then I tried to run the application - it started but the table was emplty and in it was written that "No items found". I 100% sure that the table in the database is not empty and there are no error messages.
    I tried to debug the application then I saw that when I go to the updateUsers() mehtod in the entity class controller and I try to get the EntityManager something crashes and I go straight to the calling SessionBean1 with NULL as a user list - can you help me?
    Something more, when I create new Web project and I create the Entity classes from the database - the one that I'm having problem with for the Persistence example, and I create JSP pages for the entity classes - (you know just right click + .....) and the CRUD application is working just fine - I don't understand what is wrong with my trial to use the Java Persistence API Within a Visual Web JSF Application?
    Thanks in advance!
    P.S. Sorry for posting this topic again - I thing is the better place to get answer.
    Edited by: GGeorgieva on Jan 1, 2009 3:40 PM

    You're right again - can you help me with finding the reason for this, I'll paste some of the server log:
    It is the database? I guess? But how could it be - I've been working with that very DB from another Web Java Application?
    So is there a RIGHT way to connect to MySQL DataBase from a JavaSE project, which we have connected to a Web Java Application?
    javax.persistence.PersistenceException: No Persistence provider for EntityManager named aPU: Provider named oracle.toplink.essentials.PersistenceProvider threw unexpected exception at create EntityManagerFactory:                     
    oracle.toplink.essentials.exceptions.PersistenceUnitLoadingException                    
    Local Exception Stack:                     
    Exception [TOPLINK-30005] (Oracle TopLink Essentials - 2.0.1 (Build b04-fcs (04/11/2008))): oracle.toplink.essentials.exceptions.PersistenceUnitLoadingException                    
    Exception Description: An exception was thrown while searching for persistence archives with ClassLoader: WebappClassLoader                    
    delegate: true                    
    repositories:                    
    /WEB-INF/classes/                    
    ----------> Parent Classloader:                    
    EJBClassLoader :                     
    urlSet = []                    
    doneCalled = false                     
    Parent -> java.net.URLClassLoader@f66abc                                        
    Internal Exception: javax.persistence.PersistenceException: Exception [TOPLINK-28018] (Oracle TopLink Essentials - 2.0.1 (Build b04-fcs (04/11/2008))): oracle.toplink.essentials.exceptions.EntityManagerSetupException                    
    Exception Description: predeploy for PersistenceUnit [aPU] failed.                    
    Internal Exception: Exception [TOPLINK-7250] (Oracle TopLink Essentials - 2.0.1 (Build b04-fcs (04/11/2008))): oracle.toplink.essentials.exceptions.ValidationException                    
    Exception Description: [class classes.Person] uses a non-entity [class classes.Phone] as target entity in the relationship attribute [private java.util.Collection classes.Person.phoneCollection].                    
    "     at oracle.toplink.essentials.exceptions.PersistenceUnitLoadingException.exceptionSearchingForPersistenceResources(PersistenceUnitLoadingException.java:143)"                    
    "     at oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider.createEntityManagerFactory(EntityManagerFactoryProvider.java:169)"                    
    "     at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:110)"                    
    Caused by: Exception [TOPLINK-28018] (Oracle TopLink Essentials - 2.0.1 (Build b04-fcs (04/11/2008))): oracle.toplink.essentials.exceptions.EntityManagerSetupException                    
    Exception Description: predeploy for PersistenceUnit [aPU] failed.                    
    Internal Exception: Exception [TOPLINK-7250] (Oracle TopLink Essentials - 2.0.1 (Build b04-fcs (04/11/2008))): oracle.toplink.essentials.exceptions.ValidationException                    
    Exception Description: [class classes.Person] uses a non-entity [class classes.Phone] as target entity in the relationship attribute [private java.util.Collection classes.Person.phoneCollection].                    
    "     at oracle.toplink.essentials.exceptions.EntityManagerSetupException.predeployFailed(EntityManagerSetupException.java:228)"                    
    "     ... 87 more"                    
    Caused by: Exception [TOPLINK-7250] (Oracle TopLink Essentials - 2.0.1 (Build b04-fcs (04/11/2008))): oracle.toplink.essentials.exceptions.ValidationException                    
    Exception Description: [class classes.Person] uses a non-entity [class classes.Phone] as target entity in the relationship attribute [private java.util.Collection classes.Person.phoneCollection].                    
    "     at oracle.toplink.essentials.exceptions.ValidationException.nonEntityTargetInRelationship(ValidationException.java:1140)"                    
    "     at oracle.toplink.essentials.internal.ejb.cmp3.metadata.MetadataValidator.throwNonEntityTargetInRelationship(MetadataValidator.java:321)"                         
    "     ... 86 more"                    
    The following providers:                    
    oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider                    
    Returned null to createEntityManagerFactory.                    
    "     at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:154)"                    
    "     at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:83)"                    
    "     at cntrllrs.PersonJpaController.<init>(PersonJpaController.java:33)"

  • Fundamental JSF problem

    I'm using GlassFish 3 (not sure about the release level - where can I see it?), NetBeans 7.1.1, Firefox 3.5.16. I am developing a very simple application using JSF; I have a working sample app (PetCatalog, which comes with NetBeans). As far as I can see my app is almost identical to the sample; but it does not work. This is the general idea: I create a list of users ('listusers') from a database - this works. Each user ID is a commandLink to an edit page ('useredit'). I have created a simple phase listener, from which I get this output:
    Entering phase: RESTORE_VIEW 1. <--- /faces
    Exiting phase: RESTORE_VIEW 1
    Entering phase: RENDER_RESPONSE 6
    Exiting phase: RENDER_RESPONSE 6--->/index.xhtml
    ==================================
    Entering phase: RESTORE_VIEW 1. <--- /faces
    Exiting phase: RESTORE_VIEW 1
    Entering phase: RENDER_RESPONSE 6
    initialise
    Exiting phase: RENDER_RESPONSE 6--->/listusers.xhtml
    ==================================
    Entering phase: RESTORE_VIEW 1. <--- /faces
    Exiting phase: RESTORE_VIEW 1
    Entering phase: RENDER_RESPONSE 6
    initialise
    Exiting phase: RENDER_RESPONSE 6--->/listusers.xhtml
    ==================================
    Entering phase: RESTORE_VIEW 1. <--- /faces
    Exiting phase: RESTORE_VIEW 1
    Entering phase: RENDER_RESPONSE 6
    initialise
    Exiting phase: RENDER_RESPONSE 6--->/listusers.xhtml
    ==================================
    The first entry (until '======') is from the index.xhtml; the second is from when I navigate to listusers. The last two are from clicking on a user ID - they should have called a method that would navigate to useredit, but clearly it just re-initialises listusers (the line with 'initialise' comes from a @PostContruct method).
    I realise that I must have committed some fundamental error somewhere, but I have been over the files again and again, comparing to the PetCatalog app, and I can't spot any significant difference. I would have inserted some code, but there doesn't seem to be a good way of displaying it in this forum - or uploading files.
    Does anybody have any idea what might be the cause of this problem?
    Edited by: janpla on Jun 7, 2012 12:25 AM

    Hi gimbal2,
    Thanks for answering - I hope you are right.
    This is listusers.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:f="http://java.sun.com/jsf/core">
        <h:head>
            <title>STAF User List</title>
        </h:head>
        <h:body>
            <h:outputStylesheet library="css" name="liststyle.css"  />
            <div id="header">
                <h1>STAF Users</h1>
            </div>"
            <div id="content">
                <h:form id="userform">
                    <h:dataTable id="users" value="#{userlist.userList()}" var="ul">
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="[ ]"/>
                            </f:facet>
                            <h:selectBooleanCheckbox id="usercheck" value="#{ul.checked}"/>
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="UID"/>
                            </f:facet>
                            <h:commandLink action="#{userlist.edituser(ul)}" value="#{ul.uid}"/>
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="Name"/>
                            </f:facet>
                            <h:outputText value="#{ul.name}"/>
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="Trust"/>
                            </f:facet>
                            <h:outputText value="#{ul.trust}"/>
                        </h:column>
                    </h:dataTable>
                </h:form>
            </div>
        </h:body>
    </html>
    {code}
    And userlist.java:
    {code}
    package userface;
    import java.io.Serializable;
    import java.util.ArrayList;
    import java.util.Iterator;
    import java.util.List;
    import javax.annotation.PostConstruct;
    import javax.ejb.EJB;
    import javax.enterprise.context.SessionScoped;
    import javax.faces.bean.ManagedBean;
    import userdb.Users;
    import userejb.UserList;
    * @author Jan
    @ManagedBean
    @SessionScoped
    public class userlist implements Serializable{
        private List<ctlruser> ulist=new ArrayList<ctlruser>();
        private String tracer;
        @EJB UserList ul;
        private Integer seluid;
        private useredit ue;
        private String debugstr;
        @PostConstruct
        void initialise(){
            System.out.printf("initialise\n");
            seluid=-1;
            Integer i=0;
            for (Iterator<Users> it = ul.getUlist().iterator(); it.hasNext();) {
                ulist.add(i++,new ctlruser(it.next()));
        public String edituser(ctlruser u){
    //        ue=new useredit(u.getUid());
            System.out.printf("edituser\n");
            return "edituser.xhtml";
        public String getTrace(){
            return tracer;
        public String getDebugstr() {
            return debugstr;
        public List<ctlruser> userList(){
            return ulist;
    {code}
    As you can see, I have commented out the first statement in edituser(), so if it gets called at all, it will print "edituser" - which it doesn't. And, of course, the output from the phase listener confirms this. I can't see where I have done anything wrong - and it's not for want of trying.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • JSF url-pattern *.jsf problem

    Hi all,
    I am working in a project to add the jsf page in the existing jsp application. It uses Apache Tomcat 6.0.18 as the server and eclipse for coding.
    I created a jsf page named index.jsp and I added the code in web.xml as follows
    <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.jsf</url-pattern>
    <session-config>
    <session-timeout>30</session-timeout>
    </session-config>
    </servlet-mapping>
    and when I use the url
    http:localhost:8080/myproject/index.jsf
    Page did not open in the browser and browser reports page not found.
    If I change url-pattern to
    <url-pattern>/faces/* </url-pattern>
    and
    when I use the url
    http:localhost:8080/myproject/faces/index.jsp
    It works.
    What should I want to do to make
    http:localhost:8080/myproject/index.jsf to render in the browser?
    Edited by: mvg90 on Jul 24, 2009 4:22 AM

    BalusC wrote:
    I have no idea. Reinstalling the stuff is definately cumbersome. This is likely just a matter of configuration and/or the way of usage. Hard to say based on the as far given little information (read this how to ask questions the smart way and read this how to provide good code examples representing your actual problem).
    If you want you can of course redo the setup of the environment and the code based on some reliable tutorial / book.I am sorry if my information is not sufficient. What information can I give to solve the problem?

  • JSF PROBLEM With Weblogic

    hello All,
    If I Put this Code in Our JSF File then Weblogic Server Will Go Down.i don't know what the problem in this Code .
    if Any one know please reply me.
    thanks
    reetesh
    <h:panelGroup style="width:30%">
                                  <t:div styleClass="recommendationListDiv">
                                       <h:outputLink styleClass="listicon-book" value="#">
                                            <f:verbatim>Business Plans Made Simple</f:verbatim>
                                       </h:outputLink>
                                       <t:htmlTag value="br"></t:htmlTag>
                                       <h:outputLabel value="#{appMsg.author}" styleClass="subheader"
                                            rendered="true"></h:outputLabel>
                                       <h:outputLabel value="reetesh1 yadav">
                                       </h:outputLabel>
                                       <t:htmlTag value="br"></t:htmlTag>     
                                       <jsp:include page="help.jsp"></jsp:include>
                                       <h:outputLabel value="#{appMsg.publisher}" styleClass="subheader"
                                            rendered="true"></h:outputLabel>
                                       <h:outputLabel value="reetesh1 yadav">
                                       </h:outputLabel>
                                       <h:outputLabel value="#{appMsg.publisher}" styleClass="subheader"
                                            rendered="true">
                                       </h:outputLabel>
                                       <h:outputLabel value="reetesh1 yadav">
                                       </h:outputLabel>
                                  </t:div>
                             </h:panelGroup>

    Logs?

  • JSF Problem Coding

    Hi, i am creating a web pages using JSF technology, I need some one help
    the code is
    <h:selectOneMenu rendered="#{chooselink.checkFullName}" value="#{chooselink.fullName}">
    <f:selectItems value="#{chooselink.namebean}"/>
    </h:selectOneMenu>
    problem is my code is working fine but it is very slow, it take a while to post the result, i did some hard coding, i add
    System.out.println(fullName); to the java bean, and i found out that if i choose one result in namebeam it will repeat it in
    I/0 as much as namebean has records,
    for example, in namebean has 1000 records and i choose one record from it, let say one record is omar, omar in I/0 will repeat 1000 times, that why my system is slowing down
    what should i do

    ok, i will try to explain my problem as specific as i can.
    JSF code is
    <h:selectOneMenu rendered="#{chooselink.checkFullName}" value="#{chooselink.fullName}">
    <f:selectItems value="#{chooselink.namebean}"/>
    </h:selectOneMenu>
    JAVA BEAN code is
    public String processFullName(){
    try {
    DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
    url="jdbc:oracle:thin:@10.2.111.170:1521:testdb";
    conn = DriverManager.getConnection(url, "user","password");
    catch(Exception e){
    System.out.println("Driver not Found");
    try{
    String firstQuery;
    firstQuery = "select id_people peep33, first_nam || ' ' || Last_nam as fullname" +" ";
    firstQuery += "from people" +" ";
    firstQuery += "where first_nam || ' ' || Last_nam =" + "'" + fullName + "'" + " ";
    Statement stat = conn.createStatement();
    address = stat.executeQuery(firstQuery);
    while (address.next())
    idpeepfull = address.getInt("peep33");
    catch(Exception e){
    System.out.println("not working query ------processFullName.java");
    try { 
    String secondQuery;
    secondQuery ="select p.first_nam first, p.last_nam last, pp.man_num man, "+" ";
    secondQuery +="pc.pc_serial serial, pc.pc_model model, pc.pc_mac_add mac, d.dept deptt, pp.room_num room"+" ";
    secondQuery +="from people p, peep2pc pp, pcs pc, departments d, man_id_dept" +" ";
    secondQuery +="where p.id_people = pp.id_peep "+" ";
    secondQuery +="and pp.man_num = pc.man_num "+" ";
    secondQuery +="and pc.man_num = man_id_dept.man_num "+" ";
    secondQuery +="and d.id = man_id_dept.id_dept "+" ";
    secondQuery +="and p.id_people =" + idpeepfull + " ";
    Statement stat = conn.createStatement();
    address = stat.executeQuery(secondQuery);
    while(address.next())
    AllInventory.add(new FullInventory(address.getString("first"),address.getString("last"), address.getString("man"),
    address.getString("serial"), address.getString("model"), address.getString("mac"),
    address.getString("deptt"), address.getString("room")));
    String thirdQuery;
    thirdQuery ="select pm.id, pm.monitors_sn sn, pm.room_num room, m.monitors_name name " + " ";
    thirdQuery +="from peep2monitors pm, monitors m"+ " ";
    thirdQuery +="where pm.monitors_sn = m.monitors_ssn" + " ";
    thirdQuery +="and id = " + idpeepfull + " ";
    address = stat.executeQuery(thirdQuery);
    while(address.next())
    Monitors.add(new monitorInventory(address.getString("name"), address.getString("sn"), address.getString("room")));
    String fourthQuery;
    fourthQuery = "select pp.id_people people, pp.phone_extension ext, p.phone_mac_address address" + " ";
    fourthQuery +="from peep2phones pp, phones p" + " ";
    fourthQuery += " where pp.phone_extension = p.phone_extension" + " ";
    fourthQuery +="and pp.id_people = " + idpeepfull + " ";
    address = stat.executeQuery(fourthQuery);
    while (address.next())
    phones.add(new phoneInventory(address.getString("ext"),address.getString("address")));
    catch(Exception e){
    System.out.println("connection in chooseSearch.java is not working getSerialNum");
    try{
    conn.close();
    catch(Exception e){
    System.out.println("xxxxyx");
    // converting Collection to Array
    int numItems = AllInventory.size();
    int numMonitor = Monitors.size();
    int numPhone = phones.size();
    // create array static inside Array
    myInventory = new FullInventory[numItems];
    myMonitors = new monitorInventory[numMonitor];
    myphones = new phoneInventory[numPhone];
    numItems = 0;
    numMonitor = 0;
    numPhone = 0;
    for (FullInventory x: AllInventory){
    myInventory[numItems] = x;
    numItems ++;
    for (monitorInventory y : Monitors){
    myMonitors[numMonitor] = y;
    numMonitor ++;
    for (phoneInventory z: phones){
    myphones[numPhone] = z;
    numPhone ++;
    if (numItems == 0)
    showStudentTable = false;
    else
    showStudentTable = true;
    return " ";
    My problem is namebean records comes from sql statment, it has up to 1300 records, when i choose one of them and click it to store it into fullName, in I/O will repeat 1300 times, that's take too much time reloading,
    how can i fix that loop?

  • JSF: Problem during Tomcat Startup

    Hi, I am having a strange problem with a JSF-application.
    I am using jdk 1.3.1 (13), Tomcat 5.0.28 and the Sun JSF-Ref. implementation. On my dev-environment all is well. On the system-test environment of the customer, Tomcat would not initialize the FacesServlet claiming that it can not find the faces-config-file.
    I have tries all 3 ways of referencing the config-file (put it into a jar, put faces-config.xml directly into WEB-INF, add a context-param to web.xml with the URI of the file and param-name javax.faces.CONFIG_FILES). All three work fine on my dev, none of them works on sys-test.
    Funny enough, if I use the context-param in web.xml, where the web-app context is ctx, for the URI /WEB-INF/the-faces-config.xml I get an error during startup, for the URI /ctx/WEB-INF/the-faces-config.xml I don't have a problem on startup but the servlet does not actually read the config-file (you can tell from the fact that it can't resolve any of the Bean-methods).
    Any idea would be much appreciated!
    Cheers, Bastian

    Hi, thanks - unfortunately that did not help. The system (in the original configuration) does find the jars ok in WEB-INF/lib (I can tell since there is code in the jar which is executed before the problems hit me and the stack-trace when it can't resolve the bean-methods is from com.sun.faces.el.impl). It looks like the beans are not actually initialized (which is consistent, since the system can't find the config-file which wires the beans).

  • JSF problem on submit event

    Hi to everyone and sorry for my english,
    i've created a web form using jsf tecnology.
    This form contain 2 combo (selectOneMenu) one of this combo contain the region of Italy, so when an user select a region in this combo, on the second combo i'm load the city of this region, for make this i've an onChange event on the first combo this event meke a submit of form, i've also setted the property "immediate" = true.
    So when the first combo chenge value if i've in the form a inputText with property required = "true" the form show me the error message "field required", but i've set immediate = "true"?
    How i can bypass this problem.
    Thanxs a lot,
    Fabio.

    You should still use a value change listener. Putting db calls into your getters should be a last resort anyways. This is because JSF will call getters multiple times, thus causing you to make multiple DB calls.
    Plus, if you don't call renderResponse(), you're going to continue seeing your error message. Setting the immediate attribute doesn't necessarily skip the validation phase, rather, it processes validation in the Apply Request Values phase.
    Anyways, messing with the JSF phases can be a tricky concept for a newer person to understand. However, you should learn what you can about the standard JSF lifecycle.
    Getting to your problem at hand... The quick version is that you need to create a value change listener, attach it to the first combo box (region1), configure the value change listener to retrieve the appropriate values from DB, then set the second combo box (city1) options, and then call renderResponse().
    Here's some code to get you started.
    In your jsp:
    <h:selectOneMenu id="region1" value="#{userBean.selectedRegion1}"
        onchange="submit" immediate="true"
        valueChangeListener="#{userBean.regionSelected}">
    </h:selectOneMenu >In your UserBean class, create the following method:
         public void regionSelected(ValueChangeEvent event)
              throws AbortProcessingException {
              //Get the selected region from the event
              String region = (String)event.getNewValue();
              //Set the selected region in your bean
              setSelectedRegion(region);
              //Call DB to retrieve the city list for the selected region
              //Build Select Items list from record set
              //Set the city list with the new select items
              setCityList(newCityList);
              //Force to render response phase so that any error messages DO NOT get
              //displayed. i.e. Skip update model phase. Use immediate="true" on the
              //component that calls this valueChangeListener so that it does not
              //run any validation.
              FacesContext.getCurrentInstance().renderResponse();
         }That should get you good and started.
    CowKing

  • JSF Problem with events

    4 comboboxes need to be used in several JSF pages.
    This cbo are stored in the jspf file :
    <%@ taglib prefix="f" uri="http://java.sun.com/jsf/core" %>
    <%@ taglib prefix="h" uri="http://java.sun.com/jsf/html" %>
    <f:subview id="cboSearch">
        <p>
            <h:selectOneMenu id="cboSites" value="#{searchFormMB.siteChoisi}"
                              onchange="submit()" valueChangeListener="#{searchFormMB.eventCboSitesChanged}">
                <f:selectItems id="siteItem" value="#{searchFormMB.siteItems}"/>
            </h:selectOneMenu>
        </p>
        <p>
            <h:selectOneMenu id="cboPeriodes" value="#{searchFormMB.periodeChoisie}"
                             onchange="submit()" valueChangeListener="#{searchFormMB.eventCboPeriodesChanged}">
                <f:selectItems id="periodeItem" value="#{searchFormMB.periodeItems}"/>
            </h:selectOneMenu>
        </p>
        <p>
            <h:selectOneMenu id="cboPersonnels" value="#{searchFormMB.auteurChoisi}"
                             onchange="submit()" valueChangeListener="#{searchFormMB.eventCboPersonnelsChanged}">
                <f:selectItems id="personnelItem" value="#{searchFormMB.personnelItems}"/>
            </h:selectOneMenu>
        </p>
        <p>
            <h:selectOneMenu id="cboEssais" value="#{searchFormMB.essaiChoisi}" binding="#{searchFormMB.cboEssai}"
                             onchange="submit()" valueChangeListener="#{searchFormMB.eventCboEssaiChanged}">
                <f:selectItems id="essaiItem" value="#{searchFormMB.essaiItems}"/>
            </h:selectOneMenu>
        </p>
    </f:subview>The problem is with the last cbo (id="cboEssais") since "#{searchFormMB.eventCboEssaiChanged}" is called for the active page and for all previous pages. That means it is called once for the first page visited, twice for the second page visited, three time for the third page visited, ...
    Any idea about this problem ? Thanks

    When i change page valueChangeListener fired at stage RENDER_RESPONSE 6 and when cbo is change valueChangeListener fired at stage PROCESS_VALIDATIONS 3.
    In both cases the number of successive fires (call of valueChangeListener) is equal to the number of (re)visited pages since beginning of the session.

  • Jsf problem go from jsp page to another jsp in new window

    I’ve two jsp pages attendReport.jsp and printAttendReport.jsp
    attendReport.jsp contains inputs for attend duration and employee id and command button “view” to view attendance data entered employee during entered duration inside the same page(this work very good)
    the problem is the same page includes another command button “print” its job is to get the same data but view them in the second page printAttendReport.jsp in another window in order to print the data in some suitable format , but the print button opens attendReport.jsp instead of printAttendReport.jsp and does not hold the inputs else if I set <managed-bean-scope> to session not request which cause caching data , please help me if you to solve this problem
    and here the related lines of code
    <faces-config >
    <managed-bean>
    <managed-bean-name>attendReportBean</managed-bean-name>
    <managed-bean-class>csc.attend.bean.AttendReportBean</managed-bean-class>
    <managed-bean-scope>request</managed-bean-scope>
    </managed-bean>
    <navigation-rule>
    <from-view-id>/attend/attendReport.jsp</from-view-id>
    <navigation-case>
    <from-action>#{AttendReportBean.attendReport}</from-action>
    <from-outcome>attendReport</from-outcome>
    <to-view-id>/attend/attendReport.jsp</to-view-id>
    </navigation-case>
    </navigation-rule>
    <navigation-rule>
    <from-view-id>/attend/attendReport.jsp</from-view-id>
    <navigation-case>
    <from-action>#{AttendReportBean.printAttendReportAction}</from-action>
    <from-outcome>printAttendReportAction</from-outcome>
    <to-view-id>/attend/printAttendReport.jsp</to-view-id>
    </navigation-case>
    </navigation-rule>
    </faces-config> // here is managed bean code
    public class AttendReportBean {
    // data , getters and setters
    init();
    //Preload in initialization block.
    public void init() {
    // initialize data
    public String attendReport() {
    // code to get attend data to go to view page(same page) it is ok
    return "attendReport"; // Navigation case.
    public static String getRequestParameter(String name) {
    return (String) FacesContext.getCurrentInstance().getExternalContext()
    .getRequestParameterMap().get(name);
    public void printAttendReportListener(ActionEvent event) {
    String fromYearStr = getRequestParameter("fromYearAtt");
    System.out.println("fromYearStr = "+fromYearStr);
    // try to get inputs through ActionListener but it gives me null
    public String printAttendReportAction() {
    // code to get attend data to go to print page(another page in new //window) but inputs come in default values
    return "printAttendReportAction"; // Navigation case.
    }attendReport.jsp
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
    <f:view>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    //title . styles and validations //
    </head>
    <body>
    <h:form id="attendReportForm">/the form tag appear in running source as <form id="attendReportForm" method="post" action="/newdiwan/faces/attend/attendReport.jsp" enctype="application/x-www-form-urlencoded" >
    i.e. it always submit to attendReport.jsp page
    / some inputs and outputs /
    <h:commandButton onclick="return check();" id="view" action="#{attendReportBean.attendReport}" value="" styleClass="linksNumBlue" />//it works good/
    // some outputs to view data /
    <h:commandLink immediate="true" id="printLink" value="" action="#{attendReportBean.printAttendReportAction}" actionListener="#{attendReportBean.printAttendReportListener}" target="_blank" styleClass="linksNumBlue">
        <f:attribute  name="fromYearAtt" value="2009" />
        <f:attribute  name="fromMonth" value="01" />
       <f:attribute  name="toYear" value="2010" />
       <f:attribute  name="toMonth" value="06" />
    </h:commandLink>//this has two problems 1)submit to attendReport.jsp not printAttendReport.jsp which I want to go to.
    //2)does not get the inputs but return the default values only /
    </h:form></body></html></f:view>I use libraries { jsf-api.jar , jsf-impl.jar , jstl-1.1.0.jar and tomahawk-1.1.6.jar } and deploy on tomcat 6.0
    I’m sorry for the prolongation, please help me if you can
    Edited by: alynoor on Jul 8, 2010 1:51 AM
    Edited by: alynoor on Jul 8, 2010 1:55 AM

    my problem solved 1- i use 2 managed bean , one of request scope (used in attendReport.jsp ) and the other with session scope (used in printAttendReport.jsp)
    2 - add new jsp contains the h:commandLink of the print (attendReportPrintAction.jsp)
    3 - divide the view of attendReport.jsp to two subviews (each subview has its own form) one contains inputs and outputs of attend and the other contains include to (attendReportPrintAction.jsp)
    <%@ include file="attendReportPrintAction.jsp" %>
    4 - send and get parameters using two methods
                public static Object getSessionMapValue(String key) {
                   return FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get(key);
                public static void setSessionMapValue(String key, Object value) {
                   FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put(key, value);
                }faces-config.xml
       <managed-bean>
          <managed-bean-name>attendReportBean</managed-bean-name>
          <managed-bean-class>csc.attend.bean.AttendReportBean</managed-bean-class>
          <managed-bean-scope>request</managed-bean-scope>
       </managed-bean>
        <managed-bean>
          <managed-bean-name>print_attendReportBean</managed-bean-name>
          <managed-bean-class>csc.attend.bean.AttendReportBean</managed-bean-class>
          <managed-bean-scope>session</managed-bean-scope>
       </managed-bean>
    <navigation-rule>  
        <display-name>viewReport</display-name>  
        <from-view-id>/attend/attendReport.jsp</from-view-id>  
        <navigation-case>  
            <from-action>#{AttendReportBean.attendReport}</from-action>
            <from-outcome>attendReport</from-outcome>  
            <to-view-id>/attend/attendReport.jsp</to-view-id>  
        </navigation-case>  
    </navigation-rule>
    <navigation-rule>  
        <display-name>printReport</display-name>
        <from-view-id>/attend/attendReport.jsp</from-view-id>  
        <navigation-case>  
            <from-outcome>printAttendReportAction</from-outcome>  
            <to-view-id>/attend/printAttendReport.jsp</to-view-id>  
        </navigation-case>  
    </navigation-rule>attendReportPrintAction.jsp
    <f:subview id="printAttendReportSubView" >
    <h:form id="printAttendReportForm" onsubmit="return check222();" >
                                <table width="100%" border="0" cellpadding="0" cellspacing="0">
                                  <tr>
                                    <td width="11%">
                                    <table width="70" border="0" cellpadding="0" cellspacing="0">
                                        <tr>
                                          <td width="7" height="28"><img src="../images/B-left.gif" width="7" height="28" /></td>
                                          <td align="center" background="../images/B-bg.gif">
                                            <!--a href="printAttendReport.jsp" class="linksNumBlue" target="_blank" >&#1591;&#1576;&#1575;&#1593;&#1577;</a-->
    <h:commandLink id="printLink" value="&#1591;&#1576;&#1575;&#1593;&#1577;" title="&#1591;&#1576;&#1575;&#1593;&#1577;"  action="#{print_attendReportBean.printAttendReportAction}"   target="_blank"  styleClass="linksNumBlue">
                                        </h:commandLink>
                                            </td>
                                          <td width="7" height="28"><img src="../images/B-right.gif" width="7" height="28" /></td>
                                        </tr>
                                      </table>
                                      </td>
                                    <td align="right"> </td>
                                  </tr>
                                </table>
    </h:form>
    </f:subview>i hope this helps someone

  • JSF problem Session Scoped and dialog

    Hello All! i have one problem with using ajax and session scoped .
    I'm using JSF 2.0 and Primefaces for build 2 dialog.
    I have one icon to click on it dialog 1 will display and show all list of customers and when i click details of customer on dialog 1, dialog 2 will display , and details of customer show base on <h:form>
    but my problem is when i click details of customer with id #1 it not show details of customer it return null, i must refresh this page and click on customer #1 and it display, but when i click on customer with id #3 it still display customer with id #1,and i must refresh page again to view customer with id #3 and after that if i want see details of other customer such as customer with id #5 i must click and refresh page, after refresh page i click on any id of customer if always show the last id of customer before refresh page, it mean because i use p:commandButton with ajax and 2 dialog inside one page, i know , if using session scoped i must pass value from one page to another page. But i want get id in the same page with session scoped this mean when i use p:commandButton call dialog 2 for pass id value from dialog one to dialog two it will get value don't refresh page . How can i do it? or can i call dialog from another show on the same page contain dialog 1?
    Primefaces dialog http://www.primefaces.org/showcase/ui/dialogHome.jsf

    Hello All! i have one problem with using ajax and session scoped .
    I'm using JSF 2.0 and Primefaces for build 2 dialog.
    I have one icon to click on it dialog 1 will display and show all list of customers and when i click details of customer on dialog 1, dialog 2 will display , and details of customer show base on <h:form>
    but my problem is when i click details of customer with id #1 it not show details of customer it return null, i must refresh this page and click on customer #1 and it display, but when i click on customer with id #3 it still display customer with id #1,and i must refresh page again to view customer with id #3 and after that if i want see details of other customer such as customer with id #5 i must click and refresh page, after refresh page i click on any id of customer if always show the last id of customer before refresh page, it mean because i use p:commandButton with ajax and 2 dialog inside one page, i know , if using session scoped i must pass value from one page to another page. But i want get id in the same page with session scoped this mean when i use p:commandButton call dialog 2 for pass id value from dialog one to dialog two it will get value don't refresh page . How can i do it? or can i call dialog from another show on the same page contain dialog 1?
    Primefaces dialog http://www.primefaces.org/showcase/ui/dialogHome.jsf

Maybe you are looking for

  • Expression using Map access not working....

    I am attempting to use the ability to access a Map by key from a binding expression on the jsp. I have extended HashMap and overridden the get method in order to return a Boolean from the get(key) method. This works: rendered="#{bean.enabledFunctionS

  • Another bootcamp issue

    Hey everyone. I'm having an issue running windows 7 on bootcamp. I install it, everything works install a few things restart it then suddenly when I go on it the computer gets stuck at the 'starting windows' screen. The first time I installed the dri

  • Appleworks Opens Documents as Spreadsheets

    I did a quick search of the forum and didn't find anything on this... I hope somebody has a quick solution, because I'm going to bust a big deadline if I can't figure it out. Appleworks is suddenly opening document files as spreadsheets. Background:

  • GetTransaction.connect() method

    Hi all, I'd like to know if calling the method getTransaction.connect() from an Application Module instance causes the beginning of the transaction, or simply starts the connection to the database. I call the method from an Application Module deploye

  • How use Jndi datasoure in Jserver?

    Hi, I want to deploy EJB to jserver. The EJB use JNDI jdbc2.0 datasource to access database. But there only are some sujects how to use JNDI jdbc datasoure in client application in oracle8i 8.1.6 jdbc 2.0 document, no in Jserver. Which one could tell