velocity

How to access map in velocity template file

折月煮酒 提交于 2019-12-23 20:17:43
问题 when I passed a Map<String,String> in velocity template file, and when try to print the values of map it get sorted (on the basis of ASCII values). I am doing as follows: this is my velocity template file:: #set($tocList=${mapReference.mapValue}) #set($tocEntry="") <div > #foreach($tocEntry in $tocList.keySet()) <a href="#$tocEntry">$tocList.get($tocEntry)</a><br/> #end </div> My Java code is : Map<String, String> map=new HashMap<String, String>(); Map<String,HashMap> m1=new HashMap<String,

How Jira plugin custom field value gets processed on the way to .vm templates

半世苍凉 提交于 2019-12-23 20:06:56
问题 Jira server 7.2.1. Custom field plugin. The question follows this discussion Can't understand, what does method getSingularObjectFromString do? and some info from "Practical jira plugins" I'm trying to implement a database custom field with basic value-displayValue logic. The field represents an external entity, so I'm storing ID as a value of the field, but displaying NAME. I have two .vm templates: edit and view. I'm trying to choose the right place to convert ID to NAME. I've overridden a

How do I get Spanish characters to display properly using a Velocity template?

霸气de小男生 提交于 2019-12-23 15:47:31
问题 I'm using Velocity and a message resource bundle to generate html pages. When I specify Mexico as my locale, my messages-es_MX.properties gets processed as the source for the message resources. This is as I expect it to be. But the characters (áéíóúüñ¿¡) aren't displayed properly. My message property: customer.greeting=áéíóúüñ¿¡ For my first attempt, I've got the following: html header in the generated page: <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> velocity

Regex not working in Velocity Template

馋奶兔 提交于 2019-12-23 09:27:17
问题 I tried this in Test.java String regex = "<\\s*br\\s*/*\\s*>"; String test1 = "< br/ >"; System.out.println(test.replaceAll(regex, " "));` But when I try the same thing in a velocity template ` #set($brRegex = "<\\s*br\\s*/*\\s*>") #set($imageDescription = $imageDescription.replaceAll($brRegex, " "))` And: #set($imageDescription = $imageDescription.replaceAll("<\\s*br\\s*/*\\s*>", " "))` Both don't work. Am I missing something? 回答1: Omit the extra backslashes. No need to escape them. See

Quiver plot arrow aspect ratio

风格不统一 提交于 2019-12-23 07:38:09
问题 I am having some issues with Matplotlib's quiver plot. Given a velocity vector field, I want to plot the velocity vectors on top of the stream lines. The vectors are not tangent to the stream function as expected. To calculate the stream function, I use a Python translated version of Dr. Pankratov's Matlab code available at http://www-pord.ucsd.edu/~matlab/stream.htm (mine will be available soon at GitHub). Using its results, I use this code: import numpy import pylab # Regular grid

How to get Angle of velocity to rotate a bullet?

点点圈 提交于 2019-12-23 06:00:09
问题 I have this: CGPoint vel = hudLayer.rightJoystick.velocity; CCBullet* sp = [CCBullet spriteWithFile:@"green.png"]; sp.position = player.position; [self addChild:sp z:-10]; vel = ccpMult(ccpNormalize(vel), 300); sp.rotation = //how to get the rotation out of the velocity? Any help? 回答1: float angle = atan2f(vel.y, vel.x); 来源: https://stackoverflow.com/questions/5729221/how-to-get-angle-of-velocity-to-rotate-a-bullet

Spring MVC & Velocity : Template structure

懵懂的女人 提交于 2019-12-23 04:07:30
问题 I'd like to achieve this kind of template functionality: Have a template defining header, footer, and common parts of complete (x)html webpage When returning String from @Controller it will define the view included to specific part of template Like this: @Controller @RequestMapping(value = "/", method = RequestMethod.GET) public String home(Locale locale, Model model) { return "home_view"; } views/home_view.vm <h2>Content title</h2> <p>Content text</p> views/template.vm <html> <head> <title><

JS/ CSS files not found due to path differences java, spring mvc, velocity

落花浮王杯 提交于 2019-12-23 03:07:14
问题 I have this directory structure: webapp - resources - custom.js - base.css - WEB-INF - views - layout.vm - top.vm - footer.vm - index.vm - FolderA - restricted.vm My layout.vm is: #parse('top.vm') $screen_content #parse('footer.vm') My top.vm consists include these JS and CSS files: <link href="resources/base.css" rel="stylesheet"> <script src="resources/custom.js"></script> Now when my I access http://www.example.com:8080/index page, I see the JS and CSS files getting found. But when I visit

Velocity Eventhandler

老子叫甜甜 提交于 2019-12-22 11:10:06
问题 in velocity, when you do $object.variable if it not be able to find the getter function to access it or the getter returns a null. it will just show $object.variable explicitly on the page I know there is a quiet reference, but I don't want to add ! sign to thousands of variables. I have tried InvalidReferenceEventHandler, NullValueHandler they all didn't get called. I wander is there a specific type of Eventhandler for this. Many thanks 回答1: The above seems to be a valid choice as well.

Eclipse AutoValue class fails to build

假装没事ソ 提交于 2019-12-22 08:39:36
问题 I'm running Eclipse Kepler SR2, with Maven 3.1.1 attached with the m2e and m2e-apt plugins, and I'm getting an error I don't know how to resolve. I managed to find all the dependencies needed to get @AutoValue working into my pom.xml, but now I'm in a state where it only works if the methods which need to be defined all have primitive return types. If I provide an abstract getter which returns an Object or more specific, I get this error: @AutoValue processor threw an exception: java.lang