Source
The time it takes to download an IDE and learn the barebones basics of use will be very quickly recouped by the savings in development, debugging, and deployment times. To get started with web apps in Eclipse, you only need to know a very small number of features. You can gradually learn the advanced capabilities at your leisure. Here is a quick summary of basic use; see the next sections for details on these core features.
- Install Java. Download from http://java.sun.com/javase/downloads/. I use JDK 1.6.0_15, but any Java 5 or 6 version will work. You need the full JDK (with compiler), not just the JRE (for running existing apps).
- Unzip Tomcat. Unzip tomcat-6.0.18-preconfigured.zip into the top level of the C drive.
- Install Eclipse. Download from http://www.eclipse.org/downloads/. Choose "Eclipse IDE for Java EE Developers", download, and unzip. The latest version as of late 2010 is 3.5 (Galileo), but these directions apply equally to 3.4 (Ganymede).
- Tell Eclipse about Tomcat. Click on Servers tab at bottom. R-click, New, Server, Apache, Tomcat v6.0, navigate to Tomcat installation folder (C:\apache-tomcat-6.0.18), OK.
- Run Tomcat. Click on Servers tab at bottom. R-click on Tomcat v6.0, choose "Start". Open http://localhost/ in a browser: you should see an empty page showing a blank directory listing (but not a 404 error). The details below show how to copy the ROOT files that Eclipse erroneously forgets, so that http://localhost/ gives the normal Tomcat welcome page.
- Import and Test a Sample Web App. Grab intro.zip, save it, and import it into Eclipse. Use File, Import, General, Existing Projects, Select archive file. Then click Browse and navigate to intro.zip. Click on Servers tab at bottom. R-click on Tomcat v6.0 Server, choose "Add and Remove Projects". Choose intro project. Start Tomcat if not already running. Open http://localhost/intro/ in browser. Note that there are many other sample Eclipse projects to illustrate various servlet and JSP capabilities (session tracking, JSP scripting, MVC, custom tags, and dozens of other topics). Please seehttp://courses.coreservlets.com/Course-Materials/csajsp2.html. This intro project is merely to confirm that Tomcat and Eclipse are configured properly.
- Create and Test a new Web App. File, New, Project, Web, Dynamic Web Project. Deploy and test it as above.
If you find these free tutorials helpful, we would appreciate it if you would link to us. For information on commercial Web hosting providers that support Tomcat, see the JSP hosting page.
Read more...
Development, Eclipse, Java, JSP, JSTL, Programming, Tomcat, Tutorial, web, Программирование, разработка
Source
Introduction
Creating database-driven web applications in Java has traditionally involved a steep learning curve. Even if you already know how to write Java programs, and have a basic understanding of web applications, the Java Enterprise Edition (Java EE) stack is daunting. Learning to use the Servlet API and JavaServer Page (JSP) technology to generate dynamic content is just the beginning. Installing and configuring an open source Java EE web application server and a DBMS, and getting them to talk to each other, can require significant developer effort.
In this article, I will demonstrate how the combination of Eclipse Web Tools Platform, Eclipse Data Tools Platform, Tomcat, and Derby help to "lower the bar" by virtually eliminating the server administration issues, allowing developers to focus on the task at hand: building the web application. I will assume that you understand the basics of SQL, and are familiar with HTML and basic web application concepts.
Read more...
Database, Development, Dynamic Web Project, Eclipse, HTML, Java, JSP, JSTL, Programming, SQL, Web Applications, Программирование, разработка
Source
The new JavaServer Pages (JSP) version incorporates the expression language (EL) introduced by the JSP Standard Tag Library (JSTL) to let Web designers produce scriptless JSP pages that don't contain Java code. Since JSP 2.0 provides backward compatibility to JSP 1.x, you may still include Java snippets in your pages, but tag handlers and JavaBean components are much better places for Java-based functionality.
JSP 2.0 provides new features for tag handlers such as dynamic attributes, the Simple Invocation Protocol, and .tag files. You still use the old JSP 1.0 standard actions for creating JavaBean instances and setting their properties, but now you can access bean properties, request parameters, and JSP attributes/variables with the new expression language.
All those JSP technology improvements let you achieve the goal of separating the JSP/HTML markup from the Java code. One thing is missing, however. JSP 2.0 has no syntax for calling a public nonstatic JavaBean method from a scriptless JSP page. This article solves that issue by providing a JSP 2.0 simple tag with dynamic attributes.
Note: You can download this article's source code from Resources.
Read more...
code, Development, HTML, Java, JavaBean, JSP, JSTL, Programming, taglib, tld files, web, XML, Программирование, разработка
Источник
Теперь перейдем к рассмотрению методик работы с SQL-запросами в jstl. Скажу честно и прямо, этот подход ужасен (полагаю, вы все в курсе, что смешивать логику и визуализацию глупо). Хотя этими тегами я иногда пользуюсь для маленьких, секретненьких (никогда ни кому не показываемых) проектиков.
Для работы всех показанных далее тегов необходимо подключить к jsp-файлу следующую библиотеку тегов:
<%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql" %>
Read more...
Development, Java, JSP, JSTL, Programming, SQL, web, XML, Программирование, разработка
Источник
В прошлый раз я рассказал о тегах основного назначения, сегодня самое время перейти к средствам позволяющим работать с xml. Прежде всего, мы должны в заголовке jsp страницы подключить следующую библиотеку тегов:
<%@ taglib prefix="x" uri="http://java.sun.com/jsp/jstl/xml" %>
Во всех последующих примерах будет нужен xml-файл, вот его код:
Read more...
code, Development, HTML, Java, JSP, JSTL, Programming, web, Программирование, разработка