留言板

URGENT: <liferay-ui:search form page> not including jsps in Custom Portlet

Peter Rodriguez,修改在11 年前。

URGENT: <liferay-ui:search form page> not including jsps in Custom Portlet

Regular Member 帖子: 154 加入日期: 10-6-7 最近的帖子
Hello People,
Just ran into this problem.
Trying to include a search page (in this case in this path /admin/search.jsp) from another file (in this case /admin/view.jsp) using the standard Liferay search tag.
Below is the syntax which I used:


<liferay-ui:search-form page="/admin/search.jsp" searchContainer="<%=searchContainer%>" servletContext="this.getServletContext()%>"


However, the search.jsp is not included within my view.jsp and there are no errors on the logs.
Any help with this please?
(I suspect liferay-search can only be used from Liferay portlets (sitting inside /html/portlet folder...dunno if this is correct).
Hope I can get the answer in good time to save my project which is already late....emoticon

Cheers and Many Thanks All...
thumbnail
Nishikant sapkal,修改在11 年前。

RE: URGENT: <liferay-ui:search form page> not including jsps in Custom Port

Junior Member 帖子: 80 加入日期: 10-2-16 最近的帖子
Hi Peter,
You can include other jsp using search container column tag in following way -

<liferay-ui:search-container-column-jsp align="left" path="/admin/search.jsp"/>

Best Regards,
Nishikant Sapkal.
Peter Rodriguez,修改在11 年前。

RE: URGENT: <liferay-ui:search form page> not including jsps in Custom Port

Regular Member 帖子: 154 加入日期: 10-6-7 最近的帖子
Thanks Nishikant!emoticon
At least I got a reply, was just about to go nuts on this problem...

But I if include my search page this way, would it still have acess to all the functionality of <liferay-ui:search-form> such as toggling, etc?
Also would the searches I do using the column jsp - display results on the main content jsp?

I just did that (please see my code snippet below:


<liferay-ui:search-container searchcontainer="<%= new CourtCaseSearch(renderRequest, portletURL) %>">          

    <liferay-ui:search-container-column-jsp align="left" path="/case_admin/casesearch.jsp" />
       
</liferay-ui:search-container>    




and I got the follwing exception and error

javax.servlet.jsp.JspTagException: Requires <liferay-ui:search-container-row < code></liferay-ui:search-container-row>
<br><br>Please could you give me an example/sample?<br><br><br>Thanks for quick reply...
thumbnail
Nishikant sapkal,修改在11 年前。

RE: URGENT: <liferay-ui:search form page> not including jsps in Custom Port

Junior Member 帖子: 80 加入日期: 10-2-16 最近的帖子
Hi Peter,
Please see below code sample -

This will fetch the journal article from Liferay database and will display in paginated form -
<liferay-ui:search-container
headerNames="id,title,modifiedDate,author"
iteratorURL="<%= portletURL %>" delta="5"
>
<liferay-ui:search-container-results>
<%
results=JournalArticleLocalServiceUtil.getArticles(10157,searchContainer.getStart(),searchContainer.getEnd());
total = JournalArticleLocalServiceUtil.getJournalArticlesCount();
pageContext.setAttribute("results", results);
pageContext.setAttribute("total", total);
boolean showEditArticleIcon = true;
%>

</liferay-ui:search-container-results>
<liferay-ui:search-container-row
className="com.liferay.portlet.journal.model.JournalArticle"
escapedModel="<%= true %>"
keyProperty="id"
modelVar="curUser"
>
<liferay-ui:search-container-column-text
name="id"
property="id"
/>
<liferay-ui:search-container-column-text
name="title"
property="title"
/>

<liferay-ui:search-container-column-text
name="modifiedDate"
property="modifiedDate"
/>
<liferay-ui:search-container-column-text
name="userName"
property="userName"
/>

<liferay-ui:search-container-column-jsp align="left" path="/search.jsp"/> // Jsp You can use it for including the other stuff like icons-

</liferay-ui:search-container-row>

<liferay-ui:search-iterator paginate="true"/>
</liferay-ui:search-container>

Cheers,
Nishikant Sapkal
thumbnail
Manish Kumar Jaiswal,修改在11 年前。

RE: URGENT: <liferay-ui:search form page> not including jsps in Custom Port

Regular Member 帖子: 153 加入日期: 08-11-25 最近的帖子
Did you resolve this can you share the solution

Regards
Manish
Sergio Ramazzina,修改在11 年前。

RE: URGENT: <liferay-ui:search form page> not including jsps in Custom Port

New Member 帖子: 6 加入日期: 11-6-8 最近的帖子
Manish,

I was able to solve this problem this way


        <liferay-ui:search-form servletContext="<%= this.getServletContext()%>" page="/common/liferay_user_search_form.jsp" />


After filling the servletContext attribute it worked as a charm.

Hope this help

Sergio
thumbnail
Moisés Belda,修改在9 年前。

RE: URGENT: <liferay-ui:search form page> not including jsps in Custom Port

Junior Member 帖子: 75 加入日期: 13-4-20 最近的帖子
Not always works filling servletContext param.

For all IncludeTags (liferay-ui:search-form too) there is a file checking wich ensures that file exist. If you put FIRST the tag without servletContext param (for example, with a custom portlet), checking resolves "false" because without servletContext = ROOT and does not work with your custom portlet. That false value for the file that you want to include is inserted into a "cache map". Then, if you change the tag, and insert servletContext, always "cache map" value prevalis.

FileAvailabilityUtil

public static boolean isAvailable(
		ServletContext servletContext, String path) {

		if (Validator.isNull(path)) {
			return false;
		}

		if (path.charAt(0) != CharPool.SLASH) {
			return true;
		}

		Boolean available = _availabilities.get(path); =&gt; CACHE MAP

		if (available != null) {
			return available;
		}

		URL url = null;

		try {
			url = AccessController.doPrivileged(
				new ResourcePrivilegedExceptionAction(servletContext, path));
		}


There are 2 ways to "clean" this cache:
1.- Deploying a hook :
Because HookHotDeployListener.java has a FileAvailabilityUtil.reset()... PortletHotDeployListener.java not.
2.- Rebooting liferay

Hope it helps
Nabil Bahtat,修改在9 年前。

RE: URGENT: <liferay-ui:search form page> not including jsps in Custom Port

New Member 帖子: 13 加入日期: 13-10-10 最近的帖子
I have a similar problem with<liferay-ui:search-form tag when I try in portlet A to include a jsp page from a second portlet B like this:
In my portlet A I have a viwe.jsp where I call <liferay-ui:search-form page="search.jsp"
searchContainer="<%= searchContainer %>"
/>
where search.jsp is in portlet B.

The page view.jsp is well rendered including the search.jsp with a "search" button and an input field for keywords search.
But the problem, is when I click the "search" button I have this errors
1 - In the console, the error is "The struts path portlet B does not belong to portlet A. Check the definition in liferay-portlet.xml"
2 - In the GUI, the error is "You do not have the roles required to access this portlet."

Please guys, I really need your help.

Best regards
Nabil
Nabil Bahtat,修改在9 年前。

RE: URGENT: <liferay-ui:search form page> not including jsps in Custom Port

New Member 帖子: 13 加入日期: 13-10-10 最近的帖子
Hi thanks for your answer, but I did not find how to solve my problem through the links you gave.
In fact, I know how to use <liferay-ui:search-form between two jsp pages both belonging to the same portlet,
which corresponds to your code example in the links you kindly advised me to look through.

My problem is that my first jsp is in portlet A and is trying to call a search jsp page through <liferay-ui:search-form
and this search jsp is in a portlet B.
So, this why I have the erreur "The struts path portlet B does not belong to portlet A. Check the definition in liferay-portlet.xml"

Can you tell me please if there is a workaround.

Thanks alot.
Best regards,
Nabil