JSP :: How To Import / Refer Css
Aug 7, 2014
accdg to this: [URL]....
we can use EL expression as follows:
${pageContext.request.contextPath}
but there's no instructions as to how I will set its value.
And also, what would happen in case I refer 2 css files in my jsp and both defines the following:
CSS 1 :
body { background-color: #fdf5e6;
font-size: 810px;
}
CSS 2:
body { background-color: #fdf5e6;
font-size: 50px;
}
View Replies
ADVERTISEMENT
Apr 5, 2014
Usually, most of the time, I import the standard java stuff.But what happens when I find a code with a list of those com. imports:
import java.io.File;
import java.io.IOException;
import com.itseasy.rtf.RTFDocument;
import com.itseasy.rtf.text.Border;
import com.itseasy.rtf.text.Field;
Where are these imports and how do I "get" them?
View Replies
View Related
Apr 4, 2015
how to refer to objects die1 and die2 in the PairofDie class from the SnakeEyes class and what to do.
public class Die {
private final int MAX = 6;
private int faceValue;
private int sum;
//private int faceValue2;
public Die(){
faceValue = 1;
[code]....
View Replies
View Related
Nov 2, 2014
I try to get the following code to work. I made a class(Rechthoek) with a constructor and getters and setters.Now, I am trying to make a second class which should create several "rechthoek" objects (setting values in the code of the Rechhoekapplicatie class -->which also acts as main class). However I can't seem set the values in the code; the setter methods won't do it.
I treid: Rechthoek.setLengte() but for some reason the program tells me I need a method setLengte, but I already have a settermethod (setLengte) for it! I do not get it.
Class1:
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package Domein;
[code]....
View Replies
View Related
Feb 20, 2015
How does the keyword this in the CoffeeSize class refer to the size of the coffee ? I am also confused as to how the CoffeeSize constructor comes into play to determine the cost.
public class Test
{
public static void orderCoffee(CoffeeSize size)
{
size.print();
}
public static void main(String[] args)
{
orderCoffee(CoffeeSize.SMALL);
}
[code]....
View Replies
View Related
Apr 3, 2014
Created a java.sql.connection object. Refering those obj inside public void run() { } If i declare as final inside a method, i can't refer those outside method due to scope. Cannot refer to a non-final variable dbConnObj inside an inner class defined in a different method...
View Replies
View Related
Jul 1, 2015
i am migrating my web application from Server1 (Tomcat 5 and Java 1.5) to Server2 (Tomcat 7 wand Java 1.6).
In my web application, I have multiple adapters (web clients) that are connecting to external web services, https interfaces, sftp servers etc.
In order to connect with all these external interfaces, i have installed multiple certificates in my JRE keystore on Server1.
Now since the application is going to be migrated to Server2, i need to know if there is any way I can import all the existing certificates from Server1 JRE to Server2 JRE?
Since the application has been running on Server1 for a long time, I am not sure, what exactly is a complete list of certificates that I need to install on my Server2 JRE.
So i am kind of looking how can i generate the keystore file with certificates from the existing server1 JRE and then import it into Server2 JRE.
Does this command provide a list of all the installed certificates on my Server1 JRE?
server1:/webdienste/java/jdk/xxx/current/jre/lib/security> sudo /webdienste/java/jdk/xxx/current/bin/keytool -list -v -keystore cacerts | grep Eigner
The other solution i can think of is to manually download/save all the certificates by opening all the URLs in the browser and then import the .pfx files through keytool into my Server2 JRE.
View Replies
View Related
Apr 7, 2015
how to make a simple game. I am having trouble when it comes to adding sound though. It tells me to do this:
package net.game.Game;
import java.applet.Applet;
import java.applet.AudioClip;
public class Sound {
public static final AudioClip BALL = Applet.newAudioClip(Sound.class.getResource("ball.wav"));
public static final AudioClip GAMEOVER = Applet.newAudioClip(Sound.class.getResource("gameover.wav"));
public static final AudioClip BACK = Applet.newAudioClip(Sound.class.getResource("back.wav"));
}
What this does is it gets the sound file then gives it a name(BALL=ball.wav GAMEOVER=gameover.wav ect..) and then there is other code in other classes that call the sound so it will run but it keeps giving me an error and I don't know what to do. How can I get it to import the sound? Here is the error.
PHP Code:
Exception in thread "main" java.lang.ExceptionInInitializerError
at net.game.Game.stuff.<init>(stuff.java:35)
at net.game.Game.stuff.main(stuff.java:62)
Caused by: java.lang.NullPointerException
at sun.applet.AppletAudioClip.<init>(Unknown Source)
at java.applet.Applet.newAudioClip(Unknown Source)
at net.game.Game.Sound.<clinit>(Sound.java:7)
... 2 more
View Replies
View Related
Sep 1, 2014
I see you can import in 2 ways:
import java.util.*;
or
import java.util.Scanner/Random/etc;
if I used the first one it imports all the librarys within that (directory?). If so would that add to a bigger file size?
View Replies
View Related
Sep 17, 2014
I'm making an import/export of xml - I have the import of xml sorted I'm just trying to finish off the export. My export class is called XmlWriter.java. Inside the class I have an updateFile method to update an xml file as such:
public void updateFile(Environment environment,Document doc)
{
// code
}
I then in my main method have
public static void main(String argv[]){
//declare new object of class
XmlWriter xmlWriter = new XmlWriter();
//test testUpdate method
// xmlWriter.testUpdate();
Environment environment = ;
[code]....
I don't know what to make my variables equal to - eclipse keeps trying to use null but obviously that won't work. The Environment is another class that just contains getters and setters for the 3 different databases (that are in the xml file) and the getter/setter for the environment ID (also in xml file).
View Replies
View Related
Feb 13, 2014
Often times i don't remember which package a specific class (like ArrayList) belongs to. Is there an easy way to find that java.util.* is what i need to import, if i wanted to use the class ArrayList ?
View Replies
View Related
Jun 4, 2014
How to use a .class file I unpacked from a .jar file I downloaded from the Internet.
I downloaded the commons-io-2.4.jar file from commons . apache . org /proper/commons-io/
In it you can see that there is a class called FileUtil.class:
jar tf commons-io-2.4.jar | grep FileUtil
org/apache/commons/io/FileUtils.class
I extracted this with the following command:
jar xf commons-io-2.4.jar FileUtils.class
It is now in ..uk/ac/ebi/bioinvindex/services/datasearch/commons/FileUtils.class
Now, I have a java file where I would like to use FileUtils.
How do I do that? How do I import it?
View Replies
View Related
Apr 21, 2015
I have imported several maven projects but I am trying to import a spring project via eclipse and it is not displaying. I did the following file->import->Existing maven projects->browse (found my project)->finish..... The project does not display and I cannot find it. I tired to do it again and the project cannot import because I cannot select it meaning it is already installed.
View Replies
View Related
Feb 24, 2015
I am still playing around with decks of cards, and am now trying to implement some visualizations using Applets.
Here is how I enter my deck of cards into an array list: this works just fine:
String[] Suits = new String[]{"S","H","D","C"};
String[] Values = new String[]{"A","2","3","4","5","6","7","8","9","10","J","Q","K"};
ArrayList<String> deck = new ArrayList<String>();
for(String suit : Suits) {
for(String value : Values) {
deck.add(suit+"_"+value);
}
}
The end result of this is an array 'deck' which contains a string representing each of the 52 playing cards. Great.
Now I would also like to use some pictures for future implementations I am working on. I have 52 images (.png, though I doubt it matters) stored in the right place. They are named as "H_5.png", and "S_A.png", for example, just as I named the cards in the previous array. I would like to do something as follows
ArrayList<Image> deckpic = new ArrayList<Image>();
for(String suit : Suits) {
for(String value : Values) {
deckpic.add(getImage(suit+"_"+value+".png"));
}
}
Now of course this doesn't work. The line
suit+"_"+value+".png"
is a string, not the name of a file. How I have previously loaded images is to use something like this:
the_pic = getImage("picture_of_pony.jpg");
but of course I can't use the quotations in my card loop, since I want "suit" and "value" to range and not just be the strings suit and value.
View Replies
View Related
Jan 25, 2014
I have the following data in a file called books.xml in my WEB-INF folder:
<?xml version="1.0"?>
<books>
<book>
<name>Padam History</name>
[Code] ....
I'm using the following code in a jsp:
<c:import var="bookInfo" url="/WEB-INF/books.xml" />
I know that it's finding the file because if I delete books.xml from the WEB-INF folder I get a FileNotFound exception.
However, for some reason it doesn't appear to be importing the data into the bookInfo variable.
I noticed this problem because when I try to parse it via:
<x:parse xml="${bookInfo}" var="output"/>
I get org.xml.sax.SAXParseException: Premature end of file.
When I try to display the data in the variable either by:
<c:out value="${bookInfo}" />
...or by means of a scriptlet (which I realize is not a best practice):
<%
String myVariable = (String)pageContext.getAttribute("bookInfo");
System.out.print("bookInfo=" + myVariable);
%>
...I get nothing.
BTW when I do:
<c:import var="data" url="http://www.tutorialspoint.com"/>
<c:out value="${data}"/>
that works fine!
View Replies
View Related
Oct 16, 2014
This code doesn't recognise the package ( and therefore class ) timetest3, when I try to import it. The package I try to reference/call, follows, and works fine.
import javax.swing.JOptionPane;
import timetest3.TimeTest3;
public class timetest4 {
public static void main(String args[]) {
TimeTest3 time = new TimeTest3();
time.setTime(13,45,52);
[Code] ......
View Replies
View Related
Feb 22, 2014
package statics;
public class Test_main {
public static void main(String[] args) {
Math.log(50.00);
}
}
I am able to use a Math method without importing the java.lang.Math. Which makes me think
1) What is the use of the import statement in java?
2) Is my IDE taking care of the import automatically?
I am using Eclipse IDE and JDK 1.7.
View Replies
View Related
Feb 12, 2015
I have written a library in one project but cannot seem import to import it into my main project whenever I try Maven says it cant find it though it is installed in the repository and the .jar file is in the classpath.
mvn -v
Apache Maven 3.2.5 (12a6b3acb947671f09b81f49094c53f426d8cea1; 2014-12-14T17:29:23+00:00)
Maven home: c:Mavenbin..
Java version: 1.8.0_31, vendor: Oracle Corporation
Stack trace
org.jclarion.clarion.lang.ClarionCompileError: Class Not Found:com.MyProj.app.MyClass near line:310 (selma012.clw)
at org.jclarion.clarion.lang.Lexer.error(Lexer.java:190)
at org.jclarion.clarion.compile.grammar.AbstractParser.error(AbstractParser.java:111)
at org.jclarion.clarion.compile.grammar.AbstractParser.importJava(AbstractParser.java:463)
at org.jclarion.clarion.compile.grammar.AbstractParser.emptyLex(AbstractParser.java:258)
[Code] ....
Library POM
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.MyProj.app</groupId>
<artifactId>MyClass</artifactId>
<packaging>jar</packaging>
[Code] ....
View Replies
View Related
May 20, 2015
I am trying to understand the package and import functions.
The path to access the file " library.book" is
C:UsersKameshDesktopJava SessionJAVAOCA7ooklibrary
and i can see 3 txt files
Book.class
Book.ctxt
Book.java
while compiling i am getting <identifier>expected error.
Here is the code :
package library;
public class Book {
public String isbn;
public void printBook() {}
}
package building;
[Code] .....
The error i get is <identifier>expected.
View Replies
View Related
May 22, 2014
I am trying to write a program, which includes an import data option. This option is used to import information from a text file.
The data is read from the file and objects are created and added to the student's record (The text file contains some information of the courses that the student is taking).
So my question is, how do i import information from a text file ?
and after they are imported, how do i create the objects in order to add them to the student's record ?
View Replies
View Related
Jan 24, 2014
I have xml-outout now i need to import to jsp page by using checkboxes...
View Replies
View Related
Apr 20, 2015
I'm getting errors on all the exceptions called EmptyCollectionException. I think this is because the import statement has a error on it but I'm not sure. I'm suppose to add methods for peek, isEmpty, size, and toString methods. I only started isEmpty also am wondering what I have to change from peek method if anything at all.
import jsjf.exceptions.*;//Error on jsjf
import java.util.Arrays;
public class ArrayStack<T> implements StackADT <T> { //Error on StackADT
private final static int DEFAULT_CAPACITY = 100;
private int top;
private T[] stack;
[Code] .....
View Replies
View Related
Nov 14, 2014
So im trying to make a coin flip game in java. Im relatively new to the language and the only other language i knew was javascript so im still learning. Ive already made one before using just one class and putting all the code inside, but im now trying to do it with methods since im trying to learn them. The basic idea of the game is that the user picks how many coins they'd like to flip, they pick heads or tails, then the computer flips the coins and calculates if there was more heads or tails to tell the user if they won or not. Im not quite complete with the program as you can see but ive already run itno an error. I was just doing some tests on the code i already have and i found that when i call the method settingUpCoin in my main class the program terminates. So basically, when i run it, it executes userImp right, transform right, but then it dosent let you enter a value for howManyCoins and terminates before you get to settingUpCoin.
(Notes: this was all done in eclipse luna build or the java ide. The class files are all separate in the actual thing i just put them together here to demonstrate my code.
import java.io.IOException;
public class Coin
{
double myCoin;
int numOfCoins;
int counter;
double arrayOfCoins[] = { };
[code]....
View Replies
View Related
May 15, 2015
I have a small issue with my code where im encrypting and decrypting messages.
My import org.apache.commons.codec.binary.Base64;. does not work.
It says binary does not exist_ Why this happens?. I've downloaded the codec but im starting to wonder if it has to do with where the codec folder is located, but i may be wrong.
import java.io.UnsupportedEncodingException;
import java.security.InvalidKeyException;
import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.NoSuchAlgorithmException;
import java.security.PrivateKey;
import java.security.PublicKey;
[Code] .....
View Replies
View Related
Apr 24, 2015
I have a library that I'm writing, the library contains a spring xml configuration file (lets say it's called libraryContext.xml) that sets the library up correctly for runtime, it also includes a test spring xml file that sets the library up for test by importing libraryContext.xml and overriding certain dependency injection beans (the library basically connects to a real database under normal conditions and uses dummy DAO's under test conditions). That bit is all fine.
The thing is, when I build the jar for the library (lets say it's called library-0.1.jar), the jar does not seem to contain the libraryContext.xml and that means that I can't import library.xml into my applications context.xml.
Basically, I have this line in my applications context.xml
Java Code: <import resource = "classpath:libraryContext.xml"/> mh_sh_highlight_all('java');
Unsurprisingly, since the xml file is not contained in the library-0.1.jar, the error I get is,
Java Code:
Offending resource: class path resource [applicationContext.xml];
nested exception is org.springframework.beans.factory.BeanDefinitionStoreException:
IOException parsing XML document from class path resource [libraryContext.xml];
nested exception is java.io.FileNotFoundException: class path resource [libraryContext.xml] cannot be opened because it does not exist mh_sh_highlight_all('java');
With respect to potential solutions to the above problem, I could:
1) physically copy the libraryContext.xml file (and its other *.xml and *.properties dependencies) into the application, but then I'd have to maintain duplicate files - I don't like this option.
2) find out if there is a better way to handle this problem from people who know better. E.g. is there a way to embed the libraryContext.xml file (and it's dependencies) into the jar file so that it can then be imported into the application. I've spent a while on google trying to figure this out and haven't come up with anything overly useful (perhaps I've been using the wrong search parameters).
View Replies
View Related
Feb 17, 2014
I am puzzled by a note in the book I am reading (by Mala Gupta). Page 55 says "All java components you've heard of can be defined within a java class: import and package statements, variables.....". But the online oracle doc (tutorial) clearly says the following 2 statments:
"If present, package statement must be the very first line in a file"
"To import a specific member into the current file, put an import statement at the beginning of the file before any type definitions but after the package statement, if there is one. " (Here).
So, how can import and package be present inside a class ? (This seems to go against the 2 statements from oracle online tutorial).
View Replies
View Related