How to Build a Struts Application with JBuilder 9.

Slides:



Advertisements
Similar presentations
Struts Portlet Adding an Action Copyright © Liferay, Inc. All Rights Reserved. No material may be reproduced electronically or in print without.
Advertisements

1 After completing this lesson, you will be able to: Check spelling in a document. Check for grammatical errors. Find specific text. Replace specific text.
Microsoft Expression Web-Illustrated Unit J: Creating Forms.
Using Eclipse. Getting Started There are three ways to create a Java project: 1:Select File > New > Project, 2 Select the arrow of the button in the upper.
Microsoft Expression Web-Illustrated Unit L: Using Code Tools.
® Microsoft Access 2010 Tutorial 5 Creating Advanced Queries and Enhancing Table Design.
Struts1 Apache Struts Dr Jim Briggs. Struts2 What is Struts? Struts is an open source framework for building Java web applications Supports MVC/Model.
Internet Technologies 1 Master of Information System Management Java Server Faces Model/View/Controller Design Pattern for Web Development Slides.
Michael Donovan, River Campus Libraries – 12/03 DocuShare Overview and Training.
A Guide to Oracle9i1 Introduction To Forms Builder Chapter 5.
® IBM Software Group © 2006 IBM Corporation Additional AJAX Examples and Workshops This learning module provides additional AJAX use cases and examples.
1 of 6 This document is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS DOCUMENT. © 2007 Microsoft Corporation.
Access Tutorial 5 Creating Advanced Queries and Enhancing Table Design
Macros Tutorial Week 20. Objectives By the end of this tutorial you should understand how to: Create macros Assign macros to events Associate macros with.
Create a New Application and Project Open the Create Application dialog. Enter the application name of your choice and the directory. Select No Template.
Figure 1. Hit analysis in 2002 of database-driven web applications Hits by Category in 2002 N = 73,873 Results Reporting 27% GME 26% Research 20% Bed Availability.
Ch 9 Managing Active Directory User Accounts. Objectives Create Organizational Unit Creating User Accounts in Active Directory Disabling, Enabling, and.
UNIT-V The MVC architecture and Struts Framework.
Form Handling, Validation and Functions. Form Handling Forms are a graphical user interfaces (GUIs) that enables the interaction between users and servers.
CST JavaScript Validating Form Data with JavaScript.
1 ADVANCED MICROSOFT WORD Lesson 15 – Creating Forms and Working with Web Documents Microsoft Office 2003: Advanced.
JSP and Servlets Lecture notes by Theodoros Anagnostopoulos.
Tutorial: Introduction to ASP.NET Internet Technologies and Web Application 4 th February 2010.
Chapter 5 Java Script And Forms JavaScript, Third Edition.
Author: DoanNX Version 2.0/Time: 30’. The ways to solve it There are 2 main ways:  Client-side: Using JavaScript (now one very good option is JQuery).
Chapter 2 Querying a Database MICROSOFT ACCESS 2010.
Gadgets & More…. “Date Range” Gadgets Allows you to choose a specific date, before or after a date or a range of dates using the Workflows calendar.
Creating a Web Site to Gather Data and Conduct Research.
Dreamweaver – Dreamweaver Extras Web Design Section 8-4 Part or all of this lesson was adapted from the University of Washington’s “Web Design & Development.
CSCI 6962: Server-side Design and Programming Introduction to Java Server Faces.
Java Server Pages A JSP page is a text-based document that contains two types of text: static template data, which can be expressed in any text-based format,
Chapter 6 Generating Form Letters, Mailing Labels, and a Directory
Lesson 2.  To help ensure accurate data, rules that check entries against specified values can be applied to a field. A validation rule is applied to.
Putting Applets into Web Pages.  Two things are involved in the process of putting applets onto web pages ◦ The.class files of the applet ◦ The html.
Java Servlets example using NetBeans 6. Pre-requirements: Install Java JDK 1.6 Install NetBeans IDE 6 (we will use version NetBeans IDE update 16)
Struts J2EE web application framework “ Model 2 ” Model View Controller Controller Servlet Key features XML metadata Struts taglib Simplified form validation.
File Management Presented to The Glades Computer Club January 4, 2001.
1 Building the CarryDrop Simulation in JBuilderX By Deddy Koesrindartoto 08/16/2004.
JavaScript, Fourth Edition Chapter 5 Validating Form Data with JavaScript.
CSC 2720 Building Web Applications Server-side Scripting with PHP.
Topic Java EE installation (Eclipse, glassfish, etc.) Eclipse configuration for EE Creating a Java Web Dynamic Project Creating your first servlet.
® Microsoft Office 2013 Access Creating a Database.
Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved Chapter 41 JavaServer Face.
Using SurfAid to find the number of hits that your Marketing URLs are receiving. Michigan.gov Marketing URL Traffic Statistics.
XP New Perspectives on Microsoft Office FrontPage 2003 Tutorial 7 1 Microsoft Office FrontPage 2003 Tutorial 8 – Integrating a Database with a FrontPage.
FIRST COURSE Word Tutorial 6 Using Mail Merge. Objectives Learn about the mail merge process Use the Mail Merge task pane Select a main document Create.
INTRODUCTION TO ACCESS. OBJECTIVES  Define the terms field, record, table, relational database, primary key, and foreign key  Create a blank database.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
Managing File Resource Using File Server Resource Manager Chapter 9 Advance Computer Network Lecture Sorn Pisey
13 Copyright © 2004, Oracle. All rights reserved. Adding Validation and Error Handling.
11 Copyright © 2004, Oracle. All rights reserved. Customizing Actions.
It works! PPInfoScreen Server is now running and will display your deployed presentations Some instructions will follow…
What is a Combo Box? Is a list of values from which the user can select a single value. Saves typing Adds another means of enforcing referential integrity.
Struts Framework Day-2 Ashok Chakravarti. DataSource Usage Sample Struts-config.xml …
Implementation Struts Framework for well-architectured web applications Model-View-Controller design pattern.
Chapter 12© copyright Janson Industries Java Server Faces ▮ Explain the JSF framework ▮ SDO (service data objects) ▮ Facelets ▮ Pagecode classes.
MSOffice Access Microsoft® Office 2010: Illustrated Introductory 1 Part 1 ® Database & Table.
JavaScript Events Java 4 Understanding Events Events add interactivity between the web page and the user You can think of an event as a trigger that.
Creating Advanced Queries and Enhancing Table Design.
COMPREHENSIVE Access Tutorial 1 Creating a Database.
Apache Struts Technology A MVC Framework for Java Web Applications.
Spell Checker web service (you build a web client that interacts with the service) The client uses a servlet class and a JSP page. The user passes information.
This is an introduction to configuring Microsoft Outlook for Office 2010: Forwarding FAMIS work order opening and closing s to other users or alternate.
Getting Eclipse for C/C++ Development
Access Tutorial 5 Creating Advanced Queries and Enhancing Table Design
Chapter 7 Searching Your Products
Getting Eclipse for C/C++ Development
Working with Libraries
MIS 3200 – Unit 6.1 Moving between pages by redirecting
Tutorial 5 Advanced Queries and Enhanced Table Design
Presentation transcript:

How to Build a Struts Application with JBuilder 9

Target A web page with a single Text Field When user hits the submit button: –If the text field is empty s/he is redirected to the same page –If the text field contains something s/he is presented with another web page containing the string of the text field

How it works index.jsp ActionForm Action struts-config.xml (Mapping) quote.jsp Hit submitMapping Checked Target: success Target: failure

Quick Steps: JBuilder 9 Add Struts 1.1 Library. Create a new Project. Create a new Web Application. Create a JSP: index.jsp Create ActionForm - LookupForm from JSP Create Action Class – LookupAction Create another JSP – quote.jsp Configure struts-config.xml

Add Struts 1.1 Library Unzip Struts 1.1 in a folder. Click Tools-> Configure Libraries in JBuilder Click New Enter Name: Struts 1.1 Add Library Paths ( set the path to struts/lib directory) Click OK From the framework tab select Struts Click OK

Create New Project Close all current projects from: File -> Close Project Create a new Project from: File -> New Project Enter Project Name: “hello” Click Finish

Create New Web Application Press Ctrl-N Click the Web Tab Select Web Application and Click OK Check the Struts 1.1 Check BOX Select ‘/’ in the Launch URL Combo BOX Click OK

Write index.jsp Press Ctrl-N From the Web tab select Java Server Page Click OK Enter name: index.jsp, uncheck the 2 options below Click Next Uncheck Generate Submit Form Check All under the heading Struts 1.1 Click Finish

Writing index.jsp Add the following code in the : <html:form action = "/Lookup" name = "lookupForm" type = "hello.LookupForm"> <html:text property = "symbol" />

Explanation ‘action’ means the name of the action that happens when the submit button is pressed. ‘type’ means the name of the ActionForm Class. ‘name’ is the identification by which struts- config.xml file knows the ActionForm Class. denotes a textfield whose name is set to symbol. and create a submit and a reset button respectively.

Create ActionForm Press Ctrl-N. Select ActionForm. Click OK. In the ActionForm field enter name: LookupForm. Click Next. Click Add from JSP. Select index.jsp. Click OK. Click Finish.

Create Action Press Ctrl-N. Select Action. Click OK. In the Action field enter name: LookupAction. Click Next. Action Path: /Lookup Form bean name: lookupForm Scope: request Validate: false Input jsp: /index.jsp Click Finish

Writing LookupAction Rename the ‘perform’ method to ‘execute’. The ‘perform’ method is depricated. Add the following code: String str = lookupForm.getSymbol(); if( str == null || str.equals("")) { return actionMapping.findForward("failure"); } httpServletRequest.setAttribute("VALUE",str); return actionMapping.findForward("success"); Delete the line: throw new java.lang.UnsupportedOperationException("Method …");

Explanation When the String is not null i.e. the user puts some value in the textfield and hits the submit button we write: httpServletRequest.setAttribute("VALUE",str); return actionMapping.findForward("success"); This roughly means we save the value of str in a variable named VALUE which will be valid for the next page to be displayed. actionMapping.findForward(“success”) searches the struts-config.xml file and finds the page to be displayed for the ‘success’ mapping which we will discuss shortly.

Creating quote.jsp Create quote.jsp in the same way we created index.jsp Write the following code in the request.getAttribute(“VALUE”) retrives the value of ‘str’ that we saved in the LookupAction Class.

Configure struts-config.xml From the Upper-Left text pane expand struts -> and click struts-config.xml. From the lower-left text pane expand Action-Mappings and Click /Lookup. Click the Forwards tab. Then Click Add. Select it and click edit. Enter name: success Enter path: /quote.jsp In the same way add another entry: Enter name: failure Enter path: /index.jsp

That’s All Press F9 to RUN the project.