aspose file tools*
The moose likes JSP and the fly likes Naming convention for JSP File Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Naming convention for JSP File" Watch "Naming convention for JSP File" New topic
Author

Naming convention for JSP File

Cyrus Serrano
Ranch Hand

Joined: Sep 29, 2003
Posts: 137
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

Joined: Jan 10, 2002
Posts: 61766
    
  67

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.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper

Joined: Aug 26, 2006
Posts: 4968
    
    1

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

Joined: Sep 29, 2003
Posts: 137
hi bear,

what's with the OS issue?

thanks
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

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.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Cyrus Serrano
Ranch Hand

Joined: Sep 29, 2003
Posts: 137
thanks Ben.. c",)
ankur rathi
Ranch Hand

Joined: Oct 11, 2004
Posts: 3830
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'???
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Naming convention for JSP File