Question
Tata Consultancy Services
MX
Last activity: 14 Jun 2021 7:38 EDT
How to set image name dynamically in HTML
I am using the below code to set the image in HTML and later displaying it in the section:
<html>
<head>
<title>QR Test</title>
<style type="text/css">
div.boxed { border-style: solid; }
</style>
</head>
<body>
<div class='boxed'>
<img src='<pega:contentURL name="TestQRCode.png" path="/qrcode/" classType="Image"/>' >
</div>
</body>
</html>
But I have to pass the image name dynamically. So I used the below code :
<html>
<head>
<title>QR Test</title>
<style type="text/css">
div.boxed { border-style: solid; }
</style>
</head>
<body>
<div class='boxed'>
<img src='<pega:contentURL name=<%= tools.findPage("pyWorkPage").getProperty(".Property1").getStringValue()%> path="/qrcode/" classType="Image"/>' >
</div>
</body>
</html>
But I am getting the below error:
content of stream definition—
An expected quote character is not found after attribute name.
I am using the below code to set the image in HTML and later displaying it in the section:
<html>
<head>
<title>QR Test</title>
<style type="text/css">
div.boxed { border-style: solid; }
</style>
</head>
<body>
<div class='boxed'>
<img src='<pega:contentURL name="TestQRCode.png" path="/qrcode/" classType="Image"/>' >
</div>
</body>
</html>
But I have to pass the image name dynamically. So I used the below code :
<html>
<head>
<title>QR Test</title>
<style type="text/css">
div.boxed { border-style: solid; }
</style>
</head>
<body>
<div class='boxed'>
<img src='<pega:contentURL name=<%= tools.findPage("pyWorkPage").getProperty(".Property1").getStringValue()%> path="/qrcode/" classType="Image"/>' >
</div>
</body>
</html>
But I am getting the below error:
content of stream definition—
An expected quote character is not found after attribute name.
Could you please help me so that I can pass the image name dynamically