AnsweredAssumed Answered

Sidebar don't accept jsf

Question asked by haridasi on Apr 7, 2009
I'm currently trying to develop a sidebar plugin containing a search form that shall redirect the whole page to another website, but I receive a javax.faces.FacesException: java.lang.IllegalStateException (complete error message below, #Error1) when defining an <h:form> in my jsp. If I try <f:verbatim> it generates the same error if I click a little around Alfresco while having my sidebar plugin active.

The IllegalStateException only occur when my plugin is active.

If I try to add a <f:view> in my jsp, I get an error stating Stream Closed (complete error description #Error2).

The third option is to just put regular html in there, but unfortunately pure html is displayed outside the sidebar.

The fourth try was to use webscripts and that also produce IllegalStateException and all I have in the jsp is:

<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %>
<r:webScript scriptUrl="/service/mwsearch" />

mwsearch.get.html.ftl:

<div style="width=200px">
            <input id="search" type="text" value="Search Mediawiki" />
            <img title="Search" onclick="window.location='http://localhost/wiki/index.php/Special:Search?search=' + document.getElementById('search').value;" style="cursor: pointer;" src="http://localhost:8080/alfresco/images/icons/search_icon.gif'/>
    </div>

If I define the following in my jsp, there is a post of some sort, but it just goes back to where I was in alfresco:


<script type="text/javascript">
        function submitMWSearch() {

            sform = document.getElementById('browse');
            orgaction = sform.action;
            alert(document.getElementById('dashboard:sidebar-body:mwtarget').value);
            sform.action = document.getElementById('dashboard:sidebar-body:search').value;
            sform.submit();
            sform.action = orgaction;
        }

</script>

<h:inputHidden id="mwtarget" value="#{AlfrescoSearchBean.target}"/>
<h:inputText id="search" value="Search MediaWiki" />
<h:commandButton id="submit" onclick="submitMWSearch();" value="Submit" />

Why doesn't alfresco allow me to define my own forms and use them?
What is the best way of solving my problem?
(And yes, I do know of OpenSearch, I'm just not allowed to use it - don't ask!)

#Error1:
javax.faces.FacesException: java.lang.IllegalStateException: Client-id : _idJsp13 is duplicated in the faces tree. Component : browse:_idJsp13, path: {Component-Path : [Class: javax.faces.component.UIViewRoot,ViewId: /jsp/browse/browse.jsp][Class: javax.faces.component.html.HtmlForm,Id: browse][Class: org.alfresco.web.ui.common.component.UIPanel,Id: spaces-panel][Class: org.alfresco.web.ui.common.component.data.UIRichList,Id: spacesList][Class: org.alfresco.web.ui.common.component.data.UIColumn,Id: col1][Class: org.alfresco.web.ui.common.component.UIActionLink,Id: col1-act1][Class: javax.faces.component.UIParameter,Id: _idJsp13]}
caused by:
org.apache.jasper.JasperException: java.lang.IllegalStateException: Client-id : _idJsp13 is duplicated in the faces tree. Component : browse:_idJsp13, path: {Component-Path : [Class: javax.faces.component.UIViewRoot,ViewId: /jsp/browse/browse.jsp][Class: javax.faces.component.html.HtmlForm,Id: browse][Class: org.alfresco.web.ui.common.component.UIPanel,Id: spaces-panel][Class: org.alfresco.web.ui.common.component.data.UIRichList,Id: spacesList][Class: org.alfresco.web.ui.common.component.data.UIColumn,Id: col1][Class: org.alfresco.web.ui.common.component.UIActionLink,Id: col1-act1][Class: javax.faces.component.UIParameter,Id: _idJsp13]}
caused by:
java.lang.IllegalStateException: Client-id : _idJsp13 is duplicated in the faces tree. Component : browse:_idJsp13, path: {Component-Path : [Class: javax.faces.component.UIViewRoot,ViewId: /jsp/browse/browse.jsp][Class: javax.faces.component.html.HtmlForm,Id: browse][Class: org.alfresco.web.ui.common.component.UIPanel,Id: spaces-panel][Class: org.alfresco.web.ui.common.component.data.UIRichList,Id: spacesList][Class: org.alfresco.web.ui.common.component.data.UIColumn,Id: col1][Class: org.alfresco.web.ui.common.component.UIActionLink,Id: col1-act1][Class: javax.faces.component.UIParameter,Id: _idJsp13]}

#Error2
javax.faces.FacesException: javax.servlet.ServletException: javax.servlet.jsp.JspException: Stream closed
caused by:
org.apache.jasper.JasperException: javax.servlet.ServletException: javax.servlet.jsp.JspException: Stream closed
caused by:
javax.servlet.ServletException: javax.servlet.jsp.JspException: Stream closed
caused by:
java.io.IOException: Stream closed

Outcomes