{"id":480,"date":"2014-05-23T07:30:12","date_gmt":"2014-05-23T07:30:12","guid":{"rendered":"http:\/\/codethataint.com\/blog\/?p=480"},"modified":"2014-05-23T07:32:20","modified_gmt":"2014-05-23T07:32:20","slug":"importing-a-simple-class-in-jsp","status":"publish","type":"post","link":"https:\/\/codethataint.com\/blog\/importing-a-simple-class-in-jsp\/","title":{"rendered":"Importing a simple class in JSP"},"content":{"rendered":"<p><strong>Importing a Java Method in to JSP Page<\/strong><\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\npackage com.mugil.servlet;\r\n\r\npublic class Sample1 \r\n{\r\n  static int pincode = 600018;\r\n  \r\n  public String toString()\r\n  {\t\r\n    return &quot;600018&quot;;\r\n  }\r\n}\r\n<\/pre>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\n&lt;%@ page language=&quot;java&quot; contentType=&quot;text\/html; charset=ISO-8859-1&quot;\r\n    pageEncoding=&quot;ISO-8859-1&quot;%&gt;\r\n&lt;%@ page import = &quot;com.mugil.servlet.Sample1&quot;%&gt;    \r\n &lt;body&gt;\r\n   &lt;%=new Sample1()%&gt;\r\n &lt;\/body&gt;\r\n<\/pre>\n<p><strong>Note: <\/strong><br \/>\nThe following Code wont work<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\n  &lt;%=new Sample1();%&gt;\r\n  &lt;% =new Sample1()%&gt;\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Importing a Java Method in to JSP Page package com.mugil.servlet; public class Sample1 { static int pincode = 600018; public String toString() { return &quot;600018&quot;; } } &lt;%@ page language=&quot;java&quot; contentType=&quot;text\/html; charset=ISO-8859-1&quot; pageEncoding=&quot;ISO-8859-1&quot;%&gt; &lt;%@ page import = &quot;com.mugil.servlet.Sample1&quot;%&gt; &lt;body&gt; &lt;%=new Sample1()%&gt; &lt;\/body&gt; Note: The following Code wont work &lt;%=new Sample1();%&gt; &lt;% =new Sample1()%&gt;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[53,11],"tags":[],"class_list":["post-480","post","type-post","status-publish","format-standard","hentry","category-jsp","category-servlets"],"_links":{"self":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/480","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/comments?post=480"}],"version-history":[{"count":4,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/480\/revisions"}],"predecessor-version":[{"id":484,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/480\/revisions\/484"}],"wp:attachment":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/media?parent=480"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/categories?post=480"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/tags?post=480"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}