避免重新加载jsp页面的最佳方法是什么?

时间:2016-08-10 07:16:34

标签: liferay

enter image description here这是我的jsp代码

<portlet:renderURL var="rssSearchResult">
<portlet:param name="<%=CMD.ACTION%>"
    value="<%=RenderKeys.FIND_CONTENT_SEARCH%>" />
    <%-- <portlet:param name="categoryId" value="<%=String.valueOf(category.getCategoryId())%>"/> --%>

<div id="category-content" class="span8">
    <aui:form render="<%=rssSearchResult %>">
        <aui:input placeholder="Please Enter RSS Feed Title Here"
            name="search" label="" id="searchTitle" type="text"
            style="width:300px;" />
        <aui:button type="button"  name="search" id="searchTitle" value="submit" class="Find_content_search"
            onclick="javascript:mynav('<%=rssSearchResult%>');addinMoveableBar();"></aui:button>
    </aui:form>

*************这是我的java源代码************

@RenderMapping(params=CMD.ACTION+StringPool.EQUAL+RenderKeys.FIND_CONTENT_SEARCH)
public void rssSearchResult(RenderRequest renderRequest,
        RenderResponse renderResponse) {

    String searchValue= ParamUtil.getString(renderRequest, "search");
    DynamicQuery SearchaQuery = DynamicQueryFactoryUtil.forClass(
            AssetEntry.class, PortletClassLoaderUtil.getClassLoader());
    SearchaQuery.add(PropertyFactoryUtil.forName("title").eq(searchValue));
    try {
        List<AssetEntry> assentries=AssetEntryLocalServiceUtil.dynamicQuery(SearchaQuery);
        List<AssetCategory> assetcategory=null;
        for(AssetEntry assetentry:assentries){
             assetcategory= AssetCategoryLocalServiceUtil.getAssetEntryAssetCategories(assetentry.getEntryId(), -1, -1);
        }

        renderRequest.setAttribute("AssetCategory", assetcategory);
        renderRequest.setAttribute("AssetEntries", assentries);
    } catch (SystemException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}

************* main.js ***************

function mynav(navurl){
    ajaxindicatorstart("Processing Please Wait");
    loadPage(navurl);
    history.pushState({}, '', navurl);

}

我有一个带提交按钮的搜索文本框,如果我搜索必须显示的类别标题而不重新加载页面....

0 个答案:

没有答案