掲示板
Retrieving data from database
11年前 に Bakhtawar Khan によって更新されました。
Retrieving data from database
New Member 投稿: 14 参加年月日: 12/08/06 最新の投稿
hiee All,
I want to retrieve data from database and display it on my portlet.Can someone tell me how to do that???
I want to retrieve data from database and display it on my portlet.Can someone tell me how to do that???
11年前 に devaraj s によって更新されました。
RE: Retrieving data from database
Regular Member 投稿: 228 参加年月日: 12/05/21 最新の投稿Bakhtawar Khan:
hiee All,
I want to retrieve data from database and display it on my portlet.Can someone tell me how to do that???
which databse you using for liferay.. Liferay by default will run on hsql database.. If you want to you can change to mysql or whichever database compaiatble to you..
Suppose you using mysql database means you create service.xml file by defining your db entities. once it done you build a service.
from persistance object you can add or retrieve the data from database.
xxxLocalServiceUtil Class and use there respective functions to get appropriate data.
11年前 に Bakhtawar Khan によって更新されました。
RE: Retrieving data from database
New Member 投稿: 14 参加年月日: 12/08/06 最新の投稿
I am using mysql.I am already done with building service but i am not getting the desired db on my portlet.
11年前 に Hitoshi Ozawa によって更新されました。
RE: Retrieving data from database
Liferay Legend 投稿: 7942 参加年月日: 10/03/24 最新の投稿
When you build your service there should have been xxxxLocalServiceUtil class generated. ( where xxx is hte name of your entity).
You just have to do a get() on the column you've defined.
How are you trying to display the data?
You just have to do a get() on the column you've defined.
How are you trying to display the data?
11年前 に Bakhtawar Khan によって更新されました。
RE: Retrieving data from database
New Member 投稿: 14 参加年月日: 12/08/06 最新の投稿
I have already done that....now i just want to display the content on another portlet.Any idea how to do that??
11年前 に devaraj s によって更新されました。
RE: Retrieving data from database
Regular Member 投稿: 228 参加年月日: 12/05/21 最新の投稿Bakhtawar Khan:
I have already done that....now i just want to display the content on another portlet.Any idea how to do that??
I think you have to use inetportlet communication concept.. Please correct me if this suggestion wrong ..
11年前 に Bakhtawar Khan によって更新されました。
RE: Retrieving data from database
New Member 投稿: 14 参加年月日: 12/08/06 最新の投稿
ya.....I am new to liferay so it will be better if u provide me steps to do that.
11年前 に Rewati Raman によって更新されました。
RE: Retrieving data from database
Junior Member 投稿: 97 参加年月日: 12/02/24 最新の投稿Bakhtawar Khan:
ya.....I am new to liferay so it will be better if u provide me steps to do that.
just take the jar from the lib of the portlet on which you had created the service.xml and paste it in the liferay-portal/tomcat/lib/ext then
write the following lines in your view.jsp page
here XXX means your entity Name Defined in service.xml
<%
int count = XXXLocalServiceUtil.getXXXsCount();
List<xxx> resultList = XXXLocalServiceUtil.getXXXs(0, count);
%>
<table border="1" width="80%">
<tbody><tr>
<th>ID</th>
<th>Name Of Canadidate </th>
<th>Phone</th>
<th>DOB</th>
</tr>
<%
for (XXX res : resultList) {
%>
<tr>
<td><%= res.getId() %></td>
<td><%= res.getName() %></td>
<td><%= res.getPhone() %></td>
<td><%= res.getDob() %></td>
</tr>
<%
}
%>
</tbody></table>
</xxx>
the above code will retreive the data
in the tablular format
it works for me every time
Regards,
Rewati Raman
11年前 に devaraj s によって更新されました。
RE: Retrieving data from database
Regular Member 投稿: 228 参加年月日: 12/05/21 最新の投稿Bakhtawar Khan:
ya.....I am new to liferay so it will be better if u provide me steps to do that.
refer this article you ill get an idea about IPC.
http://www.liferay.com/community/wiki/-/wiki/Main/Portlet+to+Portlet+Communication
11年前 に Sagar A Vyas によって更新されました。
RE: Retrieving data from database
Liferay Master 投稿: 679 参加年月日: 09/04/17 最新の投稿Bakhtawar Khan:
hiee All,
I want to retrieve data from database and display it on my portlet.Can someone tell me how to do that???
Hi Bakhtawar,
Please refer this
http://www.liferay.com/web/guest/community/forums/-/message_boards/view_message/15700837.
Thanks,
Sagar Vyas