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. |