I added textfield and a button in velocity script that is used through a web app. When web app is launched start.properties file is read. There's a property: debug_on that can take two values 0 or 1.
So I want to display textfield and the button according to debug_on value. It can be done in velocity script via javascript, if I'm not mistaken (I'm not a pro in JavaScript), but I need to get the property value in order to move further.
How can I achieve it?
UPDATED
Velocity script example where main GWT (Java) code is embedded at the end:
<!--doctype head declaration-->
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Web App</title>
<style>
<!-- styles -->
</style>
<link rel="stylesheet" href="/css/webapp.css" type="text/css"/>
<meta name='gwt:module' content='$uri'>
</head>
<body>
<script language="javascript" src="/$uri/com.myproject.gwt.main.nocache.js"></script>
<!-- TextField and button are located here -->
<table style="width: 300px; height: 100px;" class="gwt-DialogBox" cellpadding="0" cellspacing="5">
<!-- some other part of a page tha will be persistent through all GWT pages -->
</table>
</body>
</html>
Velocity runs on the server, JavaScript runs on the client and will not have access to any of the server's files.
You can use Velocity to set values within a JavaScript block and have a JS function use those values.
<script type='text/javascript'>
var startValue = '$debug.value';
</script>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.