Home arrow Java arrow Page 5 - JSP Basics with Java Studio Creator 2 for VB Programmers
JAVA

JSP Basics with Java Studio Creator 2 for VB Programmers


If you have been looking for a place to start with Java Server Pages, you've found it here. This article will give you some hands-on experience in using the Java Studio Creator 2 IDE to create Java Server Pages.

Author Info:
By: Jayaram Krishnaswamy
Rating: 5 stars5 stars5 stars5 stars5 stars / 2
September 25, 2006
TABLE OF CONTENTS:
  1. · JSP Basics with Java Studio Creator 2 for VB Programmers
  2. · The Palette window and more
  3. · Creating a simple JSP page
  4. · Adding basic components to the page
  5. · Test the page

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

advertisement
JSP Basics with Java Studio Creator 2 for VB Programmers - Test the page
(Page 5 of 5 )

From the main menu click on Build, and after the build is complete, right click the Project "MyFirst" in the project window, and click on setMain Project. Right click the Page1.jsp and click Set as start page. Now right click the MyFirst project and click on Run Project. After building you can choose to Run by hitting the button Run which is right next to Build. A Deployment Monitor shows up which allows you to cancel the deployment if desired. After a while, Page1.jsp shows up as shown.

When you click on the button you will see that the label's text has been changed to what you wanted. Observe the URL address; you have now started a session with a unique ID.

Do you want to add another page?

No problem. Right click the Web Pages folder; from there you can add a new page. A new page can be renamed after the page is added. The same trick, right-click and choose, is shown.

Do you want an image added?

From the file menu you can add an existing item from your computer as shown.

This adds an image to the Resources sub-folder of the web pages folder. Now add an Image control from the basic subfolder of the palette to the JSP page just above the label. Now with the following code (as shown in the next paragraph) you can set the value of the image as follows:

public String button1_action() {
// TODO: Process the button click action. Return value is 
a navigation // case name where null will return to the same page. label1.setValue("Have a Cup Of Java");
image1.setValue("/resources/sun_image.jpg");
return null; }

The image reference is now that of the image brought into the project earlier from the resources folder.

When you build and run the project this is what you will see.

Add a link to the image when clicked

The image object brings with it the JavaScript events that you can access as shown in the next picture of the image properties. Now to the onClick event the following code was added as shown, either in the properties window of the image control, or the corresponding location in the JSP page.

window.open ("http://hodentek.blogspot.com")

This links the image to the URL shown.

Summary

Visual Basic programmers will be comfortable using this IDE to create JSPs without too much of a sweat. The tutorial gives a basic overview of the features and shows how to develop a simple JSP. In the process it also shows how to add JavaScript. The IDE works in not too unfamiliar a fashion for those who have used Microsoft IDEs. The Sun Microsystems web site has a lot of examples and tutorials that you may want to review. You may also want to watch for more tutorials on this site.


DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

blog comments powered by Disqus
JAVA ARTICLES

- Deploying Multiple Java Applets as One
- Deploying Java Applets
- Understanding Deployment Frameworks
- Database Programming in Java Using JDBC
- Extension Interfaces and SAX
- Entities, Handlers and SAX
- Advanced SAX
- Conversions and Java Print Streams
- Formatters and Java Print Streams
- Java Print Streams
- Wildcards, Arrays, and Generics in Java
- Wildcards and Generic Methods in Java
- Finishing the Project: Java Web Development ...
- Generics and Limitations in Java
- Getting Started with Java Web Development in...

Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 



© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 11 - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials