I am currently creating my first project using Google App Engine in Eclipse. For my main page it seems I can create either:
a servlet (class that extends HttpServlet)
or I can create a jsp file.
Is there a way in Eclipse to make it aware of the java code in a jsp file and to use all the IDE goodies such as colored text, inline documentation, auto-complete? And is there a way to auto build and validate the code in a jsp or it can only show the errors on the first load of the web app?
It seems to be a lot easier to develop in a servlet class than in a jsp file. Or did I miss something?
Eclipse tries to validate the markup and autocomplete it in the JSP files if you have the WTP (Web Tools Platform) installed. But even that sometimes doesn't work well because it's difficult to parse HTML containing JSP tags, Javascript, etc.
Regarding the Java code : it's bad practice to have Java code in scriptlets in JSPs. You should only use JSPs for pure presentation logic, and use JSTL and custom tags for that. The Java code should be in a servlet or action invoked before the JSP. Use an MVC framework (Stripes, Struts, Spring MVC, etc.) to separate your Java code from your JSP code. I've used Stripes on app engine with success and pleasure.
To make sure your JSPs are valid, you can be helped by Eclipse, but you should also deploy your webapp (on the local server) and run tests to make sure every JSP compiles and runs correctly. You can automate these tests with HtmlUnit or Selenium.
Related
We have developed eclipse plugin which will convert the jsp to wicket framework.
Our tool will parse the jsp files and convert them to wicket using antlr.
-
we will run our plugin project using eclipse application.
A new runtime eclipse application will open with the plugin symbol in the tool bar.
For the first time when we click on the plugin symbol, the wizard pages are getting opened and the tool is parsing the jsp files and convert them to wicket using antlr.
After parsing the jsp files our tool generates some validator classes using velocity templates, and generates some other classes using templates that are necessary for the generated wicket project to run on the server.
Next time in the same runtime apllication if we click on the plugin symbol the wizard pages are getting opened but the parsing of jsp files is not performed.
what might be the issue? please help us.
Sorry we couldnot provide the code.
Can someone help me to place my GWT application on Jetty. I am not using maven. I have libraries in my build path.
First I am taking the war folder already exploded and copy it in jetty/webapps, then in folder context.
I have placed a folde named BiddingSystem in folder web apps, it is an already exploded folder and not a .war file
In folder jetty/context, there is a file test.xml
I am renaming the file to BiddingSystem.xml
and also editing content of BiddingSystem.xml, finally the content of BiddingSystem.xml is
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
<configure class="org.mortbay.jetty.webapp.WebAppContext">
<set name="contextPath">/BiddingSystem</set>
<set name="war"><systemproperty name="jetty.home" default="."/>/webapps/BiddingSystem</set>
</configure>
I am getting this error:
to deploy GWT app on Jetty, you often do not need to configure anything.
Copy your 'war' folder (which is created in your eclipse project by GWT) to JETTY_HOME\webapps
change the name 'war' to anything you like for examples "StockWatcher" so you will have JETTY_HOME\webapps\StockWatcher. Now start jetty server and try http://localhost:8080/StockWatcher on your Chrome :)
When GWT is compiled it creates just javascript and html (plus resources like css/jpg/etc..). GWT jars and your Java classes are only used during build process and NOT needed during deployment.
So, you just need to copy contents of you /war directory to your Jetty deployment directory.
There is a .html file which is called host page. It links to all other javascript and css pages needed. This is the entry point to your app. Just open this page in your browser.
It seems that you are new to GWT so there are a few basic things you need to know:
GWT is a client-side technology. You write Java code which is compiled to javascript that then runs inside browser. In this sense GWT is more related to javascript libraries (jQuery,..) than classic page-by-page web frameworks (jsf, Ror, php).
GWT app runs inside a single HTML page (called a host page). This page ever reloads. Look at Gmail to see how this works (though Gmail itself is not written in GWT) .
GWT is NOT a server side technology. You can use any technology on the server side (php, RoR, anything) that supports REST.
GWT can talk to server via AJAX. The data exchange format can be JSON or XML. Backend can be any technology that can produce REST-style JSON or XML content. If you have Java backend you can use GWT-RPC which adds some more capabilities over AJAX/JSON.
I'm new to jms and springs and eclipse as well. i'm trying to implement jms example using Springs in MyEclipse 7.1, and i have been referring the following url.
http://java-x.blogspot.com/2006/12/implementing-jms-with-spring-messaging.html
But Iam unable to understand how to execute the program, it contains a servlet but does not have any html or jsp page, should i create a web project for it or java application? How do i run the program.
Thanks and Best Regards.
You should create a web project to hold the servlet. A web project will have a directory for java source and a directory for web content (images, html, jsp, etc.). Make sure that you put the servlet code inside the java source directory. You will also need to register the servlet in web.xml unless it is a Java EE 5 servlet with annotations.
To run your servlet, right click on it and select Run As -> Run on Server
In my autogenerated ~/src/main/ folder, I have a folder called 'frontend' with my Java UiBinder file and my .ui.xml UiBinder file. How do I make STS/Roo run this instead of ApplicationScaffold.html?
Furthermore, what am I supposed to do with ApplicationScaffold? It seems useless.
The ApplicationScaffold.html file loads the ApplicationScaffold.nocache.js javascript file which bootstraps the GWT app. by calling the class which is mentioned in the ApplicationScaffold.gwt.xml file. Search for
I haven't tried this out myself but was just trying to figure out how to run the spring roo generated app in gwt debug mode inside eclipse and like this you can follow yourself whats happening (install the google gwt plugin) and right click on the roo project and do: properties->google->this project has a war file and point to the target/pizzashop-0.1.0.BUILD-SNAPSHOT folder. Then run -> debug as -> Gwt application ...
I am working with Eclipse and JBOSS. I was wondering if there is a way to do hot in-place deployment for a web project, by integrating the JBOSS server with Eclipse.
By hot in-place deployment, I mean, I should be able to view the change made to a jsp , by refreshing the page on the browser, not required to go through the routine , build-deploy-test cycle.
Take a look at JBoss Tools. That has everything you need.
JBoss Tools seems to do auto-redeploy by default when you create a web application with their wizard: http://docs.jboss.org/tools/3.1.0.CR1/en/GettingStartedGuide/html/jsp_application.html#AutoRedeploy
AFAIK every time you save a JSP they copy it to the application deploy directory in JBoss, but if your source layout matches the WAR layout they might run the application directly from your project directory (I know some versions of WTP did this with Tomcat, but with JBoss it's probably harder).
You are after "Exploded Hot Deployment" - deploys a directory of your files rather than an archive and then any subsequent "explode" will only deploy changes rather than the whole project (depending on how you have Ant configured).
Frameworks like Seam do this for you. Maybe worth grabbing a build.xml file from them and modifying it for your use?
Have you tried using JSP-Weaver?
Here is the Wikipedia description:
JSP Weaver is a JavaServer Pages
interpreter. Unlike JSP compilers it
evaluates the JSP files directly,
without generating or compiling
intermediate Java source files for the
JSP Java servlet.
Although this sacrifices some
performance on page rendering (10%-20%
overhead depending on the compiler in
question) it enables a much faster
reloading of changes made to the
source of the JSP file (10-20 times
decrease in time depending on the page
and the compiler in question).
Unlike simpler attempts at
interpreting JSP-like syntax (e.g.
Facelets) it supports embedded Java
statements called Scriptlets (a
standard JSP feature). This allows
full compatibility with the JSP
specification versions 1.0 to 2.1.
I also agree with Sietse in you should check out JBoss Tools. It is a great free alternative to the JBoss Developer Studio