0

I am trying to convert my DWT page template to Razor template. This Page template has following JSP Code.

 <%@ taglib uri="http://jakarta.apache.org/taglibs/xtags-1.0" prefix="xtags" %>
 <%@ taglib uri="cd_tags" prefix="tridion" %>
 <%@page pageEncoding="utf-8" %>
 <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
 <%@ taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt" %>
 <!DOCTYPE html>
 <!-- HEADER BEGIN-->

 <%

 String str_date="@Package.formattedDate";
 java.text.DateFormat formatter ; 
 java.util.Date date ; 

 formatter = new java.text.SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
 date = (java.util.Date)formatter.parse(str_date);

 Long formattedDateLong = date.getTime();

 response.setDateHeader("Last-Modified", formattedDateLong );

 String PageID= "@Page.ID";
 String ContactUsReferrer = request.getParameter("source");
 String CRMTrackingCode = "@Package.CRM_Tracking_Code";
 String DefaultCRMTrackingCode = "@Package.Default_CRM_Tracking_Code";

 %>

When I try to save it I get following error

"(80040000) TemplateCompileException: CS1501: No overload for method 'Write' takes 0 arguments 
Line 27 Column 1:         public override void Execute() {
WriteLiteral("<%");
 * Write();
WriteLiteral(" taglib uri=\"http://jakarta.apache.org/taglibs/xtags-1.0\" prefix=\"xtags\" %>\n<%");
Write();

CS1501: No overload for method 'Write' takes 0 arguments 
Line 32 Column 1: Write();
WriteLiteral(" taglib uri=\"http://jakarta.apache.org/taglibs/xtags-1.0\" prefix=\"xtags\" %>\n<%");
 * Write();
WriteLiteral(" taglib uri=\"cd_tags\" prefix=\"tridion\" %>\n<%");
Write(page);

CS0103: The name 'page' does not exist in the current context 
Line 37 Column 7: Write();
WriteLiteral(" taglib uri=\"cd_tags\" prefix=\"tridion\" %>\n<%");
 * Write(page);
WriteLiteral(" pageEncoding=\"utf-8\" %>\n<%");
Write();

CS1501: No overload for method 'Write' takes 0 arguments 
Line 42 Column 1: Write(page);
WriteLiteral(" pageEncoding=\"utf-8\" %>\n<%");
 * Write();
WriteLiteral(" taglib uri=\"http://java.sun.com/jstl/core\" prefix=\"c\" %>\n<%");
Write();

CS1501: No overload for method 'Write' takes 0 arguments 
Line 47 Column 1: Write();
WriteLiteral(" taglib uri=\"http://java.sun.com/jstl/core\" prefix=\"c\" %>\n<%");
 * Write();
WriteLiteral(" taglib uri=\"http://java.sun.com/jstl/fmt\" prefix=\"fmt\" %>\n<!DOCTYPE html>\n<!-- H" +
"EADER BEGIN-->\n\n<%\n\nString str_date=\"");

How can I remove these errors ?

2

If I'm not wrong, in Razor you need to add "@:" or "<text>" in-front of all these tags,

Example 1:

@:<%@ taglib uri="http://jakarta.apache.org/taglibs/xtags-1.0" prefix="xtags" %>
@:<%@ taglib uri="cd_tags" prefix="tridion" %>
@:<%@page pageEncoding="utf-8" %>
@:<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
@:<%@ taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt" %>

Example 2:

<text><%@ taglib uri="http://jakarta.apache.org/taglibs/xtags-1.0" prefix="xtags" %></text>
<text><%@ taglib uri="cd_tags" prefix="tridion" %></text>
<text><%@page pageEncoding="utf-8" %></text>
<text><%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %></text>
<text><%@ taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt" %></text>
| improve this answer | |
  • 2
    It should be enough to escape them by just using '@@' instead of '@'. – Ant P Mar 10 '15 at 16:26
  • 1
    Thanks Siva and Ant for providing useful inputs which helped me in fixing the issue. – user3560198 Mar 12 '15 at 5:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.