Web Hosting, website hosting, web site hosting , web page hosting Apache, PHP, MySQL, PERL, servlets Java, JSP " height=1 src="../images/im_spacer.gif" width=125> | Web Hosting website hosting, web site hosting, web page hosting Apache, PHP, MySQL, PERL, servlets Java, JSP,Python" height=1 src="../images/im_spacer.gif" width=53> | Web Hosting website hosting, web site hosting, web page hosting Apache, PHP, MySQL, PERL, servlets Java, JSP,Python" height=1 src="../images/im_spacer.gif" width=407> | Web Hosting website hosting, web site hosting, web page hosting Apache, PHP, MySQL, PERL, servlets Java, JSP,Python" height=1 src="../images/im_spacer.gif" width=43> | Web Hosting website hosting, web site hosting, web page hosting, Apache, PHP, MySQL, PERL, servlets Java, JSP,Python" height=1 src="../images/im_spacer.gif" width=150> | |||||
/"> Web Hosting, website hosting, web site hosting, web page hosting, Apache, PHP, MySQL, PERL, servlets Java, JSP, Python" border=0 height=100 width=78 src="../images/jumpingPC.gif" > | Web Hosting, website hosting, web site hosting, web page hosting, Apache, PHP, MySQL, PERL, servlets Java, Python,JSP" height=29 src="../images/top_arc.gif" width=53> | ||||||||
Web Hosting, website hosting, web site hosting , web page hosting Apache, PHP, MySQL, PERL, servlets Java, Python,JSP, Fundraising" height=75 src="../images/top_hdhp_1_18_07.gif" width=593> |
Fund Raising, Fundraising, web hosting, website hosting, web site hosting" height=1 src="../images/im_spacer.gif" width=126> Call Us Toll-Free (877) 256-0328 /index.shtml" onmouseover="turnOn('welcome')" onmouseout="turnOff('welcome')"> Welcome"> /plans_overview.shtml" onmouseover="turnOn('overview')" onmouseout="turnOff('overview')"> Web Hosting Plans Overview , Fund Raising, Fundraising, web hosting, website hosting, web site hosting"> /fundraising/index.shtml" onmouseover="turnOn('fundraising')" onmouseout="turnOff('fundraising')"> Fund Raising, Fundraising, web hosting"> /reseller/index.shtml" onmouseover="turnOn('reseller')" onmouseout="turnOff('reseller')"> Resellers, web Hosting"> /webdesign.shtml" onmouseover="turnOn('webdevel')" onmouseout="turnOff('webdevel')"> Web Design, web Hosting"> /extraservices.shtml" onmouseover="turnOn('extra')" onmouseout="turnOff('extra')"> Extra Services, web Hosting"> /sitestudio/index.shtml" onmouseover="turnOn('sitestudio')" onmouseout="turnOff('sitestudio')"> Traffic Booster, web hosting"> /trafficbooster.shtml" onmouseover="turnOn('trafficbooster')" onmouseout="turnOff('trafficbooster')"> Traffic Booster, web hosting"> /techsupport.shtml" onmouseover="turnOn('support')" onmouseout="turnOff('support')"> Technical Support, web Hosting"> /tips/index.shtml" onmouseover="turnOn('webmastertips')" onmouseout="turnOff('webmastertips')"> webmaster tips, web Hosting"> /moneybackpolicy.shtml" onmouseover="turnOn('a30day')" onmouseout="turnOff('a30day')"> 30 Day Money Back, web hosting"> /legal.shtml" onmouseover="turnOn('legal')" onmouseout="turnOff('legal')"> Legal Notices for Web Hosting"> /glossary.shtml" onmouseover="turnOn('glossary')" onmouseout="turnOff('glossary')"> Glossary Computer Terms for web Hosting"> /contact.shtml" onmouseover="turnOn('contact')" onmouseout="turnOff('contact')"> Contact Information - web hosting">
|
Web Hosting, website hosting, web site hosting , web page hosting Apache, PHP, MySQL, PERL, servlets Java, Python, JSP" src="../images/im_spacer.gif" width=5> | " height=1 src="../images/im_spacer.gif" width=1> | " height=1 src="../images/im_spacer.gif" width=1> | " height=1 src="../images/im_spacer.gif" width=5> | " height=1 src="../images/im_spacer.gif" width=5> | " height=1
src="../images/im_spacer.gif" width=700>
Note that JSP is Java, so it is case sensitive. But capitalization doesn't matter in VBScript, so if you stick to lowercase, there really isn't any difference in the names. These are the main objects we have to work with when creating dynamic content in either ASP or JSP, so it's a good idea to become familiar with their methods. I'll use some of them in the examples that follow, but I can't go into every method available within the limits of this article. As I mentioned earlier, both ASP and JSP support a similar way of delimiting scripting from content on a page. <% and %> are used to set of sections of script, '<%=' and '%>' are used to return a value within content, and <%@ and %> are used to delimit page directives. Here is a brief example using both ASP and JSP:
As you can see, there are some basic similarities between ASP and JSP. In fact, in this simple example, there's almost no difference. When we look deeper into JSP, however, fundamental differences will appear. JSP SyntaxJSP supports two basic styles of delimiting its scripting elements from page content. The first looks a great deal like ASP, whereas the second can be used to create JSP that is fully XML compliant. Here, let's take a look:
To utilize the XML Style delimiters, you have to format your JSP as an XML document. This requires some additional modification, like using <jsp:root/> as your the root XML node and making sure your page is well-formed XML. This conversion and the use of the XML Style are outside the scope of this article, but if XML is important to you or your project, you should definitely investigate them further on your own time. If you're interested in learning more about XML and JSP, the book Professional Java XML Programming with Servlets and JSP is an excellent investment -- though if you're not quite ready to roll out the dough, JavaSoft's PDF about the matter is free for the downloading. The most important things to know as you create your JSP website are the four basic types of delimeters: directives, declarations, fragments, and expressions. The following example is a complete JSP page that uses the base style of each delimiter:
In line 1, the page directive sets the generated servlet info to "Example" and makes sure that "java.io.*" and "java.util.*" are imported for use in the servlet. The import is, well, important, since without these imports there would be no access to additional Java APIs. Line 2 declares title as a class variable. This variable can now be used in any following code. Most likely, it is used by the code in header.inc, which is included in place on line 3. Line 4 is plain page content. This is sent to the output stream. Lines 5 through 10 define a code fragment that writes out the numbers 1 to 5, with breaks in between, to the output stream. Line 6 is page content that includes an expression. This content is sent to the output stream with the expression inserted. Line 7 includes the footer.inc file, which presumably has some more content we want to place at the bottom of this file. If you followed all that, then you now have a basic understanding of JSP syntax and are armed with enough knowledge to do some small amount of damage to your website. One gotcha that you should know about is that when included files are changed, the servlet generated by the JSP is not usually regenerated. So if you make a change to an included file, make sure to tell your server to regenerate the servlet for the including JSP. Another way to do this is to re-save the including JSP. This changes the file modification timestamp, which is supposed to cause the servlet to regenerate. Now that we've taken a look at the basic syntax, let's take a look at how we can use the access objects that JSP provides us to detect the incoming browser and respond appropriately. Page 4 JSP Browser DetectionJSP provides us with access objects that we can use to get information from the incoming request and modify the resulting response. This makes it possible for us to do things like identify what type of browser is making the request. We can then set up a different type of request based upon what that browser supports. The following example determines whether the incoming browser is Internet Explorer, Netscape, or a WML client (like a cell phone). Depending on the browser it finds, it returns an appropriate greeting. Let's take a gander at an example of this at work. (Note: I'm going to use line numbering here because it makes the explanation of the example so much easier, but it isn't part of the code -- it's just there for reference.)
This first line simply adds some arbitrary information to the generated servlet and tells the Web server to redirect any Java errors encountered on the page to the err.jsp page. Other things that can be done in this page directive include importing various Java APIs.
This section of code declares three static values that represent the different browser types we are detecting. It also defines the getBrowser() method that accepts the request object and uses it to determine what browser has made the request. It does so by looking at the ACCEPT HTTP request header to see if the browser will accept wml. If it doesn't, it then looks at the USER-AGENT HTTP request header to see if it contains "MSIE." If it does, then the browser making the request is IE. Otherwise, we assume it's a Netscape browser.
In the last section of code, we used the declared getBrowser() method in a Java switch statement to determine what should be returned to the browser. For IE and Netscape browsers, a simple HTML document is returned. For WML-accepting browsers, the content type of the response is set to text/vnd.wap.wml and a WML document is returned. In these very meaningful forty-two lines of code, we have a simple page that will serve up a pleasant greeting to three different browsers. If all has gone well, creating this code should have whetted your appetite for more. If you're interested in pushing JSP even further, then read on for a list of additional resources you can use to expand your JSP horizons. Digging Deeper Intro to JSP
JSP
Servlets
Tomcat
mysql
Java
JSP
Servlets
Tomcat
mysql
Java
JSP
Servlets
Tomcat
mysql
Java
JSP
Servlets
Tomcat
mysql
Java
JSP at JSP.aldenWEBhosting.com
Servlets at servlets.aldenWEBhosting.com
Tomcat at Tomcat.aldenWEBhosting.com
mysql at mysql.aldenWEBhosting.com
Java at Java.aldenWEBhosting.com
Web Hosts Portal
Web Links
Web Links
Web Hosting
JSP Solutions Web Links
JSP Solutions Web Hosting
Servlets Solutions Web Links
Servlets Solutions Web Hosting
Web Links
Web Links
.
.
.
|