velocity

Velocity, how to retrieve a hashmap value using another velocity variable

余生长醉 提交于 2020-01-04 05:57:15
问题 I have a HashMap in my bean: HashMap<String, SomeObject> someHashMap; Then in the velocity template I need to access the HashMap with a value that I have in velocity from other source (in fact I have many keys not only one that's why I need to get the values this way): $key How can I access the hashmap with this key? I'm trying: $someHashMap.get($key) and ${someHashMap.get($key)} But those two only write the same thing to the output, meaning that with the first line I literally get:

Velocity Template auto-reload doesn't work

不羁的心 提交于 2020-01-03 09:11:10
问题 I want to reload velocity template as it's changed. For this I've set the followings, but reload doesn't work when I manually change a .vm file inside META-INF/template/ . velocimacro.library.autoreload = true [spring|file|class].resource.loader.cache = false Any idea? Here is my velocityEngine bean <bean id="velocityEngine" class="org.springframework.ui.velocity.VelocityEngineFactoryBean"> <property name="resourceLoaderPath" value="classpath:META-INF/template/" /> <property name=

Building and Running Velocity Generating HTML

心不动则不痛 提交于 2020-01-03 05:14:08
问题 I'm very new to using Velocity. I am trying to use it to generate an HTML form. I am working in Eclipse. The following jars are in my classpath: velocity-dep-1.5.jar commons-collections.jar commons-lang.jar log4j-1.2.8.jar ant.jar I am running an ant build file to build my project, but I don't see the HTML being generated. Is there something I'm missing in order to get it to actually generate the HTML file? The tutorial I was following only has two files that I based mine off of. It worked

web-midi-api

你说的曾经没有我的故事 提交于 2020-01-02 14:41:03
MIDI (Musical Instrument Digital Interface) midi携带的信息:pitch, velocity (how loudly or softly a note is played), vibrato, volume, panning, modulation, and more midi 发送信息给daw :digital audio workstation convert the signals into written notation, 一 navigator.requestMIDIAccess() 4. request access to any MIDI devices (inputs or outputs) connected to your computer 5. The requestMIDIAccess() method returns a promise,so we need to establish success and failure callbacks. if ( navigator . requestMIDIAccess ) { console . log ( 'This browser supports WebMIDI!' ) ; } else { console . log ( 'WebMIDI is not

How to obtain csrf token in a velocity macro when using spring security

丶灬走出姿态 提交于 2020-01-02 10:30:10
问题 I am trying to create a custom login screen for a spring web security enabled application, and I cannot figure out how to pass the csrf token to velocity (no, I cannot use JSP at the moment). The model looks something like this: @RequestMapping(value = "/login", method = RequestMethod.GET) public ModelAndView login( @RequestParam(value = "error", required = false) String error, @RequestParam(value = "logout", required = false) String logout ModelAndView model = new ModelAndView(); if (error !

Eclipse and How it Handles JARS — Odd Case

时光总嘲笑我的痴心妄想 提交于 2020-01-02 10:02:59
问题 Trying to make some small changes to Apache's Velocity engine. Here's what I can and can't do. I'm making a change to the merge function(). The change I'm making doesn't matter because I haven't made it yet. ;) Right now I am settling for a println statement firing. I have two references to merge(). If I change the function to mergeBAD() Eclipse tells me that it can't find merge(). Makes sense right? I used to include in my class build path the two jars that you get when downloading velocity

Eclipse and How it Handles JARS — Odd Case

蹲街弑〆低调 提交于 2020-01-02 10:02:27
问题 Trying to make some small changes to Apache's Velocity engine. Here's what I can and can't do. I'm making a change to the merge function(). The change I'm making doesn't matter because I haven't made it yet. ;) Right now I am settling for a println statement firing. I have two references to merge(). If I change the function to mergeBAD() Eclipse tells me that it can't find merge(). Makes sense right? I used to include in my class build path the two jars that you get when downloading velocity

Using Velocity's WebappResourceLoader with Spring

血红的双手。 提交于 2020-01-02 07:53:08
问题 I'm trying to use Velocity to create an email template that is mailed by Spring's JavaMailSender class. The resource loader that I decided to use to find the Velocity template in my web app is WebappResourceLoader which is located in the Velocity tool jar. However, depending on how I use the WebappResourceLoader, I get either a NPE when the web app starts up or the template can't be found. If I specify the init properties for the Velocity engine in my Spring application context I get the NPE.

swipe left, right, up and down depending on velocity or other variables

杀马特。学长 韩版系。学妹 提交于 2020-01-02 05:55:57
问题 i've got a class extended from simple on gesture and i'm working with the onfling method: class MyGestureListener extends GestureDetector.SimpleOnGestureListener{ @Override public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { // TODO Auto-generated method stub float e1_X = e1.getX(); float e1_Y = e1.getY(); float e2_X = e1.getX(); float e2_Y = e2.getY(); if(velocityX > 0 && velocityX > velocityY){ text.setText("Swipe left"); }else if(velocityX < 0 &&

Use Velocity to generate HTML based email

℡╲_俬逩灬. 提交于 2020-01-02 05:28:06
问题 I try this tutorials http://www.java2s.com/Code/Java/Velocity/UseVelocitytogenerateHTMLbasedemail.htm but, when i add css, it look like not executed. <HTML> <HEAD> <TITLE>Pet Store Sale!</TITLE> <style type="text/css"> body { margin: 0 0 0 0; padding: 0 0 0 0; text-align: center; background-color: #FFF; border-top: 3px solid #CCC; } #container { position: relative; width: 860px; height: 1600px; margin: 84 auto 0 auto; padding: 0 0 0 0; background-color: #FFF; } p { font-family: times, Times