Debug Liferay Portal dengan Eclipse
11:13 PM
Posted by Yogi
Debug merupakan proses yang sering dilakukan pada saat membangun semua aplikasi guna menemukan dan atau memperbaiki bugs pada aplikasi tersebut. Salah satu cara untuk men-debug adalah menggunakan Debugging tools yang terdapat di eclipse.
- Buat environment variable berikut :
CATALINA_HOME: [user_path]\liferay-portal-5.2.3\tomcat-6.0.18
JPDA_ADDRESS: 8000
JPDA_TRANSPORT: dt_socket - Buat Konfigurasi Debug pada eclipse:
-Klik menu : Run-Debug Configurations
-Buat konfigurasi baru pada "Remote Java Application"
-Masukkan parameter-parameter yang di butuhkan
- Jalankan Liferay portal dengan mode "JPDA", pada command prompt jalankan perintah berikut :
[Liferay Path]\tomcat-6.0.18\bin\catalina.bat jpda run
Pastikan muncul informasi bahwa tomcat listen ke port 8000[Liferay Path]\tomcat-6.0.18\bin>catalina.bat jpda run
Listening for transport dt_socket at address: 8000 - Tentukan breakpoints pada class yang akan di debug.
- Run Debug
Icon Finder
9:16 PM
Posted by Yogi
“Iconfinder provides high quality icons for webdesigners and developers in an easy and efficient way”
this is icon's search engine, that very useful for desaigner.
Website : http://www.iconfinder.net/
Simple Shoutbox Ajax with JQuery & JSP
4:41 PM
Posted by Yogi
In this article, I will write about Simple Shoutbox Application with JQuery. With Ajax (Asynchronous JavaScript and XML) , we can send a form submission and get response back without refreshing current page. jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development.
Javascript Code :
$(function() {
$(".submit").click(function() {
var name = $("#name").val();
var comment = $("#comment").val();
var dataString = 'name='+ name + '&comment=' + comment;
if(name=='' || comment=='')
{
alert('Please Give Valide Details');
} else {
$("#flash").show();
$("#flash").fadeIn(400).html('<img src="img/ajax-loader.gif" align="absmiddle"> <span class="loading">Loading Comment...</span>');
$.ajax({
type: "POST",
url: "ajaxshoutbox.jsp",
data: dataString,
cache: false,
success: function(html){
$("ol#update").append(html);
$("ol#update li:last").fadeIn("slow");
$("#name").val('');
$("#comment").val('');
$("#name").focus();
$("#flash").hide();
}
});
return false;
}
});
});
Explanation :
$.ajax({}) is JQuery event to call ajax request, it’s has an object of key/value pairs , that are used to initialize and handle the request.
- type : The type of request to make ("POST" or "GET"), default is "GET"
- url: The url to request
- data: Data to be sent to the server
- chace : if set to false it will force the pages that you request to not be cached by the browser
- success : A function to be called if the request succeeds
<form action="#" method="post">ajaxshoutbox.jsp
<label><input type="text" name="name" id="name"/>
<span class="titles">Name</span><span class="star">*</span>
</label><br />
<label>
<textarea name="comment" id="comment"></textarea>
<span class="titles">Comment</span>
</label><br />
<input type="submit" class="submit" value=" Submit Comment " /> </form>
<li class="box">
<span style=" font-weight:bold">Name :</span>
<span style="font-size:16px; color:#663399;"><%= request.getParameter("name") %></span> <br />
<span style=" font-weight:bold">Comment :</span> <%= request.getParameter("comment") %>
</li>
Download Sourcecode : http://simpleshoutboxajax.googlecode.com/files/SimpleShoutboxAjax-JQuery.zip
Accessing SQL Server Stored Procedure With Hibernate
1:19 AM
Posted by Yogi
In my previous project, I will be required to call Stored Procedure in SQL Server with Spring & Hibernate. Using HibernateTemplate class extends from HibernateDaoSupport, you can call the stored procedure in SQL Server.
The Stored Procedure:
SampleDao Source:
USE [sample];
GO
SET ANSI_NULLS ON;
GO
SET QUOTED_IDENTIFIER ON;
GO
ALTER PROCEDURE [SP_Sample]
(@Param1 nvarchar(50), @Param2 nvarchar(50))
AS
declare @Concatenation nvarchar(150)
set @Concatenation = @Param1 + ' and ' + @Param2
select @Param1,@Param2,@Concatenation
GO
public class SampleDao extends HibernateDaoSupport {
@SuppressWarnings("unchecked")
public String callSP(String param1, String Param2) {
// create session from active session
Session ses = getSession(true);
// create query for call the stored procedure
SQLQuery q = ses.createSQLQuery("exec SP_Sample :param1, :param2");
q.setString("param1", param1);
q.setString("param2", param2);
//execute stored procedure and get list result
List l = q.list();
StringBuilder result = new StringBuilder();
if (l.size()>0){
for(Iterator it=l.iterator();it.hasNext();){
Object[] row = (Object[]) it.next();
result.append("Param 1 : " + row[0] + ", Param 2 : " + row[1] + ", Concatenation : " + row[2]);
}
}
return result.toString();
}