Tribune

Home » Liferay Portal » English » 3. Development

Vista Combinata Vista Piatta Vista ad Albero
Discussioni [ Precedente | Successivo ]
toggle
Balaji Chopparapu
Debugging velocity template
22 ottobre 2012 2.57
Risposta

Balaji Chopparapu

Punteggio: New Member

Messaggi: 22

Data di Iscrizione: 8 ottobre 2010

Messaggi recenti

Hi,
How can I debug velocity template that is assigned to a structure and webcontent ? Till now I am printing all variables and doing debugging in a rude way. Can I use eclipse or any other IDE to debug velocity template?

Thanks in Advance,
Balaji
James Falkner
RE: Debugging velocity template
22 ottobre 2012 12.26
Risposta

James Falkner

Community Moderator

Punteggio: Liferay Legend

Messaggi: 1406

Data di Iscrizione: 17 settembre 2010

Messaggi recenti

Balaji Chopparapu:
Hi,
How can I debug velocity template that is assigned to a structure and webcontent ? Till now I am printing all variables and doing debugging in a rude way. Can I use eclipse or any other IDE to debug velocity template?

Thanks in Advance,
Balaji


I do not know of any IDE that would let you, for example, set breakpoints in Velocity code and debug it - I've always used printing variables and such. One thing you may be interested in is how to emit debug information to the log file:

1#set ($logFactory = $portal.getClass().forName('com.liferay.portal.kernel.log.LogFactoryUtil'))
2#set ($log = $logFactory.getLog('mylog'))
3$log.error($msgCount)
4$log.error("Hi There")


If you find a better way, let me know!
Hitoshi Ozawa
RE: Debugging velocity template
22 ottobre 2012 14.49
Risposta

Hitoshi Ozawa

Punteggio: Liferay Legend

Messaggi: 7949

Data di Iscrizione: 23 marzo 2010

Messaggi recenti

I only know of Velocity Debugging Template and using logging.

http://wiki.apache.org/velocity/VelocityDebuggingTemplate
Siby Mathew
RE: Debugging velocity template
23 ottobre 2012 2.20
Risposta

Siby Mathew

Punteggio: Expert

Messaggi: 265

Data di Iscrizione: 4 marzo 2011

Messaggi recenti

Really useful information....Thanks for the code ! emoticon
Balaji Chopparapu
RE: Debugging velocity template
30 ottobre 2012 8.40
Risposta

Balaji Chopparapu

Punteggio: New Member

Messaggi: 22

Data di Iscrizione: 8 ottobre 2010

Messaggi recenti

Thanks James. This is really useful hint.
Michel Wicky
RE: Debugging velocity template
13 gennaio 2013 8.09
Risposta

Michel Wicky

Punteggio: Regular Member

Messaggi: 130

Data di Iscrizione: 2 luglio 2010

Messaggi recenti

Hello Hitoshi, i tested the velocity debugging but was not able to obtain any result. I was testing it using LR 6.1 EE and putted the macro into VM_liferay.vm in portal-impl.jar.
I used the script without $context.

Here is the vm script i would like to debug with #showDebugPopup macro call :

#set ($isOkinawaLogged = $request.get("remote-user"))
#if ($isOkinawaLogged != '')
#set ($userFullName = $user.getFullName())
<h1>Bonjour $userFullName</h1>
<p>Félicitations ! Vous participez à l'action bénévole des associations suivantes :'</p>
<li>
#foreach ($my_site_text IN $my_sites_text )
<ul>($my_site_text.getName())</ul>
#end
</li>
#else
<div class="portlet-msg-alert">
<h1>Bonjour cher visiteur, chère visiteuse</h1>
<p>Vous ne participez pas encore à l'action bénévole des associations affiliées au projet Okinawa. Nous nous réjouissons de vous accueillir très prochainement et vous compter bientôt parmi nous.</p>
<p>Vous trouverez ici la liste des associations auxquelles vous aurez adhérées.</p>
</div>
#end
#showDebugPopup()

Do you see something wrong ?

Note i'm able to debug a little bit with org.apache.velocity setted to debug, but it's not really sufficient.

Thank youz
Allegati: VM_liferay.vm (5,6k)