Fóruns

Início » Liferay Portal » English » 3. Development

Visualização combinada Visão plana Exibição em árvore
Tópicos [ Anterior | Próximo ]
toggle
Ravi Kiran
Liferay : Using Jquery code inside Liferay 6 .
4 de Julho de 2012 05:21
Resposta

Ravi Kiran

Ranking: Junior Member

Mensagens: 98

Data de entrada: 11 de Dezembro de 2011

Mensagens recentes

I am using Liferay 6 for the Application . I wanted to use , Jquery for the User Interface Part instead of default Alloy . For this i have integrated JQuery with Liferay by editing liferay-portlet.xml this way

<portlet>
<portlet-name>First</portlet-name>
<icon>/icon.png</icon>
<instanceable>true</instanceable>
<header-portlet-css>/css/main.css</header-portlet-css>
<header-portlet-javascript>https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js</header-portlet-javascript>
<header-portlet-javascript>https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.15/jquery-ui.min.js</header-portlet-javascript>
<footer-portlet-javascript>/js/main.js</footer-portlet-javascript>
<css-class-wrapper>First-portlet</css-class-wrapper>
</portlet>
This is my view.jsp

<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>

<portlet:defineObjects />

This is the <b>Sai Nath</b> portlet.

Now please tell me how can i put the below Jquery Hello World Alert inside the view.jsp

This is my Jquery Hello World alert program

<html>
<head>
<title>jQuery Hello World Alert box</title>

<script type="text/javascript" src="jquery-1.4.2.js"></script>

</head>
<script type="text/javascript">
$(document).ready(function(){
$("#cl").click(function(){
alert("HELLO WORLD!");
});
});
</script>
<body>
<font color="red">CLICK BELOW BUTTON TO SEE ALERT BOX</font>
<br>
<br>
<button id="cl">Click Me</button>
</body>
</html>

Please let me know , thanks for reading .
Tejas Kanani
RE: Liferay : Using Jquery code inside Liferay 6 .
4 de Julho de 2012 05:43
Resposta

Tejas Kanani

Ranking: Liferay Master

Mensagens: 653

Data de entrada: 6 de Janeiro de 2009

Mensagens recentes

Try this,

View.jsp
 1
 2<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
 3
 4<portlet:defineObjects />
 5
 6<script type="text/javascript">
 7
 8$(document).ready(function(){
 9    $("#cl").click(function(){
10        alert("HELLO WORLD!");
11    });
12});
13
14</script>
15
16<font color="red">CLICK BELOW BUTTON TO SEE ALERT BOX</font>
17<br>
18<br>
19<button id="cl">Click Me</button>


Thanks,
TK
Ravi Kiran
RE: Liferay : Using Jquery code inside Liferay 6 .
4 de Julho de 2012 06:12
Resposta

Ravi Kiran

Ranking: Junior Member

Mensagens: 98

Data de entrada: 11 de Dezembro de 2011

Mensagens recentes

Thanks a lot , i was strugling for this . beause even a minor typo results in error of the Portlet , thanks once again .
Hitoshi Ozawa
RE: Liferay : Using Jquery code inside Liferay 6 .
4 de Julho de 2012 08:17
Resposta

Hitoshi Ozawa

Ranking: Liferay Legend

Mensagens: 7952

Data de entrada: 23 de Março de 2010

Mensagens recentes

Kind of wondering why you're loading jquery 1.6.2 in liferay-portal.xml
<header-portlet-javascript>https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js</header-portlet-javascript>


while you're loading jquery 1.4.2 in your jsp.
<script type="text/javascript" src="jquery-1.4.2.js"></script>