Note that there are some explanatory texts on larger screens.

plurals
  1. POJSTL error in freemarker template
    primarykey
    data
    text
    <p>I am trying to implement JSTL in Freemarker template. To do that, I got a sample freemarker template example and tried to incorporate JSTL namespace and trying to execute it. Here is how my code looks right now.</p> <pre><code>&lt;html&gt; &lt;head&gt;&lt;title&gt;ViralPatel.net - FreeMarker Spring MVC Hello World&lt;/title&gt; &lt;#assign c=JspTaglibs["http://java.sun.com/jstl/core"]/&gt; &lt;style&gt; body, input { font-family: Calibri, Arial; margin: 0px; padding: 0px; } #header h2 { color: white; background-color: #3275A8; height: 50px; padding: 5px 0 0 5px; font-size: 20px; } .datatable {margin-bottom:5px;border:1px solid #eee;border- collapse:collapse;width:400px;max-width:100%;font-family:Calibri} .datatable th {padding:3px;border:1px solid #888;height:30px;background-color:#B2D487;text-align:center;vertical-align:middle;color:#444444} .datatable tr {border:1px solid #888} .datatable tr.odd {background-color:#eee} .datatable td {padding:2px;border:1px solid #888} #content { padding 5px; margin: 5px; text-align: center} fieldset { width: 300px; padding: 5px; margin-bottom: 0px; } legend { font-weight: bold; } &lt;/style&gt; &lt;body&gt; &lt;div id="header"&gt; &lt;H2&gt; &lt;a href="http://viralpatel.net"&gt;&lt;img height="37" width="236" border="0px" src="http://viralpatel.net/blogs/wp-content/themes/vp/images/logo.png" align="left"/&gt;&lt;/a&gt; FreeMarker Spring MVC Hello World &lt;/H2&gt; &lt;/div&gt; &lt;div id="content"&gt; &lt;c:set var="Salary" value="4000/&gt; &lt;c:out value="${Salary}/&gt; &lt;fieldset&gt; &lt;legend&gt;Add User&lt;/legend&gt; &lt;form name="user" action="add.html" method="post"&gt; Firstname: &lt;input type="text" name="firstname" /&gt; &lt;br/&gt; Lastname: &lt;input type="text" name="lastname" /&gt; &lt;br/&gt; &lt;input type="submit" value=" Save " /&gt; &lt;/form&gt; &lt;/fieldset&gt; &lt;br/&gt; &lt;table class="datatable"&gt; &lt;tr&gt; &lt;th&gt;Firstname&lt;/th&gt; &lt;th&gt;Lastname&lt;/th&gt; &lt;/tr&gt; &lt;#list model["userList"] as user&gt; &lt;tr&gt; &lt;td&gt;${user.firstname}&lt;/td&gt; &lt;td&gt;${user.lastname}&lt;/td&gt; &lt;/tr&gt; &lt;/#list&gt; &lt;/table&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>I know the problem is with the new code I added i.e Salary and I see the following error.</p> <pre><code>freemarker.core.InvalidReferenceException: Expression Salary is undefined on line 62, column 5 in index.ftl. at freemarker.core.TemplateObject.assertNonNull(TemplateObject.java:124) </code></pre> <p>What am I doing wrong? </p> <p>Thanks Nikhil</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload