Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » Generating a JSP JET2 template
Generating a JSP JET2 template [message #478906] Fri, 07 August 2009 12:34 Go to next message
Markus Backman is currently offline Markus BackmanFriend
Messages: 3
Registered: July 2009
Junior Member
Hi

I am having trouble to generate a JET2 template that contains JSP code.

Here is the template
<%@ taglib uri="http://ibm.com/portlet/aggregation" prefix="portlet" %>

<portlet:init portletURLPrefix="<%=request.getContextPath()%>">

<c:iterate select="$portal/layout" var="section">
<portlet:section templateSection="<c:get
select="$section/@template"/>"/>
</c:iterate>

</portlet:init>

The xml model is simply

<portal>
<layout>
<section>myTemplate1</section>
<section>myTemplate2</section>
</layout>
</portal>

If I run the tranformation I recive a
"Error: Could not find template templates/WebContent/portal.jet". The jet
template is located there. So by removing the taglib declaration on the
top I get "An internal error occured during: "Launching"". Locking in the
Error Log I see this.

java.lang.Error: Unresolved compilation problems:
request cannot be resolved
at org.eclipse.jet.compiled._jet_portal.generate(_jet_portal.ja va:86)
at
org.eclipse.jet.transform.TransformContextExtender.execute(T ransformContextExtender.java:146)
at
org.eclipse.jet.transform.TransformContextExtender.execute(T ransformContextExtender.java:119)
at
org.eclipse.jet.internal.taglib.workspace.FileTag.doAction(F ileTag.java:102)
at
org.eclipse.jet.internal.runtime.SafeEmptyRuntimeTag$1.doRun (SafeEmptyRuntimeTag.java:50)
at
org.eclipse.jet.internal.runtime.SafeCustomRuntimeTag$TagSaf eRunnable.run(SafeCustomRuntimeTag.java:73)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
at org.eclipse.core.runtime.Platform.run(Platform.java:843)
at
org.eclipse.jet.internal.runtime.SafeEmptyRuntimeTag.doStart (SafeEmptyRuntimeTag.java:44)
at org.eclipse.jet.compiled._jet_main.generate(_jet_main.java:5 00)
at
org.eclipse.jet.transform.TransformContextExtender.execute(T ransformContextExtender.java:146)
at
org.eclipse.jet.transform.TransformContextExtender.execute(T ransformContextExtender.java:119)
at org.eclipse.jet.JET2Platform$4.run(JET2Platform.java:430)
at
org.eclipse.jet.internal.runtime.JETBundleManager.run(JETBun dleManager.java:336)
at org.eclipse.jet.JET2Platform.runTransform(JET2Platform.java: 398)
at org.eclipse.jet.internal.launch.JETProcess.run(JETProcess.ja va:158)
at
org.eclipse.jet.internal.launch.JET2TransformationDelegate.l aunch(JET2TransformationDelegate.java:60)
at
org.eclipse.debug.internal.core.LaunchConfiguration.launch(L aunchConfiguration.java:639)
at
org.eclipse.debug.internal.core.LaunchConfiguration.launch(L aunchConfiguration.java:565)
at
org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(D ebugUIPlugin.java:754)
at
org.eclipse.debug.internal.ui.DebugUIPlugin$6.run(DebugUIPlu gin.java:944)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:58)

Is there a way to get JET2 to generate JSP files?

Best regards,
Markus
Re: Generating a JSP JET2 template [message #478912 is a reply to message #478906] Fri, 07 August 2009 13:16 Go to previous message
Paul Elder is currently offline Paul ElderFriend
Messages: 849
Registered: July 2009
Senior Member
Markus:

The problem is that JSP elements - directives (<%@), scriptlets(<%) and expressions (<%=) are also JET syntax. (You'd have the sample problem if you were trying to generate a JSP from a JSP.)

The solution: the judicious use of backslash (\) to escape JSP directives, scriptlets and expressions that the JET compiler would otherwise think are JET elements.

JET tries to follow JSP escaping practices. General rule: the backslash goes after the <. So <\%=, <\%@, <\%, etc..

Here's my reworking of your template:

<\%@ taglib uri="http://ibm.com/portlet/aggregation" prefix="portlet" %>

<portlet:init portletURLPrefix="<\%=request.getContextPath()%>">

<c:iterate select="$portal/layout" var="section">
<portlet:section templateSection="<c:get
select="$section/@template"/>"/>
</c:iterate>

</portlet:init>

Paul
Previous Topic:String concatenation in MTL scripts
Next Topic:Errors in generator when adding xtend/xpand nature
Goto Forum:
  


Current Time: Fri Mar 29 15:41:11 GMT 2024

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

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

Back to the top