Java Reference
In-Depth Information
JavaScript files
If you're not familiar with JavaScript, it's important to point out that the only
thing it has in common with Java is the first four letters—so, it's important to set
your expectations appropriately. JavaScript doesn't have the same structure, API ,
or strict typing as Java, so you won't benefit from many of IDEA 's Java-related fea-
tures. Likewise, much of what you might think of as JavaScript has more to do
with the browser than the language. For example, JavaScript concerns itself with
syntax, conditionals, flow control, variable assignment, and so forth, whereas
reacting to mouse events or accessing a page's form fields is functionality derived
from objects exposed by the browser and outside the scope of the language—and
thus outside IDEA 's code assistance and other features. Although IDEA 's support
for JavaScript is unavoidably not as rich as its support for Java, a number of key
features help JavaScript integrate into your project, as you'll see. By default, IDEA
has registered the familiar .js file extension for standalone JavaScript files.
As with the other types of content, IDEA provides validation and coding assis-
tance for JavaScript. In these cases, IDEA defers to the rules outlined for ECMA-
S cript-262, the formal standard for the language most people know as JavaScript.
Embedded and mixed-mode content
Often, in web development, HTML , CSS , and JavaScript are found intermingled
in the same file. For example, an HTML document may have embedded CSS
stylesheets or JavaScript blocks. Furthermore, JSP files consist largely of HTML
with both Java and JavaScript blocks thrown in, possibly with CSS as well. IDEA
handles this situation and adjusts accordingly, providing full access to most of the
new features. Take, for example, CSS support, which can be accessed in an exter-
nal CSS file, in a <style> block in HTML or JSP file, or in an HTML tag's style
property attribute. Some features, such as the structure browser, act on the pri-
mary file type, based on the file's extension.
Organizing your web content in IDEA
When adding web content to your project, you should put it in the same location
as your JSP s and other resources that make up your web application module.
Doing so gives you the benefit of logical paths that can be resolved correctly dur-
ing completion and validation operations undertaken by IDEA . For example, it's
common to refer to the image files in HTML documents via alias names of folders
that are specified in server settings, to allow deployment-time modification. Hav-
ing such mappings supported right in the web module lets you use aliased paths
with correct resolution.
 
 
 
Search WWH ::




Custom Search