cancel
Showing results for 
Search instead for 
Did you mean: 

Custom JSP for search page

fararjeh
Champ in-the-making
Champ in-the-making
Hi


Can I define custom JspPage used for rendering page instead default page ? If yes I can, So how I can create it ? and I will be thankful to you , If you give me an example for it .

Regards
6 REPLIES 6

d_evil
Champ in-the-making
Champ in-the-making
Hi,

search for JspFormsTest.xml in your deployment, that is an example for JSP based UI rendering.

<storedsearch>
<searchspec>

   <jsppage>demo/JspFormularTest.jsp</jsppage>

Pretty easy, define your referenced JSP in search template and then create the JSP with wanted layout.

fararjeh
Champ in-the-making
Champ in-the-making
Hi D.evil


Thank you for reply and I'm sorry for delay to reply you ,About JSP page, I created custom Jsp But when it rendered the page shows me an error " Criteria not found: {cmis:folder.cmis:name} " .

[img=500x400]https://forums.alfresco.com/sites/forums/files/error.png[/img]

d_evil
Champ in-the-making
Champ in-the-making
Hi farajeh,

I can reproduce the problem, but don't understand why it happens.
Good news is that I have a workaround for you
<blockcode>
<whereprop editproperty="editable" uniquename="first" symname="cmis:document.cmis:name" />
</blockcode>
use the uniquename attribute to define explicit Id for the search criteria.
And then define in the JSP the corresponding uniquename representation
<blockcode>
<td class="DefaultInput"><%m_View.renderNamedRegion(out, "first");%></td>
</blockcode>
That should allow you to render corresponding input fields.

fararjeh
Champ in-the-making
Champ in-the-making
Thank you to reply , I try your solution But it didn't work , This is my configuration if I forget any config please tell me .

JSP page:

<%@ page import="com.wewebu.ow.server.ui.*,com.wewebu.ow.server.app.*,com.wewebu.ow.server.util.*,com.wewebu.ow.server.plug.owsearch.*"
   autoFlush="true" pageEncoding="utf-8" language="java" contentType="text/html; charset=utf-8"%>

<%
    // get a reference to the calling view
    OwView m_View = (OwView) request.getAttribute(OwView.CURRENT_MODULE_KEY);
%>

<div id="OwDemoSearchForm">
   <div id="OwDemoSearchForm_Header">
      
   </div>

   <!– Main area –>
   <div id="OwDemoSearchForm_MAIN">               
      <table class="OwFormTable OwNowrapLabel"  style="direction: rtl;width:100%;">
         <tr>
            <td class="OwPropertyName">   
               <label>الرقم العام</label>
            </td>
            <td class="DefaultInput" ><%m_View.renderNamedRegion(out,"name"); %></td>
         </tr>
         <tr>
            <td class="OwPropertyName">
               <label><%=m_View.getContext().localize("owlabel.F:kaad:employee.kaad:employeePrivateNumber","")%></label>
            </td>
             <td class="DefaultInput"><%m_View.renderNamedRegion(out, "employeePrivateNumber");%></td>

         </tr>
      </table>
      <br/>
   </div>
</div>


XML file :


<?xml version="1.0" encoding="UTF-8" ?>
<storedsearch>
   <searchspec versionselection="allversions">
      <!–
         currentversion,allversions,releasedversion,checkedoutversion,inprocessversion,majorversions,minorversions
      –>
      <searchclauses>
         <select>
            <selectprops>
               <selectprop symname="cmis:folder.cmis:name" />
                <selectprop symname="F:kaad:employee.kaad:employeePrivateNumber" />
            </selectprops>
            
         </select>
         <from>
            <class symname="folder" />
         </from>
         <where>
            <and>
               <eq>
                  <whereprop editproperty="editable" uniquename="name" symname="cmis:folder.cmis:name" />
               </eq>
               <eq>
                  <whereprop editproperty="editable" uniquename="employeePrivateNumber" symname="F:kaad:employee.kaad:employeePrivateNumber" />
               </eq>      
            </and>
         </where>
         <subclasses>
            <subclass objecttype="folder" symname="F:kaad:employee" />
         </subclasses>
      </searchclauses>
      <options maxrecords="100" />
   </searchspec>
</storedsearch>

d_evil
Champ in-the-making
Champ in-the-making
Well it is working for me, only that I see that your SearchTemplate does not contain the JSP tag 😉

<blockcode>
  <subclasses>
   <subclass objecttype="document" name="Document" symname="cmis:document" />
  </subclasses>
  <jsppage>demo/JspFormularTest.jsp</jsppage>
</searchclauses>
</blockcode>
I used the simple document search template and the existing JSP from dummy folder.
And my workdesk is deployed on another tomcat than Alfresco.

fararjeh
Champ in-the-making
Champ in-the-making
I have two xml files to search , one for default search and another for custom jsp . I added uniquename to default search xml file . Now It's working , I added to custom jsp xml file Smiley Happy

Thaaaaank you and I'm sorry for my mistake.