Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Aphorismen
Applications
Business Economics & Admin.
My Computers
Cooking
Devices
Folders
Food
Hardware
Infos
Software Development
Sports
Operation Instructions
Todos
Test
Help
Glossary
Community portal
adaptions
Sidebar anpassen
Wiki RB4
Search
Search
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
GAE
(section)
Page
Discussion
English
Read
Edit
View history
Toolbox
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Special pages
Page information
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Development Process== ===New Project=== The wizard creates a directory structure for the project, including a src/ directory for Java source files, and a war/ directory for compiled classes and other files for the application, libraries, configuration files, static files such as images and CSS, and other data files. The wizard also creates a servlet source file and two configuration files. The complete directory structure looks like this: <Project>/ src/ <Project>/ server/ <Project>Servlet.java META-INF/ jdoconfig.xml log4j.properties logging.properties war/ WEB-INF/ lib/ ...App Engine JARs... [[#appengine-web.xml|appengine-web.xml]] [[JEE#Deployment_Descriptor|web.xml]] index.html ====Specific Configuration Files==== =====appengine-web.xml===== appengine-web.xml is specific to App Engine, and is not part of the servlet standard. <?xml version="1.0" encoding="utf-8"?> <appengine-web-app xmlns="http://appengine.google.com/ns/1.0"> <application></application> <version>1</version> </appengine-web-app> =====persistence.xml===== * JPA configuration * general description in [[JavaJEEJPA#persistence.xml|persistence.xml]] =====jdoconfig.xml===== It resides in the directory <code>war/WEB-INF/classes/META-INF/</code>. ===Implementation=== ====New Servlet==== * New Java Class Wizzard with base javax.servlet.http.HttpServlet * add Servlet in \war\WEB-INF\web.xml ====JPA==== * create src\META-INF\[[#persistence.xml|persistence.xml]] =====save an entity===== X x = new X(); x.setA(a); javax.persistence.EntityManager em = EMFactory.get().createEntityManager(); em.persist(x); =====retrieving entities===== javax.persistence.EntityManager em = EMFactory.get().createEntityManager(); javax.persistence.Query q = em.qreateQuery("SELECT v From <CLASSNAME> v"); List<CLASSNAME> results = q.getResultList(); Iterator<CLASSNAME> iter = results.iterator(); while (iter.hasNext()) { <CLASSNAME> v = iter.next(); } ===Run/Debug Project=== With Eclipse, you can leave the server running in the debugger while you make changes to source code, JSPs, static files and appengine-web.xml. When you save changes to source code, Eclipse compiles the class automatically, then attempts to insert it into the running web server dynamically. In most cases, you can simply reload the page in your browser to test the new version of the code. Changes to JSPs, static files and appengine-web.xml are recognized by the development server automatically, and also take effect without restarting the server. If you change web.xml or other configuration files, you must stop and start the server for the changes to take effect. ====Run==== *''Project Context Menu -> Run As -> Web Application'' or *''Project Context Menu -> Run As -> Run Configuration -> Web Application -> <Projectname>'' *Browser http://localhost:<port>/<Appname> ====Debug==== *''Project Context Menu -> Debug As -> Web Application'' or *''Project Context Menu -> Debug As -> Debug Configuration -> Web Application -> <Projectname>'' *Browser http://localhost:<port>/<Appname> ====Deploy changes==== * according documentation local engine should be updated after save but doesn't work, so go to Debug Perspective, select engine context menu and use 'terminate and relaunch' ===Stop Server=== * switch to Debug perspective * select application in the debug panel * press terminate button in button bar
Summary:
Please note that all contributions to Wiki RB4 may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Uwe Heuer Wiki New:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Toggle limited content width