In jsp
<%PortletURL userNameURL = renderResponse.createActionURL();
userNameURL.setParameter(ActionRequest.ACTION_NAME, "userfilter");%>
<%
List<Billclaim> bill = null;
if(request.getAttribute("fn") != null){
bill = (List<Billclaim>) request.getAttribute("fn");
}else{
bill = BillclaimLocalServiceUtil.getBillclaims(-1, -1);
}
%>
<aui:form method="POST" name="fm" action="<%=userNameURL.toString() %>" >
<aui:input type="text" label="" name="userName" placeholder="Search By User Name">
</aui:input>
<aui:button type="submit" value="Search"/>
</aui:form>
BillclaimLocalServiceImpl.java
public List<Billclaim> getUserName(String userName){
return billclaimPersistence.findByuserName(userName);
}
Controller
public void userfilter(ActionRequest actionRequest, ActionResponse actionResponse) throws IOException, PortletException, SystemException, PortalException {
String userName = ParamUtil.getString(actionRequest, "userName");
List<Billclaim> fn = BillclaimLocalServiceUtil.getUserName(userName);
actionRequest.setAttribute("fn", fn);
actionResponse.setRenderParameter("jspPage", "/billView.jsp");
SessionMessages.add(actionRequest, "searched");
}
Service.xml
<finder name="userName" return-type="Collection">
<finder-column name="userName"></finder-column>
</finder>
<%PortletURL userNameURL = renderResponse.createActionURL();
userNameURL.setParameter(ActionRequest.ACTION_NAME, "userfilter");%>
<%
List<Billclaim> bill = null;
if(request.getAttribute("fn") != null){
bill = (List<Billclaim>) request.getAttribute("fn");
}else{
bill = BillclaimLocalServiceUtil.getBillclaims(-1, -1);
}
%>
<aui:form method="POST" name="fm" action="<%=userNameURL.toString() %>" >
<aui:input type="text" label="" name="userName" placeholder="Search By User Name">
</aui:input>
<aui:button type="submit" value="Search"/>
</aui:form>
BillclaimLocalServiceImpl.java
public List<Billclaim> getUserName(String userName){
return billclaimPersistence.findByuserName(userName);
}
Controller
public void userfilter(ActionRequest actionRequest, ActionResponse actionResponse) throws IOException, PortletException, SystemException, PortalException {
String userName = ParamUtil.getString(actionRequest, "userName");
List<Billclaim> fn = BillclaimLocalServiceUtil.getUserName(userName);
actionRequest.setAttribute("fn", fn);
actionResponse.setRenderParameter("jspPage", "/billView.jsp");
SessionMessages.add(actionRequest, "searched");
}
Service.xml
<finder name="userName" return-type="Collection">
<finder-column name="userName"></finder-column>
</finder>
No comments:
Post a Comment