I'm trying to use the AdvancedTabPanel of the Advanced GWT Components library. I've put the JAR file under war/WEB-INF/lib and added to my classpath in Eclipse, and added to my HTML file:
<link id="advancedTheme" type="text/css" rel="stylesheet" href="./advanced/themes/default/theme.css"/>
Although it finds the Java classes and loads the okay, it doesn't find the CSS. How do I point it to the CSS properly? I can see that the file exists under the JAR, as org/gwt/advanced/public/advanced/themes/default/theme.css...
Edit: I've also added the <inherits name="org.gwt.advanced.Grid"/> tag in my .gwt.xml as indicated in their Quick Start...
I had initially thought the resources for a module would be dumped into the root of the web server based on the Eclipse plugin's demo project placing some css/html files there - but they're actually located under a path named after the module. Once I changed it to reference <projectname>/advanced/themes/default/theme.css (or to reference it with a stylesheet tag in the .gwt.xml file) it worked.
Related
I have this project structure (WEB-INF is inside src/main/webapp/):
I try to access a login.css from login.jsp using
<link rel='stylesheet' href="${pageContext.request.contextPath}/resources/css/login.css">
However Idea underlines it as cannot resolve directory:
I use servlets for this project, but however in the other project that uses Spring MVC, the same css link works perfectly. I suspect the ${pageContext.request.contextPath} links to a different folder in this case: to the project root (../src) instead of the root/src/main/webapp folder.
Is there a way to change where ${pageContext.request.contextPath} links to? Or some other way to fix it?
"resources" looks like a directory for maven or concept/grouping in your IDE. They are probably combined at the root of your WAR> My guess would be that your you should remove "resources" from the link as they really reside at the root of your web app.
${pageContext.request.contextPath}/css/login.css
Take a look at the WAR that is actually produced and where they would be in that.
Cannot find the correct path for css that must be included to .jsp file.
The css files are in css folder and jsp is in folder "views" as shown in
this picture.
Have tried different paths to include it, but without result.
<link href="<c:url value="..." />" rel="stylesheet">
<link href="..." rel="stylesheet"/>
Could someone give information or correct path from .jsp file ?
Since WEB-INF folder is protected by server, you should move css & js folder to upper level, means css & js folder should exists in WebContent folder directly.
The structure should be like this:
-WebContent
-META-INF
-WEB-INF
-css
-js
The relationship between where files physically exist in project structure and where they are in runtime context is a classic problem (in my experience) with Java.
You could try using:
System.out.println(System.getProperty("user.dir"));
to find out the directory at runtime and use this to build a correct reference to your stylesheet.
you can use ./css/yourfilename as the path
./ means one up the current directory but the best way to do it is using the absolute path there are many advantage of using the absolute paths for example href="http:www.example.com/css/main.css" .
as meantioned by simon the web-inf could also be the problem
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
I am trying to use an applet that is located in a jar that is located somewhere else in my system (not in the same project location as the web stuff). I know of a property called codebase which is pointing to where the web for look for the jar that has the applet class. This is the code that I put in, but can't get it to work...
<script type="text/javascript">
if (_app == "Netscape")
{
document.write('<object classid="java:UareUApplet.class"',
'type="application/x-java-applet"',
'name="UareUApplet"',
'width="1"',
'height="0"',
'type="application/x-java-applet"',
'pluginspage="http://java.sun.com/javase/downloads"',
'archive="UareUApplet.jar, dpuareu.jar"',
'onFMDAcquiredScript="onFMDHandler"',
'onEnrollmentFailureScript="onEnrollmentFailureHandler"',
'onImageCapturedScript="onCaptureHandler"',
'codebase="C:\Users\modonnell\Desktop\UareUApplet\UareUApplet\UareUApplet\Register\"',
'onDisconnectedScript="onDisconnectedHandler"',
'onConnectedScript="onConnectedHandler"',
'onErrorScript="onErrorHandler"',
'onLoadScript="onLoadHandler"',
'bRegistrationMode="true"',
'bDebug="true"',
'bExclusivePriority="true"',
'scriptable="true"',
'mayscript="true"',
'separate_jvm="true"> </object>');
}
If I paste in the jar into the folder of my web project, and take away the "codebase" declaration, the applet will work. But I don't want to have to paste in the jar after each compile.
I needed to add the path to the jar all in the archive tag. I needed to completely remove the codebase tag.
Can anybody provide some instruction on how to setup a war file to show a favicon.ico in the browser address bar?
You can also use the following HTML markup in your HTML:
<link rel="icon" type="image/gif" href="/img/image.gif">
Most newer browsers should support it and I think it's generally a more clean way since you can use any image type/name/location you want.
This might be different in different application servers. For tomcat, the favicon comes from the directory your root context is mapped to. So if your application is mapped to the root context [/], just place the favicon.ico file in the top level folder in your war file.