Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Naming convention for JSP File

 
Cyrus Serrano
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,

Do we have a standards on how to name JSP Files. or we just name them the way we want.

thanks.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64828
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I do not believe that any one convention has attained pattern status. I tend to use all lowercase to avoid casing issues across operating systems, and make sure that the names are descriptive.
 
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Browsing the internet, I always notice when a URL ends in the word Servlet or .do or .jsp. I always note the way the JSP files are named.

I see many places follow the rule of naming JSP files the same way method names or variable names are named. Not sure why, since a JSP is really a Servlet class, so I'd figure class naming would more logically apply, but that's what I see.

Now, I have two thoughts on this:

1. URLs are typically all lowercase. Even looking at the JavaRanch URL, all the letters seem to be lowercase, although it's not a Java app, but that's another story.

2. Since urls are not type-checked, and you can't be positive of consistent casing through design-time checking, I say just make them lower case. In fact, any time there is a String that is not design-checked, my rule is to always make it lower case. I really hate tracking down NullPointerExceptions, only to find out that someone used an all upper case letter parameter name in an HTML form, but an all lowercase name in the Servlet obtaining the user input.

But, these are just opinions, and there is compelling evidence that indicates that many of my opinions are wrong.

Cheers!

-Cameron McKenzie
 
Cyrus Serrano
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi bear,

what's with the OS issue?

thanks
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Cyrus Serrano:
hi bear,

what's with the OS issue?

thanks


Unix derived OSs (Linux, OSX, Solaris, etc..) are case sensitive.
Windows is not.

This can lead to problems if you have two files one named 'myFile.jsp' and another named 'myfile.jsp'.

Using lower case for all of them eliminates any confusion.
 
Cyrus Serrano
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks Ben.. c",)
 
ankur rathi
Ranch Hand
Posts: 3830
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ben Souther:


Unix derived OSs (Linux, OSX, Solaris, etc..) are case sensitive.
Windows is not.

This can lead to problems if you have two files one named 'myFile.jsp' and another named 'myfile.jsp'.

Using lower case for all of them eliminates any confusion.


How???

And using all lower case reduces readability, IMO.

What's the issue with 'myOwnFile.jsp'???
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic