We already know how to use Search Container in Liferay. Today we will create a search form that can search values from search container. For this we use <liferay-ui:search-form> tag. By using this we can apply basic as well as advance search.
Liferay use this in many places like when you go to web content section (Admin->Content)
Here you can search web content by name and when you click Gear icon you can search by id, name etc. You can also apply All(AND) and ANY(OR) operations.
I already created my Services using Service Builder. Here is my service.xml:-
I fill some data in Database:-
Today we apply Searching on these records on the basis of eId and eName.
Project Structure
So lets start this Step by Step:-
Step 1:-Create init.jsp
First we create a init.jsp that contain all the imports:-
init.jsp
Now as you can see in init.jsp we use two java classes EmployeeSearchContainer and EmployeeDisplayTerms. Now we create these two classes.
Step 2:-Create EmployeeSearchContainer.java
Step 3:-Create EmployeeDisplayTerms.java
EmployeeDisplayTerms.java
Step 4:-Create view.jsp
search.jsp
Step 5:-Create Helper Class
Now Deploy the portlet and check the output
Output:-
1)Normal Search
2)Advance Search
You can download the source code from here.
In the next blog we create Search Form With Search Container but in a simple way.
Hope this will Help....
Related Post:-
Basic web content in Liferay
Categorization in web content
Structure and Template in Web Content
Fetch Web Content Programmatically
Get Journal Article Using SAX Parser
Form Handling in Spring Portlet
Embedding a Web Content in a Portlet
Fetch Latest Version Journal Article or Web Content in Liferay
init.jsp
Now as you can see in init.jsp we use two java classes EmployeeSearchContainer and EmployeeDisplayTerms. Now we create these two classes.
Step 2:-Create EmployeeSearchContainer.java
Now we create EmployeeSearchContainer that extends SearchContainer in this class we can set properties like empty result message and default records per page(DELTA).
EmployeeSearchContainer.java
EmployeeSearchContainer.java
Step 3:-Create EmployeeDisplayTerms.java
This class extends DisplayTerms .We want searching on the basis of eId and eName so we create getter and setter for both. This class also gives us important methods like isAdvancedSearch() , isAndOperator() etc.
EmployeeDisplayTerms.java
Step 4:-Create view.jsp
We already discuss about Search container in Liferay. Here we apply searching in this:-
view.jsp
Explanation:-
In this we use liferay-ui:search-form tag that include search.jsp which contain two fields eId and eName:-view.jsp
Explanation:-
search.jsp
Step 5:-Create Helper Class
In view.jsp we use EmployeeHelper class to load the data.In EmployeeHelper we use dynamic query and Conjunction , Disjunction on the basis of various scenarios like For Normal Search we use Keywords ,for Advance Search ALL operation we use Conjunction , for Advance Search ANY operation we use Disjunction etc.
EmployeeHelper.java
EmployeeHelper.java
Now Deploy the portlet and check the output
Output:-
1)Normal Search
2)Advance Search
You can download the source code from here.
In the next blog we create Search Form With Search Container but in a simple way.
Related Post:-
Basic web content in Liferay
Categorization in web content
Structure and Template in Web Content
Fetch Web Content Programmatically
Get Journal Article Using SAX Parser
Form Handling in Spring Portlet
Embedding a Web Content in a Portlet
Fetch Latest Version Journal Article or Web Content in Liferay
CASINO GIVES ITEM DATE OF CONCEPT
ReplyDeleteA Las 구리 출장안마 Vegas, Nevada judge 영천 출장안마 has ordered 진주 출장샵 casino operators to give away a $5M in monetary gifts to a group 의왕 출장마사지 of high rollers and punters in 영천 출장마사지 the US.