How to add classes folder in web-inf in eclipse - java

I am new to struts. So in eclipse I don't have web-inf->classes, where I should put my struts.xml.In other project I have done this by
project->properties->java build path->output folder->browse(webcontent->web-inf->classes)->create folder(classes)->advanced->apply.
But now it is not working .the struts.xml file is now created in java resources->libraries->web app libraries.
Please see the image:

While deploying struts project struts.xml need to bee kept in web inf folder not in classes folder that is in web app folder .Once you copied your struts.xml file in web inf folder refresh your project by right click on project.
Else you can create a new dynamic web project and copy all your files[![enter image description here][2]][2]

Eclipse offers the Navigator view which will display your project in the way you are asking. To open this view select Window > Show View > Navigator. then you can see where is your struts.xml if path is not correct check it.

Related

GXT 2.2.5 give ugly page

My project: GWT 2.3.0, GXT 2.2.5 Server: Glassfish 4.1. IDE: NetBeans 8.0.1 with plugin gwt4nb.
I try create simply GXT project but when i run application it give me page with only label and button looks like html. If i want add slider or other component - browser doesnt display this (I think code wasn't compile to html, css etc).
step by step what i done
1.Create new project: web application and technology: gwt
2. Add library to classpath gxt.jar
3. Add resources from gxt.rar to war folder in my project
4. Add <inherits name='com.extjs.gxt.ui.GXT'> to Main.gwt.xml
5. Add <link rel="stylesheet" type="text/css" href="resources/css/gxt-all.css" />to html
I think the problem is your gwt apps can't load the gxt-all.css. This is one of many ways to include the gxt-all.css file :
Create a new folder in you webapp folder (same level with your host.html file) and named it resources
Then inside the resources folder create another folder name css
Copy the gxt-all.css file inside this css folder
Clean your workspace, and restart you gwt application, and you should be good now.
Hope this helps. Thanks

Uploading app to Web App Engine in IntelliJ

I'm trying to deploy my app to Web App Engine. I have WAE module in web part of my project; there is a path specified in Modules/web/Google App Engine:
/Users/Kamil/IdeaProjects/appengine-java-sdk-1.9.12/
Although when I click on we in general (Modules/web/"Paths" tab), I see following settings:
Output path:
/Users/Kamil/IdeaProjects/NameOfMyProject/web/target/web-1.0.0-SNAPSHOT/WEB-INF/classes
The problem is:
When I click "Upload Web App Engine Application" following error appears:
Bad configuration: Could not locate
/Users/Kamil/IdeaProjects/NameOfMyProject/web/target/web-1.0.0-SNAPSHOT/WEB-INF/appengine-web.xml
I don't get it why it tries to search in wrong directory, not the one specified in Modules. Please advise.
Edit
I noticed that in Modules/web/"Sources" tab whole folder named "target" is excluded. Maybe that's the problem?
According to the error message
Bad configuration: Could not locate
/Users/Kamil/IdeaProjects/NameOfMyProject/web/target/web-1.0.0-SNAPSHOT/WEB-INF/appengine-web.xml
, the deployment code is looking for appengine-web.xml, a crucial config file for your App Engine app. It's looking for that file here:
/Users/Kamil/IdeaProjects/NameOfMyProject/web/target/web-1.0.0-SNAPSHOT/WEB-INF/appengine-web.xml
Is it possible that the file
/Users/Kamil/IdeaProjects/NameOfMyProject/web/target/web-1.0.0-SNAPSHOT/WEB-INF/appengine-web.xml
could not be located ("Bad configuration: Could not locate ") because the file
/Users/Kamil/IdeaProjects/NameOfMyProject/web/target/web-1.0.0-SNAPSHOT/WEB-INF/appengine-web.xml
does not exist?
The path /Users/Kamil/IdeaProjects/appengine-java-sdk-1.9.12/ is the path to your SDK, not the target folder, and is not related to this issue.
The target file is excluded from "sources" because "sources" is the location of files that are included as source code into the build. The target folder is the opposite of source files - it's the flattened-out WAR archive that is used to deploy your app. The deployment tool you use will pack it up into a .war file and send that to the App Engine data centers.
Finally, the output path folder .../classes is where the compiled .java files that turn into .class files for your app are put.
I think you should look into some tutorials on IntelliJ and App Engine to make sure that your project was created and configured properly.
Good luck!
One you can do that locate build folder in explorer and delete it. After that reopen android studio build it again and run it. Now every thing is fine.

Netbeans created project has no glassfish-web.xml

I have a Spring/Glassfish project created using a NetBeans wizard at the start of the year (so I don't remember the exact settings used to create it).
The strange thing though is that there is no glassfish-web.xml file inside the project whereas a different project created at the same time does have one.
Why would a project not have a glassfish-web.xml file?
I've been investigating a character encoding issue and some responses suggest adding to glassfish-web.xml:
<sun-web-app>
<parameter-encoding default-charset="UTF-8" />
</sun-web-app>
However I can't do that as I don't have a glassfish-web.xml!
Is it possible to add one? If so what do I need to do in order to make sure it is read?
If the file is included after project creation depends on the archetype (means the project template you have chosen) which is used. Some archetypes already contain a glassfish-web.xml, most of them don't.
You can easily create one by right-clicking on the folder WEB-INF, then choose New and GlassFish Descriptor. If this option is not available you may have to add the JSF facet to your project (right-click the project and add JSF in the frameworks tab).
You can also create the file manually, just create a new xml file in the WEB-INF folder, give the appropriate name and paste the desired content into the file.
See also:
glassfish-web.xml vs sun-web.xml vs web.xml

web.xml configuration for JSP

This is the structure of the JSP app on eclipse.Once I run it on eclipse using tomcat server(localhost:8090/index4.html) it works.On the index page i have to add details,this details are uploaded via the servlet as you can see above Java Resources->src->FileUPloadDBServlet(Also I am not sure if it uses this or it uses WEB-INF->src->FileUploadServlet below.)
In my index4.html the action is action=uploadServlet(no address given for it).This everything works on using eclipse.
But once I put the QMS folder(not WAR) from eclipse worskspace to tomcat ROOT,the index4.html works but the following action,i.e uploadServlet doesnt work(here I use the address localhost:8090/WebContent/index4.html)I dont have a web.xml.
Is that creating a problem?
Please provide me help.
You need to put your project folder or .war file in the
webapps folder of Tomcat directly not in ROOT folder under webapps.
Try to follow directory structure as follows
Photo Courtesy http://www.studytonight.com/servlet/steps-to-create-servlet-using-tomcat-server.php (Here you can also find more details on Servlet and JSP, as well as project structure)
Where you have your web.xml put into the WEB-INF folder under your application folder.
For java files you don't need the source files, the classes folder will have all the source folder (src) files compiled and ready to execute.
The lib will contain all the .jar files you need for your application to run.
Make sure you put web.xml file at proper place, because without it, application will not be able to run. Because as they say web.xml is Heart of the application.
Let me explain you the problem.
When we configure a dynamic java project to run on eclipse the server takes the just the stuff from webcontent folder and deploy it the wbcontent folder contains web.xml file which defines the url descriptor for servlet.
now when you copy the whole folder the server can not find the web.xml file which is a descriptor where it expects the file to be.
hope its clear comment for clarification

Android: Eclipse does not show file

I am creating a sub-folder named xml under the res folder in one of my projects. In the xml sub-folder I am creating an xml file, but this file does not show when I double-click the xml sub-folder under project explorer.
It is a kind of common bugs in Eclipse.
Try these things in order:
1. right click subfolder Xml> Refresh.
2. right click Res > Refresh.
3. File > Refresh.
& if these dont work
4. Restart eciplse

Categories