JSP 1.x Code Conventions - Open Discussion
This morning, we posted a draft set of recommendations on Coding Conventions for the JavaServer PagesTM Version 1.x Language. The article can be found here:
http://developer.java.sun.com/developer/technicalArticles/javaserverpages/code_convention/
The article is intended to be a first draft of coding conventions, and we're getting some great, high-quality feedback on our comments alias, [email protected] Keep 'em coming!
This alias is one-way only (from you to us), and we'd love to see a more collaborative feedback forum as well. I've started this topic as a place so that users can discuss and share their experiences with JSP coding conventions, as used in their organizations.
Please continue to send feedback to [email protected] as well!
Mark Roth, Java Software
Specification Co-Lead of JSP 2.0
Sun Microsystems, Inc.
The JSP guidelines suggest that
"Indentations should be filled with space characters. Tab characters cause different interpretation in the spacing of characters in different editors and should not be used for indentation inside a JSP."
It is a simple observation that using spaces instead of tab characters increases the returned content length. While this may seem insignificant, in my opinion it is not. for example, checking the trivial table sample in the guideline:
<table>
<% if { tableHeaderRequired ) { %>
<tr>
<th>Last Name</th>
<th>First Name</th>
</tr>
<% } %>
<c:forEach var="customer" items="${customers}">
<tr>
<td><c:out value="${customer.lastName}"/></td>
<td><c:out value="${customer.firstName}"/></td>
</tr>
</c:forEach>
</table>
using tabs in indentation results in 329 bytes of data, while using spaces results in 443 bytes, or about 35% more data! Testing on several real-world pages gave similar results. While this this certainly varies with content and coding style, following the indentation guidelines, which are extremely important for readability, will result in several indentation levels in an avarage line of nontrivial code, and an increase in data size of similar proportions. In my opinion this increase in traffic and processing is quite significant in a production server. Or, as I like to think of it, imagine an internet where all web servers were jsp-based, and that all web transactions were 35% slower...
Finally, the stated reason that 'Tab characters cause different interpretation in the spacing of characters in different editors' doesn't seem like a very strong case. Developers who want to view JSP sources are most likely JSP developers, which should have their editors or IDEs set to 4-space tabs in the first place, as the guideline suggests. Perhaps some editors I'm not aware of don't allow these settings, which can cause the stated problem.
I wonder if these consequences were taken into account when deciding on the guidelines.
Other than that, I think the guidelines are great, and as with the other Java programming convention guidelines, I hope they reach widespread use and become standard developer practice, for the benefit of all.
-Amichai
Similar Messages
-
How do I rent a move using moneyin my iTunes account. I had to enter the iTunes gift ard code to open the account several months ago, but never purchased anything with it. When I entered this code to rent a movie, the response was that it was redeemed. What am I doing wrong?
If you've already redeemed the card onto your account then its amount should be on your account - a card can only be redeemed once.
To rent a film, find the film in the store and (if the film studio has made it available as a rental in your country) click on its Rent button. If you are beig prompted to review your account and enter credit card details then see if this post from mountaingoatgirl lets you do so without entering card details : https://discussions.apple.com/message/24303054 . If that doesn't work then you should be able to remove your card's details after entering them.
As long as you account's balance covers the rental cost then only that should be charged. How purchases are billed : http://support.apple.com/kb/HT5582
When making purchases, content credits are used first, followed by Gift Certificate, iTunes Card, or Allowance Account credits; your credit card or PayPal account is then charged for any remaining balance. -
Can Anyone please point to a document or site which has information
about Naming or Code Conventions on SWING.
There are lot of documents for J2EE ,JSP and JMS naming conventions,
but could not find anything on SWING.
Any Help would be greatly appriciated."Code Conventions for the Java Programming Language" is found at
http://java.sun.com/docs/codeconv/index.html. Swing is no exception to these recommendations. -
Transaction code for Open sales order other than VA05
Hi all,
Can any one tell me what is transaction code for open sales order other than VA05.
Please help me .
Thanks & Regards ,
Srikanth P.Hi Srikanth,
You can try below options.
1- VA05N - This can be run for multiple sold to party & multiple material, etc which was not in VA05. But this doesn't have all columns in VA05 report.
2 - You can check the sales order tables from transaction SE11 or SE16N
Try with below tables for your requirement.
Sales order Header data - VBAK
Sales order Item data - VBAP
Schedule Line Data - VBEP
Business data - VBKD
Status header - VBUK
Status items - VBUP
Best regards,
Anupa -
Have messy code when open a xml publisher report in OAF
Dear all,
I use xml publisher to generate a pdf report in OAF,but have messy code when open pdf report in my local machine.
I try to change the pdf to html format,and the report display ok in local machine.
It's also ok when i run in server.
So i think may be my project'Character Encoding in Jdeveloper tool is wrong,
i try to set the character encoding 'UTF-8/UTF8/GBK/GB2312',
but still have messy code.
Here is my code:
public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
super.processFormRequest(pageContext, webBean);
OAApplicationModuleImpl am= (OAApplicationModuleImpl)pageContext.getApplicationModule(webBean);
String event = pageContext.getParameter("event");
if("GenerateReport".equals(event))
String auctionHeaderId=(String)pageContext.getParameter("auctionHeaderId");
Serializable[] Parameters = {auctionHeaderId};
// Get the HttpServletResponse object from the PageContext. The report output is written to HttpServletResponse.
DataObject sessionDictionary = (DataObject)pageContext.getNamedDataObject("_SessionParameters");
HttpServletResponse response = (HttpServletResponse)sessionDictionary.selectValue(null,"HttpServletResponse");
try {
ServletOutputStream os = response.getOutputStream();
// Set the Output Report File Name and Content Type
String contentDisposition = "attachment;filename=EmpReport.pdf";
response.setHeader("Content-Disposition",contentDisposition);
response.setContentType("application/pdf");
// Get the Data XML File as the XMLNode
XMLNode xmlNode = (XMLNode) am.invokeMethod("auctionHeaderById",Parameters);
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
xmlNode.print(outputStream);
ByteArrayInputStream inputStream = new ByteArrayInputStream(outputStream.toByteArray());
ByteArrayOutputStream pdfFile = new ByteArrayOutputStream();
//Generate the PDF Report.
TemplateHelper.processTemplate(
((OADBTransactionImpl)pageContext.getApplicationModule(webBean).getOADBTransaction()).getAppsContext(),
APP_NAME,
TEMPLATE_CODE,
((OADBTransactionImpl)pageContext.getApplicationModule(webBean).getOADBTransaction()).getUserLocale().getLanguage(),
((OADBTransactionImpl)pageContext.getApplicationModule(webBean).getOADBTransaction()).getUserLocale().getCountry(),
inputStream,
TemplateHelper.OUTPUT_TYPE_PDF,
null,
pdfFile);
// Write the PDF Report to the HttpServletResponse object and flush.
byte[] b = pdfFile.toByteArray();
response.setContentLength(b.length);
os.write(b, 0, b.length);
os.flush();
os.close();
catch(Exception e)
response.setContentType("text/html");
throw new OAException(e.getMessage(), OAException.ERROR);
pageContext.setDocumentRendered(false);
pls help me !
thanks,
Tao.Can anybody help me?
Best regards!
Tao -
T CODE FOR OPEN PERIOD.
Dear all Guru's
I know that for closing period the T.CODE is MMPV , Pl tell
me that wat is the code for opening period . & also suggest wat is to enter when using MMPV & ( T CODE for opening period.
rewarded if helps.
rcDear RC,
This T-code for opening period to company.
it means to plant reports will take every month.so we need to close plant transactions in every month ending.then only we will see the reports of every month of plant.
in MMPV we have to give company code and opening month name and press execute button.
this is the main uses and functions or MMPV.
Hope this will helps you
Prem. -
How do I write a javascript code to open InDesign File, import Doc, save and export to pdf?
Hi hasvi,
Need Template(.indt), textframes etc for the following script:
var myFolderInd = Folder.selectDialog();
var myFile = myFolderInd.getFiles("*indt");
app.open(myFile)
var myDoc = app.activeDocument;
var myDocName = myDoc.name;
var mySaveFile = app.activeDocument.save(myFolderInd.fsName + "/" + myDocName.split(".indt").join(".indd"));
var myFolderDoc = Folder.selectDialog();
var myFile1 = myFolderDoc.getFiles("*doc");
mySaveFile.pages[0].textFrames[0].place(File(myFile1))
//~ mySaveFile.place(File(myFile1))
app.activeDocument.textPreferences.smartTextReflow = true;
var myPDFFile = new File(mySaveFile.filePath + "/" + mySaveFile.name.split(".indd").join(".pdf"))
myDoc.exportFile(ExportFormat.PDF_TYPE, File("~/Desktop/abc.pdf"));
alert("Process Completed")
Regards
Siraj -
My iPad conveys that it is disabled, and that I need to connect to iTunes. When I connect to iTunes I get a message that I need to enter my pass code and open my Ipad, but I don't get the scree with the number board to open with a password. How do I fix this?
You will need to restore it. The sidebar of your iPad appears on itunes even if you dont enter the passcode. There's the option to restore it. More info:
iTunes: Backing up, updating, and restoring your iPhone, iPad, or iPod touch software -
My iPad conveys that it is disabled, and that I need to connect to iTunes. When I connect to iTunes I get a message that I need to enter my pass code and open my Ipad, but I don't get the screen to open with a password. How do I fix this?
You will need to restore it. It may not sync, but the iPad's sidebar has to appear you can restore it and it will be as the last time ou synced it to iTunes. For more info:
iTunes: Backing up, updating, and restoring your iPhone, iPad, or iPod touch software -
How to write a code for open new txt file in swing
hai all,
now i do one project in java.that project's GUI is Swing. But i don't known swing (basic).So how to write a code for open new txt file and "Open window " in menu item on swing.that means when i click the "New" on menu that time open a new txt file. open also like that type.
plz give me that code ! very urgent
Advance Thanks !
RSKSwing Tutorial:
http://java.sun.com/docs/books/tutorial/uiswing/index.html
Since you don't know the basic of swing read the tutorial, it is for your own good because it is useless if we provide you with a code you don't even understand and how it works.
If you want a menu read the tutorial about using menus and for opening a file read using JFileChooser.
note: don't use the word urgent because it implies that your problem is more important than others. -
How can we write the code for opening the command prompt and closing the
how can we write the code in java for opening the command prompt and closing the cmd prompt from eclipse (cmd prompt should close when click on the turminate button in eclipse)
rakeshsikha wrote:
how can we write the code for opening the command prompt and closing theBy typing in Eclipse (which you seemingly have)? -
Hi All,
being a complete Java(TM) newbie here is a very silly question.
After reading the "Java Code Conventions" (see http://java.sun.com/docs/codeconv/)
and studying here and there the Java core library source code (see src.zip
on your SDK installation) I was wondering what the heck is the characters
sequence @(#) behind the file class name in the header comment.
You can see it in all classes' source code and in paragraph 11.1 of the
aforementioned JCC. For example,
* @(#)WhatIsIt.java 1.82 04/09/02
* Copyright [...]
All the bestIt is some kind of a marker for the source code control system that Sun uses. When you make changes to the file the system knows to update the revision number ("1.82") and the modification date ("04/09/02") automatically thanks to the presence of "@(#)".
I think Sun uses a system called SCCS; you'd write something else.if you used RCS or CVS for instance. -
Switching between Design and JSP tabs add code?
I am new to SJSC and I am taking the time to go through all of the little odds & ends of the IDE.
I was looking at:
http://blogs.sun.com/roller/page/tor?entry=computing_html_on_the_fly
And I decided to try this.
When I add the following in the JSP tab:
<h:outputText binding="#{Page1.tableHtml}" id="outputText1"/>Save.
Then click on the Design tab, then go back to the JSP tab, I now have:
<h:outputText binding="#{Page1.tableHtml}" id="outputText1"/>
<h:outputText binding="#{Page1.outputText1}" id="outputText1"/>It's late here, but this doesn't make any sense, why would switching between Design and JSP tabs add code?
Thanks,
--ToddGirish: I followed these steps:
1.) Downloaded:
Sun Java Studio Creator 2, Multilanguage creator-2-windows-ml.exe 254.23 MB
2.) When I started the install, I received the message:
Welcome to Sun Java(TM) Studio Creator 2! You are installing: Sun Java Studio Creator 2 development environment Sun Java System Application Server Platform Edition 8.1 2005Q1 Update Release 2 Bundled database
3.) Installed version:
Product Version: Java Studio Creator 2 (Build 060120)
IDE Versioning: IDE/1 spec=5.9.1.1 impl=060120
Also, Under, the Palette window: Standard component list, there is a component labeled Output Text.
When placed on a jsp, the following code is produced:
<h:outputText binding="#{Page1.outputText1}" id="outputText1" style="position: absolute; left: 24px; top: 48px"/>Thanks,
--Todd -
My daughter was fooling around with the settings and now her ipod is locked and her code wont open it . what can we do
Forgotten Screen-Lock Passcode
Connect the iOS device to your computer and try to make a backup
iOS: How to back up
Then restore via iTunes. The iOS device will be erased. Place the iOS device in Recovery Mode if necessary to allow the restore.
If recovery mode does not work try DFU mode.
How to put iPod touch / iPhone into DFU mode « Karthik's scribblings
For how to restore:
iTunes: Restoring iOS software
To restore from backup see:
iOS: Back up and restore your iOS device with iCloud or iTunes
If you restore from iCloud backup the apps will be automatically downloaded. If you restore from iTunes backup the apps and music have to be in the iTunes library since synced media like apps and music are not included in the backup of the iOS device that iTunes makes.
You can redownload most iTunes purchases by:
Downloading past purchases from the App Store, iBookstore, and iTunes Store -
Need transaction code for opening Bex query designer?
Hi ALL,
Can anyone help me with the transaction code for opening Bex query designer?
Like RRMX for Bex Analyzer similarly i want for Bex query designer.
Thanks & Regards
Sameer KhanTHERE IS NO TCODE FOR QUERY DESIGNER. BUT THERE IS AN ALTERNATIVE..
OPEN BEX ANALYSER THROUGH RRMX
OPEN A QUERY
CLICK ON TOOLS-> EDIT QUERY
THIS OPENS QUERY DESIGNER AND YOU CAN USE IT NORMALLY..
Maybe you are looking for
-
I can't figure out how to find my pictures!!
I just had my iPhone 4s replaced today because I was having some technical trouble. I asked the guy who was helping me if I'd lose anything with transfering to the new phone and he told me I'd lose my videos and any progress in games or apps that did
-
Needs Steps to carry out packing in PP process.
Hi Friends, I need to know the step wise procedure ( With Tcodes) to pack the material which is produced in PP process (process order) and this should result in generation of handling units. I also would like to know any prerequisite configuration to
-
JCo Destination Failing With RFC_Error_COMMUNICATION
Hi Gurus, We installed a new Bi system with ABAP and JAVA stacks on different hardware and SIDs, now we have problem in integration where JCO BI Meta Data connection is giving following error if I test it. Ping is also failing. com.sap.mw.jco.JCO$Exc
-
Junk file downloaded when port number and connection scheme is mismatched
Hello All, I am facing a peculiar issue in my server running Apache Tomcat/5.5.9. I have a Tomcat server setup with 8080 and 8443 ports listening for http and https connections. When I access the tomcat welcome page hosted in my server as below, http
-
Hi, I want to close our plain-text FTP to the internet. Some customers migrated to a SSH FTP connection. Another one wnats to use SSL-FTP (Explicit) We are trieing to connect with a explicit connection in passive mode. We've tried Filezilla and WS_FT