Liferay portlet部署时间戳

时间:2015-05-07 15:42:27

标签: javascript liferay portlet

我需要在jsp页面中包含一些JavaScript:

DisplayArray(winning);
DisplayArrayContents(player);

当我部署新的portlet版本并更改此JavaScript文件时,某些用户会看到此文件的旧版本。

我看到Liferay将最后一次部署时间戳添加到javascripts(class Program { static void DisplayArray(params int[] args) { for (int i = 0; i < args.Length; i++) { Console.Write("{0}\t", args[i]); } Console.Write("\n"); } static void Main(string[] args) { //static array for winning[6], empty for player[6], empty for matching[6] int [] winning = new int [6] {2, 4, 6, 9, 1, 3}; string[] tmp = new string[6]; int [] player = new int [6]; int [] matching = new int [6]; string line; int inValue; bool valid; //Input loop do { Console.WriteLine("Please enter six lotto numbers between 1 and 9, separated by spaces: "); valid = true; line = Console.ReadLine(); tmp = line.Split(' '); //split on space for (int i = 0; i < tmp.Length; i++) { int.TryParse(tmp[i], out inValue); if (inValue < 1 || inValue > 9) //Validate for int 1-9 { Console.WriteLine("{0} must be a whole number between 1 and 9", tmp[i]); valid = false; } player[i] = inValue; } } while (!valid); //Output Console.WriteLine("The winning numbers were:"); DisplayArray(winning); Console.WriteLine("Your numbers were:"); DisplayArray(player); //Console.WriteLine("You had " + MatchCount() + " matches."); //Console.WriteLine("Your matching numbers are:") //DisplayArrayContents(matching); //Console.Read(); string retVal = ""; while(retVal != "exit") { Console.WriteLine("Type 'exit' to end the program: "); retVal = Console.ReadLine(); if (retVal == "exit") Environment.Exit(0); } } } ),如果我将此文件添加到<script type="text/javascript" src="<%=request.getContextPath()%>/newsletter/js/newsletter.js"></script> ,我可以这样做。但我不能用...js?t=14573725543来做。有时候我不需要加载这个文件。

是否可以手动添加此自动时间戳?我在liferay-portlet.xml的主题中做了类似的事情。

1 个答案:

答案 0 :(得分:0)

Liferay正在使用process生成com.liferay.portal.model.Portlet.getTimestamp()之后的数字。您可以从PortletContext获取(Liferay)portlet:

t=