Hi all,
this is workable code fragment of portlet passing some data to vm-template:
//-----------------------------------------------
//rundata - RunData object
//template - String, name of vm-template ("result.vm")
Context context = TurbineVelocity.getContext();
context.put("portlet", this);
TurbinePull.populateContext(context, rundata);
ClearElement element = null;
try {
//get data for current portlet
if (context.get("editValue") == null) {
//get "editValue" from initial parameter
context.put("editValue", getPortletConfig().getInitParameter("editValue"));
}
if (context.get("selectValue") == null) {
//get "selectValue" from initial parameter
context.put("selectValue", getPortletConfig().getInitParameter("selectValue"));
}
if (context.get("passwordValue") == null) {
//get "passwordValue" from initial parameter
context.put("passwordValue",
getPortletConfig().getInitParameter("passwordValue"));
}
//make HTML
String templatePath = TemplateLocator.locatePortletTemplate(rundata, template);
String s = TurbineVelocity.handleRequest(context, templatePath);
element = new ClearElement(s);
//doing this because setContent() is not overwriting current content.
clearContent();
setContent(element);
} catch (Exception e) {
element = new ClearElement(e.toString());
}
TurbineVelocity.requestFinished(context);
"
//-----------------------------------------------
and this is result.vm:
#if (!$editValue)
#set ( $editValue = "edit value is null" )
#end
#if (!$selectValue)
#set ( $selectValue = "select value is null" )
#end
#if (!$passwordValue)
#set ( $passwordValue = "password value is null" )
#end
Edit value<br>
<b>$editValue</b><br>
Select value<br>
<b>$selectValue</b><br>
Password value<br>
<b>$passwordValue</b>
And the question is: how can i create portlet passing the same data
into JSP-template? And what must be in JSP-template?
Thanks in advance.
Best regards,
Den_M
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>