1 Reply Latest reply on Apr 24, 2008 2:06 PM by bostone

    Error: xml declaration not at start of external entity

    bostone

      Hi I'm trying to submit search value and populate datatable with results. I'll put the sourcecode below but here what happens when I click submit button
      1. I will see JS error in firebug

      xml declaration not at start of external entity
      [Break on this error] undefined
      userGroupRole.fac... (line 13)

      That line 13 in case you wonder resolves to the following when I click on the error in firebug
      <script language="javascript1.2" src="./javascript/javascript.js" type="text/javascript"><!--
      
      //--></script>

      2. Visually, nothing changes in the modal dialog. However if I reload the page and call modal again - I will see the form table populated with search data.
      3. Also if I remove ajaxSubmit="true" from a4j:form, on submit form gets populated, no error is issued but of course due to the page being reloaded my modal is gone and I have to unhide it to see the results.
      Here's complete source for the xhtml page. I initially had the pop-up form in its own xhtml but decided to do the least complicated case first. The pop-up is defined at the bottom of the page

      <?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:ui="http://java.sun.com/jsf/facelets"
       xmlns:h="http://java.sun.com/jsf/html"
       xmlns:f="http://java.sun.com/jsf/core"
       xmlns:a4j="http://richfaces.org/a4j"
       xmlns:rich="http://richfaces.org/rich"
       xmlns:s="http://myfaces.apache.org/sandbox"
       xmlns:t="http://myfaces.apache.org/tomahawk"
       xmlns:c="http://java.sun.com/jstl/core">
      <head>
      <script language="javascript1.2" src="./javascript/shuttle.js"
       type="text/javascript"></script>
      </head>
      <body>
      <ui:composition template="/WEB-INF/layout/layout.xhtml">
       <ui:define name="title">
       Admin - Users Groups and Roles
       </ui:define>
       <ui:define name="content">
       <a4j:region selfRendered="true">
       <h:form id="userGroupRoleForm">
       <a4j:outputPanel ajaxRendered="true">
       <ui:include src="messages.xhtml" />
       <h:messages layout="table" showSummary="true" showDetails="true"
       style="width: 100%" />
       </a4j:outputPanel>
       <div>
       <h1>User Account Management</h1>
       <h:panelGrid columnClasses="header" border="0" cellpadding="0"
       cellspacing="0" width="100%">
       <h:outputText value="NAMS User Account Management" />
       </h:panelGrid>
      
       <div id="msgLabel"><h:panelGrid columns="4"
       styleClass="detail" columnClasses="label">
       <h:outputText value="Users" />
       <h:selectOneMenu id="userList"
       value="#{userGroupRoleBean.selectedUser}"
       converter="#{namsUserConverter}">
       <f:selectItem itemValue="#{userGroupRoleBean.defaultUser}"
       itemLabel="New" />
       <f:selectItems value="#{userGroupRoleBean.users}" />
       <a4j:support action="#{userGroupRoleBean.select}" event="onchange"
       ajaxSingle="true"
       reRender="bemsId,name,comments,
       listNamsRoles,listUserRoles,listNamsGroups,
       listUserGroups,userAppStat,btnDelete" />
       </h:selectOneMenu>
       <h:outputText value="" />
       <h:outputText value="" />
       </h:panelGrid> <h:panelGrid columns="4" styleClass="detail" columnClasses="label">
      
       <h:outputLabel>
       <h:outputText id="lblBemsid" value="BemsId"
       rendered="#{userGroupRoleBean.newMode}" />
       <h:outputText style="color: #DD0707" value=" * "
       rendered="#{userGroupRoleBean.newMode}" />
       </h:outputLabel>
       <h:inputText id="bemsId" size="25" style="width: 175px"
       styleClass="required min-3 is-not-new is-not-duplicate"
       required="true" value="#{userGroupRoleBean.bemsId}"
       disabled="#{userGroupRoleBean.editUserFlag}">
       <a4j:support action="#{userGroupRoleBean.lookupUserName}"
       event="onblur" reRender="name" />
       </h:inputText>
       <h:commandButton id="lookupUser" value="Lookup User"
       immediate="true" onclick="return false" styleClass="button" />
      
       <rich:componentControl for="userSearchPanel" attachTo="lookupUser"
       operation="show" event="onmousedown" />
       <h:outputText value="" />
       <h:message for="bemsId" id="userBemsIdError"
       errorClass="validation-advice" errorStyle="display:block" />
       </h:panelGrid> <h:panelGrid columns="4" styleClass="detail" columnClasses="label">
      
       <h:outputLabel>
       <h:outputText id="lblName" value="Name" />
       <h:outputText style="color: #DD0707" value=" * " />
       </h:outputLabel>
       <h:inputText id="name" size="25" maxlength="50"
       value="#{userGroupRoleBean.name}" disabled="true" />
       <h:outputText value="" />
       <h:outputText value="" />
       </h:panelGrid> <h:panelGrid columns="4" styleClass="detail" columnClasses="label">
      
       <h:outputText value="Status" />
       <h:selectOneMenu id="userAppStat"
       value="#{userGroupRoleBean.selectedUser.status}">
       <f:selectItem itemLabel="Active" itemValue="A" />
       <f:selectItem itemLabel="Inactive" itemValue="I" />
       <a4j:support event="onfocus" reRender="appContactList" />
       </h:selectOneMenu>
       <h:outputText value="" />
       <h:outputText value="" />
      
       </h:panelGrid></div>
       <h:panelGrid columns="4" styleClass="detail" columnClasses="label">
       <h:outputText value="Comments" />
       <h:inputTextarea id="comments" cols="40" rows="5"
       value="#{userGroupRoleBean.selectedUser.comments}" />
       <h:outputText value="" />
       <h:outputText value="" />
       </h:panelGrid> <h:outputText value="" /> <f:verbatim>
       <br />
       </f:verbatim><h:outputText value="" /> <rich:simpleTogglePanel
       switchType="client" label="Assign Roles and Groups">
       <div class="shuttle"><!-- Shuttle control starts -->
       <div id="listBoxTable"><h:panelGrid columns="3"
       styleClass="detail" cellspacing="1" cellpadding="1" width="30%">
      
       <h:outputLabel>
       <h:outputText value="Nams Roles" />
       </h:outputLabel>
       <h:panelGrid columns="1">
       <f:verbatim> </f:verbatim>
       </h:panelGrid>
       <h:outputLabel>
       <h:outputText value="User Roles" />
       </h:outputLabel>
       <h:selectManyListbox id="listNamsRoles"
       value="#{userGroupRoleBean.selectedNamsRoles}"
       converter="#{roleConverter}">
       <f:selectItems value="#{userGroupRoleBean.namsRoles}" />
       </h:selectManyListbox>
      
       <h:panelGrid columns="1" cellspacing="1" cellpadding="1">
       <div>
       <button id="moveAllR" title="Move all right">>></button>
       </div>
       <div>
       <button id="moveR" title="Move selected right">></button>
       </div>
       <div>
       <button id="moveL" title="Move selected left"><</button>
       </div>
       <div>
       <button id="moveAllL" title="Move all left"><<</button>
       </div>
       </h:panelGrid>
      
       <h:selectManyListbox id="listUserRoles"
       value="#{userGroupRoleBean.selectedUserRoles}"
       converter="#{roleConverter}">
       <f:selectItems value="#{userGroupRoleBean.userRoles}" />
       </h:selectManyListbox>
      
       <h:outputLabel>
       <h:outputText value="Nams Groups" />
       </h:outputLabel>
       <h:panelGrid columns="1">
       <f:verbatim> </f:verbatim>
       </h:panelGrid>
       <h:outputLabel>
       <h:outputText value="User Groups" />
       </h:outputLabel>
       <h:selectManyListbox id="listNamsGroups"
       value="#{userGroupRoleBean.selectedNamsGroups}"
       converter="#{groupConverter}">
       <f:selectItems value="#{userGroupRoleBean.namsGroups}" />
       </h:selectManyListbox>
      
       <h:panelGrid columns="1" cellspacing="1" cellpadding="1">
       <div>
       <button id="moveGroupAllR" title="Move all right">>></button>
       </div>
       <div>
       <button id="moveGroupR" title="Move selected right">></button>
       </div>
       <div>
       <button id="moveGroupL" title="Move selected left"><</button>
       </div>
       <div>
       <button id="moveGroupAllL" title="Move all left"><<</button>
       </div>
       </h:panelGrid>
      
       <h:selectManyListbox id="listUserGroups"
       value="#{userGroupRoleBean.selectedUserGroups}"
       converter="#{groupConverter}">
       <f:selectItems value="#{userGroupRoleBean.userGroups}" />
       </h:selectManyListbox>
      
       <h:inputHidden id="selectedUserRoles"
       value="#{userGroupRoleBean.selectedUserRoles}"
       converter="#{deviceTypeRolesConverter}" />
      
       <h:inputHidden id="selectedUserGroups"
       value="#{userGroupRoleBean.selectedUserGroups}"
       converter="#{namsGroupsConverter}" />
      
      
      
       </h:panelGrid></div>
       </div>
       <script language="JavaScript">
       // enable validation
       new Validation('userGroupRoleForm', {immediate:true});
       // add ajax validation for duplicate name
      
       </script>
       <!-- Shuttle JS -->
       <script language="JavaScript">
       var shuttle;
       var shuttleGroup;
       window.onload = function() {
       shuttle = new NamsShuttle(
       "userGroupRoleForm:listNamsRoles",
       "userGroupRoleForm:listUserRoles",
       "userGroupRoleForm:selectedUserRoles",
       "moveAllR",
       "moveR",
       "moveL",
       "moveAllL",
       true
       );
      
       shuttleGroup = new NamsShuttle(
       "userGroupRoleForm:listNamsGroups",
       "userGroupRoleForm:listUserGroups",
       "userGroupRoleForm:selectedUserGroups",
       "moveGroupAllR",
       "moveGroupR",
       "moveGroupL",
       "moveGroupAllL",
       true
      
       );
      
       shuttle.init();
       shuttleGroup.init();
      
       document.userGroupRoleForm.moveR.onclick = function() {
       shuttle.moveRight();
       return false;
       };
      
       document.userGroupRoleForm.moveL.onclick = function() {
       shuttle.moveLeft();
       return false;
       };
      
       document.userGroupRoleForm.moveAllR.onclick = function() {
       shuttle.moveAllRight();
       return false;
       };
      
       document.userGroupRoleForm.moveAllL.onclick = function() {
       shuttle.moveAllLeft();
       return false;
       };
      
       document.userGroupRoleForm.moveGroupR.onclick = function() {
       shuttleGroup.moveRight();
       return false;
       };
      
       document.userGroupRoleForm.moveGroupL.onclick = function() {
       shuttleGroup.moveLeft();
       return false;
       };
      
       document.userGroupRoleForm.moveGroupAllR.onclick = function() {
       shuttleGroup.moveAllRight();
       return false;
       };
      
       document.userGroupRoleForm.moveGroupAllL.onclick = function() {
       shuttleGroup.moveAllLeft();
       return false;
       };
       };
      
       </script>
       <!-- Shuttle control ends -->
       </rich:simpleTogglePanel>
       <div><h:panelGroup styleClass="buttonBar">
       <h:commandButton id="btnSave" value="Save"
       onclick="shuttleGroup.setSelected(); return shuttle.setSelected();"
       action="#{userGroupRoleBean.update}" styleClass="button" />
       <h:commandButton id="btnDelete" value="Delete"
       action="#{userGroupRoleBean.delete}"
       disabled="#{userGroupRoleBean.deleteBtnMode}"
       onclick="shuttleGroup.setSelected(); shuttle.setSelected(); return confirmDelete('userGroupRoleForm','name');"
       styleClass="button" />
       <h:commandButton id="btnReset" value="Reset" type="reset"
       immediate="true" styleClass="button" />
       </h:panelGroup></div>
      
       </div>
       </h:form>
       </a4j:region>
       <!-- Usear search pop-up -->
       <rich:modalPanel id="userSearchPanel" width="400" height="350">
       <f:facet name="header">
       <h:outputText value="User Lookup" />
       </f:facet>
       <f:facet name="controls">
       <h:panelGroup>
       <h:graphicImage value="/images/close.png" style="cursor:pointer"
       id="hidelink" />
       <rich:componentControl for="userSearchPanel" attachTo="hidelink"
       operation="hide" event="onclick" />
       </h:panelGroup>
       </f:facet>
       <a4j:form id="userLookupForm" ajaxSubmit="true">
       <div id="msgLabel"><h:panelGrid columns="3"
       styleClass="detail" columnClasses="label">
       <h:outputLabel>
       <h:outputText value="Search For" />
       </h:outputLabel>
       <h:inputText id="searchStr" size="25"
       value="#{userLookupBean.searchStr}" />
       <h:commandButton id="searchBtn" value="Search"
       styleClass="button" reRender="userSearchResults" />
       </h:panelGrid></div>
       <h:panelGrid columns="2" id="searchHelp" width="100%">
       <h:outputLabel id="bluesString">
       <h:outputText style="color: #DD0707"
       value="Search by BemsId or lastname or lastname,firstname"
       rendered="#{contactBean.bluesFlag}" />
       </h:outputLabel>
       </h:panelGrid>
       <a4j:outputPanel>
       <h:dataTable value="#{userLookupBean.userSearchList}"
       var="searchList" id="userSearchResults" styleClass="list"
       rowClasses="odd,even" cellpadding="0" cellspacing="0" width="30%">
      
       <h:column>
       <f:facet name="header">
       <h:outputText value="Name" />
       </f:facet>
       <h:outputLink title="#{searchList.fullName}"
       onmousedown="update(this.title,#{searchList.namsEmployee.bemsid});"
       value="#{searchList.namsEmployee.bemsid}" onclick="return false">
       <h:outputText value="#{searchList.fullName}" />
       </h:outputLink>
       </h:column>
      
       <h:column>
       <f:facet name="header">
       <h:outputText value="BemsId" />
       </f:facet>
       <h:outputLink
       value="http://card.web.boeing.com/webcard.cfm?id=#{searchList.namsEmployee.bemsid}"
       target="_blank">
       <h:outputText value="#{searchList.namsEmployee.bemsid}" />
       </h:outputLink>
       </h:column>
       <h:column>
       <f:facet name="header">
       <h:outputText value="Phone" />
       </f:facet>
       <h:outputText value="#{searchList.namsEmployee.phone}" />
       </h:column>
       </h:dataTable>
       </a4j:outputPanel>
       </a4j:form>
       <div><h:outputLink value="#" id="link">
       Hide
       <rich:componentControl for="userSearchPanel" attachTo="link"
       operation="hide" event="onclick" />
       </h:outputLink></div>
       </rich:modalPanel>
       </ui:define>
      </ui:composition>
      
      </body>
      </html>