question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Problem with conditional rendering in Velocity

See original GitHub issue

Hi tipsy,

did you noticed that the following code:

#if($loginRedirect)
    <input type="hidden" name="loginRedirect" value="$loginRedirect">
#end

does not render anytning? Note that the previous code has been taken from your project https://javalin.io/tutorials/website-example. I’ve tested it and concluded that the #if block can render e.g. <p> tag, but not the <input> tag. It is clear that the problem is related to Velocity and not to Javalin, but I wonder can you help with this and probably update your project?

Tested with Velocity 2.0 and 2.3 and the result is the same.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
tipsycommented, Jul 5, 2021

I don’t have time to debug that particular application, but I can give you a more general tip. It’s much easier to debug what’s going on with a template engine if you remove Javalin and the browser from the equation. Implement your own template engine method that just print templates directly to system out.

0reactions
tipsycommented, Jul 6, 2021

That is very strange, I would report it as a bug to Firefox. I’m glad you figured it out, I will close the ticket now 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Velocity syntax for conditional statement with two or more ...
I thought this would be simple, but I am trying to check for multiple conditions on an "if" statement in Velocity using the...
Read more >
User Guide - Apache Velocity Engine
Rendering ¶. The final value resulting from each and every reference (whether variable, property, or method) is converted to a String object when...
Read more >
Connect two conditions in one #elseif() statement
length()==0) AND ($suspectYesNo.value.contains("true")) in one #elseif(). Or did I define the boolean wrong? #if($p2.
Read more >
Writing conditional statement in Velocity Markup Fail - Forums
The condition for displaying the the down arrow is that the nav item name is either “Tools” or “Administration”.
Read more >
Velocity Templates Developer Guide
If a problem is discovered with a template that renders a particular control, or the control object has been updated and the template...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found