Fórumok
Retrieving data from database
Bakhtawar Khan, módosítva 11 év-val korábban
Retrieving data from database
New Member Bejegyzések: 14 Csatlakozás dátuma: 2012.08.06. Legújabb bejegyzések
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???
devaraj s, módosítva 11 év-val korábban
RE: Retrieving data from database
Regular Member Bejegyzések: 228 Csatlakozás dátuma: 2012.05.21. Legújabb bejegyzésekBakhtawar 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.
Bakhtawar Khan, módosítva 11 év-val korábban
RE: Retrieving data from database
New Member Bejegyzések: 14 Csatlakozás dátuma: 2012.08.06. Legújabb bejegyzések
I am using mysql.I am already done with building service but i am not getting the desired db on my portlet.
Hitoshi Ozawa, módosítva 11 év-val korábban
RE: Retrieving data from database
Liferay Legend Bejegyzések: 7942 Csatlakozás dátuma: 2010.03.24. Legújabb bejegyzések
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?
Bakhtawar Khan, módosítva 11 év-val korábban
RE: Retrieving data from database
New Member Bejegyzések: 14 Csatlakozás dátuma: 2012.08.06. Legújabb bejegyzések
I have already done that....now i just want to display the content on another portlet.Any idea how to do that??
devaraj s, módosítva 11 év-val korábban
RE: Retrieving data from database
Regular Member Bejegyzések: 228 Csatlakozás dátuma: 2012.05.21. Legújabb bejegyzésekBakhtawar 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 ..
Bakhtawar Khan, módosítva 11 év-val korábban
RE: Retrieving data from database
New Member Bejegyzések: 14 Csatlakozás dátuma: 2012.08.06. Legújabb bejegyzések
ya.....I am new to liferay so it will be better if u provide me steps to do that.
Rewati Raman, módosítva 11 év-val korábban
RE: Retrieving data from database
Junior Member Bejegyzések: 97 Csatlakozás dátuma: 2012.02.24. Legújabb bejegyzésekBakhtawar 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
devaraj s, módosítva 11 év-val korábban
RE: Retrieving data from database
Regular Member Bejegyzések: 228 Csatlakozás dátuma: 2012.05.21. Legújabb bejegyzésekBakhtawar 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
Sagar A Vyas, módosítva 11 év-val korábban
RE: Retrieving data from database
Liferay Master Bejegyzések: 679 Csatlakozás dátuma: 2009.04.17. Legújabb bejegyzésekBakhtawar 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