Skip to main content



      Home
Home » Modeling » M2T (model-to-text transformation) » get a JET variable in a scriptlet
get a JET variable in a scriptlet [message #24433] Thu, 28 June 2007 10:02 Go to next message
Eclipse UserFriend
Hi,
I would like to simply access a variable value in a scriptlet but Im stuck.

<c:setVariable var="varName" select="$person/@name" />
<%
if(context.hasVariable("varName"))
{
String tmp = (String)context.getVariable("varName");
System.out.println("varName is : "+ varName);
}
%>

But this doesn't work. There is a problem during the parsing to a
String. What is the right way ?

Thanks,
Tex.
Re: get a JET variable in a scriptlet [message #24514 is a reply to message #24433] Thu, 28 June 2007 10:22 Go to previous message
Eclipse UserFriend
This works better :
<c:setVariable var="varName" select="string($person/@name)" />
<%
if(context.hasVariable("varName"))
{
String tmp = (String)context.getVariable("varName");
System.out.println("varName is : "+ varName);
}
%>




Tex Twil wrote:
> Hi,
> I would like to simply access a variable value in a scriptlet but Im stuck.
>
> <c:setVariable var="varName" select="$person/@name" />
> <%
> if(context.hasVariable("varName"))
> {
> String tmp = (String)context.getVariable("varName");
> System.out.println("varName is : "+ varName);
> }
> %>
>
> But this doesn't work. There is a problem during the parsing to a
> String. What is the right way ?
>
> Thanks,
> Tex.
>
>
Previous Topic:simple IF .. ELSE statement
Next Topic:Re: invoke template from java with string return?
Goto Forum:
  


Current Time: Wed Mar 12 00:38:43 EDT 2025

Powered by FUDForum. Page generated in 0.03626 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top