Similar documents
Creating a New Project with Struts 2

STRUTS 2 - VALIDATIONS FRAMEWORK

STRUTS 2 - HELLO WORLD EXAMPLE


CSE 510 Web Data Engineering

Document for Consuming Web-Service In.NET & JAVA

UIMA Simple Server User Guide

Date Picker Haim Michael

Integration Of Struts2 And Hibernate Frameworks

Apache Struts (Part2) Rimon Mikhaiel

Project Part 2 (of 2) - Movie Poster And Actor! - Lookup

Introduction to Servlets. After which you will doget it

Servlets by Example. Joe Howse 7 June 2011

An implementation of Tree Panel component in EXT JS 4.0

Front-End UI: Bootstrap

Kamnoetvidya Science Academy. Object Oriented Programming using Java. Ferdin Joe John Joseph. Java Session

CS 112 Introduction to Programming

Session 5. Web Page Generation. Reading & Reference

Dingle Coderdojo 6. Project Part 2 (of 2) - Movie Poster And Actor! - Lookup. Week 6

Servlet for Json or CSV (or XML) A servlet serving either Json or CSV (or XML) based on GET parameter - This version uses org.json

Google Web Toolkit Creating/using external JAR files

Building Componentized Web Interfaces with Clay Instead of Tiles

A designers guide to creating & editing templates in EzPz

LAMPIRAN. Index.php. <?php. unset($_session["status"]); //session_destroy(); //session_destroy();

web.xml Deployment Descriptor Elements

Stateless Session Bean

Getting started with Winstone. Minimal servlet container

Chapter 2 How to structure a web application with the MVC pattern

Integrate JPEGCAM with WaveMaker

This project will use an API from to retrieve a list of movie posters to display on screen.

PRODUCT DOCUMENTATION. Installing and Implementing Enterprise Contact Center Chat RELEASE 5.1

Introduction to HTML5

Building beautiful websites with Bootstrap: A case study. by Michael Kennedy michaelckennedy.net

Static Webpage Development

Session 8. Introduction to Servlets. Semester Project

Developing Clients for a JAX-WS Web Service

Bootstrap 1/20

3.2 Example Configuration

Overview

Copyright 2011 Sakun Sharma

The jpos REST tutorial shows you how to use an out-of-the-box binary distribution of jpos to build a REST server that responds to an /echo call.

Introducing Struts 2

HTML Summary. All of the following are containers. Structure. Italics Bold. Line Break. Horizontal Rule. Non-break (hard) space.

Thu 10/26/2017. Created RESTful Web Service, JavaDB, Java Persistence API, Glassfish server in NetBeans 8

Discovery Service Infrastructure for Test- bädden

1. Introduction. 2. Life Cycle Why JSP is preferred over Servlets? 2.1. Translation. Java Server Pages (JSP) THETOPPERSWAY.

Web development using PHP & MySQL with HTML5, CSS, JavaScript

This course is intended for Java programmers who wish to write programs using many of the advanced Java features.

Contents. 1. JSF overview. 2. JSF example

Model 2 MVC. h+p:// jw /jw 12 ssj jspmvc.html

Web applications and JSP. Carl Nettelblad

Session 9. Introduction to Servlets. Lecture Objectives

GIMP WEB 2.0 MENUS. Before we begin this tutorial let s visually compare a standard navigation bar and a web 2.0 navigation bar.

Using netbeans create a new Web Application and select the framework as JSF 2.2

Implementing a chat button on TECHNICAL PAPER

Scripting for Multimedia LECTURE 1: INTRODUCING HTML5

Unit 5 JSP (Java Server Pages)

enets Merchant Integration Guide enets Open API Version 1.07 enets Merchant Integration Guide enets Open API GENERAL

<link rel="stylesheet" href="

GIMP WEB 2.0 MENUS. Web 2.0 Menus: Horizontal Navigation Bar

COMP9321 Web Application Engineering

Responsive Web Design and Bootstrap MIS Konstantin Bauman. Department of MIS Fox School of Business Temple University

FINALTERM EXAMINATION Spring 2009 CS506- Web Design and Development Solved by Tahseen Anwar

Web Applications. and. Struts 2

Tapestry. Code less, deliver more. Rayland Jeans

Stateless -Session Bean

A.1 JSP A.2 JSP JSP JSP. MyDate.jsp page contenttype="text/html; charset=windows-31j" import="java.util.calendar" %>

How to structure a web application with the MVC pattern

А «- - «Exellent»» 50, 18, «Exellent»., , -., -. -,, html -. - «Exellent»,.

HTML: Parsing Library

Web Architecture and Development

Asciidoctor Demo. Dan Allen

Example jsf-cdi-and-ejb can be browsed at

Bootstrap Carousel. jquery Image Sliders

,.., «..»

Making a live edit contact list with Coldbox REST & Vue.js

CSS (Cascading Style Sheets)

UNIT -5. Java Server Page

jmaki Overview Sang Shin Java Technology Architect Sun Microsystems, Inc.

Lecture 7. Action View, Bootstrap & Deploying 1 / 40

INTRODUCTION TO SERVLETS AND WEB CONTAINERS. Actions in Accord with All the Laws of Nature

Developing Web Applications using JavaServer Faces

The following sections provide sample applications with different features so you can better appreciate the wizard behavior.

Web Programming BootStrap Unit Exercises

COURSE DETAILS: CORE AND ADVANCE JAVA Core Java

UI Course HTML: (Html, CSS, JavaScript, JQuery, Bootstrap, AngularJS) Introduction. The World Wide Web (WWW) and history of HTML

Web UI. Survey of Front End Technologies. Web Challenges and Constraints. Desktop and mobile devices. Highly variable runtime environment

DEZVOLTAREA APLICATIILOR WEB CURS 7. Lect. Univ. Dr. Mihai Stancu

Website Development with HTML5, CSS and Bootstrap

(800) Toll Free (804) Fax Introduction to Java and Enterprise Java using Eclipse IDE Duration: 5 days

Адаптивный дизайн веб-страниц с использованием сеточных технологий

Mobile Design for the Future That is Here Already. Rick Ells UW Information Technology University of Washington

Servlets1. What are Servlets? Where are they? Their job. Servlet container. Only Http?

COMP9321 Web Application Engineering

django-sekizai Documentation

Ajax DWR dojo In WebSphere Portal

Session 8. Reading and Reference. en.wikipedia.org/wiki/list_of_http_headers. en.wikipedia.org/wiki/http_status_codes

Manual Html A Href Onclick Submit Button

1.1 Text Alternatives: Provide text alternatives for any non-text content. 3.1 Readable: Make text content readable and understandable.

Session 21. Expression Languages. Reading. Java EE 7 Chapter 9 in the Tutorial. Session 21 Expression Languages 11/7/ Robert Kelly,

Transcription:

-struts_annotation_bootstrap Estrutura do preojeto... LIBS: asm-3.3.jar asm-commons-3.3.jar commons-fileupload-1.3.jar commons-io-2.0.1.jar commons-lang-2.4.jar commons-lang3-3.1.jar freemarker-2.3.19.jar javassist-3.11.0.ga.jar mysql-connector-java-5.1.26-bin.jar ognl-3.0.6.jar servlet3-api.jar struts2-bootstrap-plugin-1.6.1.jar struts2-convention-plugin-2.3.15.1.jar struts2-core-2.3.15.1.jar struts2-jquery-plugin-3.6.1.jar xwork-core-2.3.15.1.jar package entity; public class Cliente { private Integer idcliente; private String nome; private String email; 1

-struts_annotation_bootstrap public Cliente() { // TODO Auto-generated constructor stub public Cliente(Integer idcliente, String nome, String email) { super(); this.idcliente = idcliente; this.nome = nome; this.email = email; @Override public String tostring() { return "Cliente [idcliente=" + idcliente + ", nome=" + nome + ", email=" + email + "]"; public Integer getidcliente() { return idcliente; public void setidcliente(integer idcliente) { this.idcliente = idcliente; public String getnome() { return nome; public void setnome(string nome) { this.nome = nome; public String getemail() { return email; public void setemail(string email) { this.email = email; @Override public boolean equals(object c) { return this.idcliente.equals(((cliente)c).getidcliente()); 2

-struts_annotation_bootstrap package action; import java.util.arraylist; import java.util.list; import javax.servlet.http.httpservletrequest; import org.apache.struts2.servletactioncontext; import org.apache.struts2.convention.annotation.action; import org.apache.struts2.convention.annotation.result; import com.opensymphony.xwork2.actioncontext; import com.opensymphony.xwork2.actionsupport; import com.opensymphony.xwork2.validator.annotations.emailvalidator; import com.opensymphony.xwork2.validator.annotations.requiredstringvali dator; import com.opensymphony.xwork2.validator.annotations.validatortype; import entity.cliente; public class ClienteAction extends ActionSupport{ private Cliente cliente; private List<Cliente> lista; private Integer idescolhido; public Integer getidescolhido() { return idescolhido; public void setidescolhido(integer idescolhido) { this.idescolhido = idescolhido; public ClienteAction() { cliente = new Cliente(); public Cliente getcliente() { return cliente; public void setcliente(cliente cliente) { 3

-struts_annotation_bootstrap this.cliente = cliente; public List<Cliente> getlista() { lista = new ArrayList<Cliente>(); lista.add(new Cliente(10,"joao","joao@gmail.com")); lista.add(new Cliente(20,"maria","maria@gmail.com")); lista.add(new Cliente(30,"ana","ana@gmail.com")); return lista; public void setlista(list<cliente> lista) { this.lista = lista; @Action(value="home", results={ @Result(name=SUCCESS,location="sistema.jsp"), @Result(name=INPUT,location="sistema.jsp")) public String init(){ getlista(); return SUCCESS; @Action(value="gravar", results={ @Result(name=SUCCESS,location="resposta.jsp"), @Result(name=ERROR,location="sistema.jsp")) public String cadastrar(){ HttpServletRequest request=(httpservletrequest) ActionContext.getContext().get(ServletActionContext.HTTP_RE QUEST); try{ Cliente c = new Cliente(); c.setidcliente(idescolhido); getlista(); cliente = lista.get(lista.indexof(c)); request.setattribute("msg", "<b>cliente Escolhido: </b>" + cliente); return SUCCESS; catch(exception ex){ ex.printstacktrace(); request.setattribute("msg", "Error :" + ex.getmessage()); return ERROR; 4

-struts_annotation_bootstrap web.xml <?xml version="1.0" encoding="utf-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemalocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="webapp_id" version="3.0"> <display-name>studentenrollmentwithstruts</display-name> <filter> <filter-name>struts2</filter-name> <filterclass>org.apache.struts2.dispatcher.ng.filter.strutsprepareandex ecutefilter</filter-class> </filter> <filter-mapping> <filter-name>struts2</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> </web-app> index.jsp <!doctype html> <html> <head> <link rel="stylesheet" href="css/bootstrap.css"> <script type="text/javascript" src="js/jquery- 1.10.2.js"></script> <script type="text/javascript" src="js/bootstrap.js"></script> </head> <body> <div class="container"> <div class="well"> 5

-struts_annotation_bootstrap <h2>struts Annotation</h2> <a href="home.action">entrar no Sistema <span class="glyphicon glyphicon-log-in"></span> </a> </body> </html> sistema.jsp <!DOCTYPE html> <html> <head> <%@ taglib prefix="s" uri="/struts-tags"%> <link rel="stylesheet" href="css/bootstrap.css"> <script type="text/javascript" src="js/jquery.js"></script> <script type="text/javascript" src="js/bootstrap.js"></script> </head> <body> <div class="container"> 6

-struts_annotation_bootstrap <div class="well"> <h2>struts Annotation</h2> <div class="col-sm-offset-1 col-sm-10"> <div class="jumbotron"> <ul class="nav nav-tabs"> <li class="active"><a href="#">escolher Cliente</a></li> </ul> <p /> <div class="row"> <s:form id="form1" action="gravar.action" theme="bootstrap" cssclass="bs-example form-horizontal" method="post"> <div class="col-sm-10"> <s:select label="clientes" list="lista" cssclass="selectpicker" listkey="idcliente" listvalue="nome" name="idescolhido" headervalue="escolha o CLiente:" headerkey="0"/> <div class="col-sm-10"> <br /> <s:submit value="enviar Dados" cssclass="btn btn-primary" /> </s:form> <br /> ${msg </body> </html> 7

-struts_annotation_bootstrap resposta.jsp <%@ page language="java" contenttype="text/html; charset=iso- 8859-1" pageencoding="iso-8859-1"%> <%@ taglib prefix="s" uri="/struts-tags"%> <!DOCTYPE html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=iso- 8859-1"> <title>resposta</title> <link rel="stylesheet" href="css/bootstrap.css"> <script type="text/javascript" src="js/jquery.js"></script> <script type="text/javascript" src="js/bootstrap.js"></script> </head> <body> <div class="container"> <div class="well"> 8

-struts_annotation_bootstrap ${msg </body> </html> <h2>struts Annotation</h2> 9