NetBeans v6.9.1 Notes

hundredhonkΛογισμικό & κατασκευή λογ/κού

15 Αυγ 2012 (πριν από 5 χρόνια και 3 μήνες)

273 εμφανίσεις

These instructions lead you through step-by-step in setting up NetBeans projects so that they:
will run the file named index.html (rather than index.jsp) when you select Run -> Run Main Project from the NetBeans main
menu (or press the F6 key or click the green right arrow button)
automatically create an XHTML file that will validate against the
W3C Markup Validation Service when you request NetBeans to make
an XHTML file
Step 1: Make Tomcat Recognize index.html as a Startup File
Edit the web.xml file
expand the Web Pages treea.
expand the WEB-INF treeb.
double-click web.xml to bring up the file in the editor windowc.
click Pages to get to the screen shown below

Add index.html and index.html to the Welcome Files list as shown above, separated by commas

Click the Save all files icon to save your changes3.
if this icon is disabled (grayed out), it is probably because the Welcome Files text box still has focus
in that case, press the TAB key and the Save all files icon should become active

etBeans v6.9.1 Notes 1 10:18 P
Close the

web.xml editor4.
Step 2: Modify the HTML Template for Use in This Course
Select Tools -> Templates to open the Template Manager

Copy the HTML template (do not copy the XHTML template, as doing so makes the process more complex)2.
scroll down and expand the Web tree
select the HTML entry and click the Duplicate button

This will create a new entry in the list named Html_1.xhtml
highlight this entry and click the Rename button
rename this entry to something more meaningful – I named mine XHTML-JMH
etBeans v6.9.1 Notes 2 10:18 P

Open the renamed file in the editor
IMPORTANT NOTE: When you open the duplicated file, you will see the following message. Just click the Yes
button to continue. This error will go away when you edit the file in the next step.
etBeans v6.9.1 Notes 3 10:18 P
Edit the text so that it looks as shown below, obviously replacing the information specific to me with your own

here is the text for cutting and pasting
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
Document : ${name}.html
Created on : ${date} at ${time}
Author : ${user}, replace with your e-mail address
91.461 GUI Programming I, Spring 2010
UMass Lowell Computer Science
<html xmlns="">
<meta http-equiv="Content-type" content="text/html; charset=UTF-8" />
<meta name="Author" content="replace with your name, your e-mail address" />
<title>desired page title</title>
TODO write content
Save the template and close the editing window6.
Step 3: Create an XHTML File Using Your Template
Highlight the Web Pages entry in your projects window

Ask NetBeans to create a new file by selecting File -> New File... from the NetBeans main menu or by typing Ctrl+N

In the Categories pane, select Web, and in the File Types pane, select your own XHTML template (mine is called XHTML-JMH)3.
etBeans v6.9.1 Notes 4 10:18 P

Click the Next> button

Name your file (change the default, which is newHtml_1) and click the Finish button5.
if you name your file index, so that NetBeans creates index.html, it can be the startup file for your web application
to make your index.html file the startup file rather than the original index.jsp file, simply delete the index.jsp file
etBeans v6.9.1 Notes
5 10:18 P
Step 4: Test Your XHTML File
If you named your file index.html and deleted the original index.jsp file, select Run -> Run Main Project from the NetBeans main
menu (or press the F6 key or click the green right arrow button) to display it in your default browser

If you named your file something else, right-click it and select Run File (or select the file and press Shift-F6) to display it in your
default browser
etBeans v6.9.1 Notes 6 10:18 P
Additional Notes
If you use the default NetBeans XHTML template, The created file has an extension of .xhtml1.
this will work fine in Firefox, but not in Internet Explorer
to get the file to load in Internet Explorer, you must change the extension to the standard .html
however, you cannot change the extension by editing the file name in the Projects window file tree
when you click the file name and press the F2 key as you do to change file names in Windows explorer, the extension
this is intentional, because NetBeans has to know what type of file it’s deal with, which isn't always indicated by the
to change the extension, right-click the file name in the Projects window file tree and select Properties
etBeans v6.9.1 Notes 7 10:18 P

in the Properties dialog box, click the value in he Extension field to select it and retype it and then click the Close button
etBeans v6.9.1 Notes 8 10:18 P
etBeans v6.9.1 Notes 9 10:18 P