我想用 Search 的 portlet 获取搜索的关键字。我看到在 url 中出现:“struts_action=/search/seach”然后我在 strut-config.xml 中查找并找到:
action path="/search/search" forward="portlet.search.search"
我正在尝试做一个支柱,但我对支柱不太了解,而且它不起作用。这是“liferay-hook.xml”的代码:
<portal-properties>portal.properties</portal-properties>
<struts-action>
<struts-action-path>/search/search</struts-action-path>
<struts-action-impl>com.segmentationProject.searchAction.struts.SearchAction</struts-action-impl>
</struts-action>
portal.properties: auth.public.paths=/search/search
SearchAction.java:
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.liferay.portal.kernel.struts.BaseStrutsAction;
public class SearchAction extends BaseStrutsPortletAction {
@Override
public void processAction(StrutsPortletAction originalStrutsPortletAction, PortletConfig portletConfig, ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
System.out.println("inside the process ");
super.processAction(originalStrutsPortletAction, portletConfig, actionRequest, actionResponse);
}
@Override
public String render(StrutsPortletAction originalStrutsPortletAction,PortletConfig portletConfig, RenderRequest renderRequest, RenderResponse renderResponse) throws Exception {
// TODO Auto-generated method stub
System.out.println("inside the render");
return super.render(portletConfig, renderRequest, renderResponse);
}
}
关于我错过或做错的任何想法?我只想获取关键字,然后正常进行搜索。谢谢!