Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
Win a copy of Java EE 8 High Performance this week in the Java/Jakarta EE forum!

Vijitha Kumara

+ Follow
since Mar 24, 2008
Vijitha likes ...
Chrome Fedora Hibernate
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Rancher Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Vijitha Kumara

You seem to have some conflicts in your directories, why you have jess.jar along with your class/source files as in above attachment, but you refer that from another location?

You may try compiling with -d option and point that to the -cp when running so that your class/jar files are separated from source (though this is not a mandatory to run, but just to make sure...)
5 days ago
Your -cp entries should be separated by ";" not ":" in Windows.
6 days ago
I can't verify this with IntelliJ now, but you can try creating a maven project via command line (mvn quickstart), and try importing that in to the IDE and see whether any errors are there.
6 days ago
Not sure what you mean by moving Classes in to different directories, but you shouldn't make methods private/public just because you need to run tests.

And one approach to manage your tests would be put the test Classes in a similar package as with the source but under the test directory.
1 week ago
Where is your build (compiled) class files are located? You may have to run the command from the top level of the directory hierarchy and set the "classpath" to the appropriate path(s) to find the dependent classes. See how you can set the classpath here
1 week ago
In general though you may need to cover your tests in the reviews (given you have a proper test coverage in the project). Perhaps, people strictly follow TDD does this, I'm not sure...

Only thing I can think of now for starting with test is that you may skip reviewing real code until you satisfy with test code. (but that may depends on the nature of the project/team), just a thought...
1 week ago
A bit old detailed explanation from GlassFish implementation is listed here
Hi Richard,

How would you justify the performance aspects of a system when you move to MS specially when you consider the latency etc..., invoking separate out of process services as opposed to processes running on the same server?
1 month ago

What's your thoughts on making old legacy systems as microservices? Do you discuss about the approaches/best practices in the book?

I see some references to monolithic systems under Services chapter but do you discuss in detail about the process?
1 month ago
Welcome to the Ranch!
1 month ago
Have you defined security-role in web.xml?
4 months ago
Did you check the certificates (you seems to have control in the server too?) in the server? May be you need to check with installing them in your client JVM.
4 months ago
Problems, Questions and Solutions

JstlUriNotResolved: What to do about "The absolute uri: cannot be resolved "

ResourceUrlProblems: Why don't images load? or style sheets? Or script files? Why a 404 on form submit?

TypesOfPaths: What are the different types of paths used in Java web apps?

JavaScriptAndJsp: What's all this about not mixing JavaScript and JSP?

CanIMixJSPWithJavaScript: Can you mix JSP and JavaScript?

RedirectForward: What is the difference between a sendRedirect and a forward?

JspOrServlets: JSP versus Servlets, which is better?

WhyNotUseScriptlets: Why shouldn't you put java in your JSP?

BeansNotFound : Why can't the server find my beans?

IllegalStateException: The most common cause of IllegalStateException, and an easy rule of thumb for preventing it.

IncludesActionDirective : What is the difference between the include directive and  the include action?

ElOrJstlNotWorkingAsExpected : EL not evaluating? JSTL not working as you expect?

WeirdWordCharacters: Word-generated "Smart quotes" getting you down?

ScripletVariablesAndTheEl: Why can't the EL access my scriplet variables?

Model1Model2MVC: What is the difference between Model 1 and Model 2? What is MVC?

HtmlHasNoComboBox:  What is a Combo Box? Why it's important not to refer to HTML select lists as Combo Boxes.

WhyNotUseJstlSqlActions: Why should the JSTL SQL actions (tags) be avoided?

WhichVersionAmIRunningOn: If you're not sure what the server your code is running on supports


SpecificationUrls : Locations of relevant specifications (Servlets, JSP, JSTL)

The 2nd edition of Volume 1 of Core Servlets and JSP has the second edition available as a free PDF.

JavaRanchJournalArticles : Java Ranch Journal articles relevant to JSPs

JstlTagLibDefinitions : Download locations and URIs for JSTL 1.0 and JSTL 1.1

Introduction to JSTL: part 1 - EL, part 2 - Core, part 3 - Formatting and I18N, part 4 - XML and SQL

How To's

SetupJstlForJsp2 : How to set up the JSTL 1.1 for JSP 2.0

ServletsWebXml : Setting up a web.xml file for Servlets 2.4 (Note: required in Tomcat 5 to enable the EL)

PackageYourBeans : Why you should always put your Java classes into a specific package.

DefineELFunctions : How do I define EL functions that map to static methods?

DoubleSubmitProblem : How to avoid duplicate submissions?

NoCacheHeaders : Want to prevent the browser from caching the page?

JspAndExcel : How to download Excel spreadsheets from a JSP

FileUpload : How do I upload a file with JSP/Servlets?

PaginationOrPaging : How do I limit the number of rows displayed in the browser?

PostRedirectGet : A simple example of the PRG pattern implemented in a JSP page.

JstlTable : Using nested JSTL forEach tags to display a table in an HTML page

RelativeLinks: How to build robust relative links in Servlet and JSP applications


CategoryFaq ServletsFaq TomcatFaq
5 months ago
JSP 2.0 was introduced in 2002 with the JSTL and EL intended to replace Java scriptlets in JSP pages. 2002! In 2017, that is over 15 years ago! If you are still using scriptlets in JSPs, you are 15 years behind the times.

15 years!

Java scriptlets have been obsolete and discredited since the introduction of JSP 2.0 and there are many good reasons not to use Java scriptlets in JSPs including:

  • Readability -  There are already enough syntaxes in web pages -- HTML, JavaScript and CSS. Using JSTL tags in the view just makes pages easier to read without a lot of Java code jumbled into them. Keep the Java code in Java classes where it belongs.
  • Separation of Concerns - Best practices dictate that presentation logic and business logic should not be mixed.
  • Reusability - How would one reuse the Java code in a JSP in another JSP page or in a Java class?
  • Maintainability - A database column changes and you will be hunting through all your JSPs for places to change. Better to do this in Java classes lets where it can be easily refactored.
  • Scriptlets Break OOP - scriptlets cannot be extended or encapsulated.
  • Getting business logic out of JSPs lets you take advantage of the Java bean paradigm

  • Due to the above, a developer using scriptlets is a clear warning sign that a developer:

  • Is not serious about their craft
  • Does not know what they are doing
  • Does not care to follow best practices
  • Has not updated their skills in over 15 years
  • All of the above

  • Do you want this to be you?

    This Javaranch Journal article explains the evolution of modern best practices with regards to web application structure.

    5 months ago