 |

|
Create another list and add each result to it.
|
|
|
|
|

|
Are you trying to keep the results on same List? Because I wonder, if you have already create a List and store data, you should not stuck with creating another List and store the results in that new List. Could you please clarify, so I can help you further if required.
I appreciate your help all the time...
CodingLover
|
|
|
|

|
Hi to all,
public class xyz {
public static int gUserID = 1;
}
When 1st user Login gUserID value is = 5
and second user login gUserID value is = 7
Problem is 1st user refresh or re-direct to another page gUserID is changing to 7.
How to set Global variable for session or any solution to above problem.
Thanks.
|
|
|
|

|
How is the variable being updated?
The single variable is used by every instance of the class. If you want each instance to have a userId then you need something like this:
public class Test {
private static int nextUserId = 1;
private int userId;
public Test() {
this.userId = Test.nextUserId++;
}
public int getUserId() {
return this.userId;
}
}
Panic, Chaos, Destruction. My work here is done.
Drink. Get drunk. Fall over - P O'H
OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre
I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer
Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett
|
|
|
|

|
Hi Nagy Vilmos,
I m update gUserID from database. As soon as login to application. I m setting corresponding user id to that variable and I m utilizing that variable in complete project as global variable.
here I m facing problem. As soon as 2nd person login The Value is reset (2nd user id is updating).
I m trying your method now Thanks.
|
|
|
|

|
Now I understand.
You have an instance for each user, so the variable must not be static. If it is possible to set the value in the constructor, then that is the best thing because you can make the member variable final and so it cannot be changed.
It is strongly advised to not expose member variables outside the class, it is ALWAYS better to use in this case a method; as I used in my example. If the variable is final, then you can to some extent relax the rule as there is no way it can be changed; but this is normally reserved for constants.
Panic, Chaos, Destruction. My work here is done.
Drink. Get drunk. Fall over - P O'H
OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre
I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer
Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett
|
|
|
|

|
my +5.
I would like to point out that the UserID should also be an automatically created number that the user object should not modify - it's hard to identify the data otherwise.
|
|
|
|

|
Nanda_MR wrote: How to set Global variable for session
You start by researching how to handle session data in a web application.
|
|
|
|

|
Hi,
I have a problem on getting the project path of a web application.
Reason on getting the project path is I'm uploading a PDF Files to the project path so that I can open it to the browser, I'm hoping to do this http://localhost:8080/PDFviewer/UploadedFiles/sample.pdf.
I have found something in the Internet but the path is not in my project path
getServletContext().getRealPath("/");
My project path is D:\Java\Java Web Projects\PDFviewer but the above code is giving me D:\Java\Java Web Projects\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\PDFviewer
Can anybody please suggest a way of getting the application path in java.
Thanks...
|
|
|
|

|
The path the system gives you is correct, because the web server is placed in the wtpwebapps folder.
Try to deploy it and see if the path comes up correct on a test system. I assume so.
|
|
|
|
|

|
you're welcome.
This can be confusing, one is never secure to not struggle on such things.
|
|
|
|

|
yes, I'm really confused...
I can't see the uploaded files in my Eclipse App..
|
|
|
|

|
want to convert the content of video to byte in java could any body help me to do that?
|
|
|
|
|

|
Please anybody help me to implement Video Conferencing in my project Virtual Classroom using Java Media Framework and servlet.
Thanks
|
|
|
|
|

|
What is exact diff. between the operator,constructor and method overloading.....Give some examples also....
|
|
|
|

|
Classes and Objects[^]
Overriding Methods[^]
I can recommend to by a good book explaining the basics. And I can recommend to read them even one has already worked in the business( kind of back to roots)
|
|
|
|

|
when i want to deploy my application in tomcat server it can't and this is the error message
init:
deps-module-jar:
deps-ear-jar:
deps-jar:
library-inclusion-in-archive:
library-inclusion-in-manifest:
compile:
compile-jsps:
Undeploying ...
undeploy?path=/Mango
OK - Application non-déployée pour le chemin de contexte /Mango
In-place deployment at D:\PFE\Mango\build\web
deploy?config=file%3A%2FC%3A%2FUsers%2FBouali%2FAppData%2FLocal%2FTemp%2Fcontext4268238340729989227.xml&path=/Mango
FAIL - Deployed application at context path /Mango but context failed to start
D:\PFE\Mango\nbproject\build-impl.xml:847: The module has not been deployed.
See the server log for details.
BUILD FAILED (total time: 2 seconds)
I await your answers in short delays. thank you in advance
|
|
|
|

|
The build script is already telling you what you should be doing next. Locate and look into the catalina.out file for more details as to why the web app failed to start.
As to where the catalina log files are, that depends greatly on what type of Tomcat install this is. If it's integrated in Netbeans then it's located in the .netbeans/7.1.1/apache-tomcat/logs.
If it is a debian / ubuntu based linux its found under /var/log/tomcat
In either case the catalina log will show the root cause of the failure to start. But it's most likely something in the web.xml that is wrong.
|
|
|
|

|
Hello there,
Above subject is my project topic.
So i need help for executing it properly on my Windows XP system.
Installed Software.
1.JDK
2.Tomcat
But i dont know how compile the code in eclipse.
Plz help me out.
|
|
|
|

|
cloudagent wrote: Plz help me out.
Read the eclipse help pages which explain how to create and build a project; it is really quite simple.
When you have a more specific technical question feel free to come back for further help.
Binding 100,000 items to a list box can be just silly regardless of what pattern you are following. Jeremy Likness
|
|
|
|
|

|
cloudagent wrote: But i dont know how compile the code in eclipse.
Hopefully either you have more than a beginner level of programming experience in java or have at least a mid-level experience in programming something like C++ or C#.
Otherwise in terms of what one might suppose "project topic" means you have bitten off more than you can chew.
If you do have that then it might help to note that you don't need eclipse to use tomcat.
|
|
|
|

|
i have ontology and i made a query on it in java with jena ,lets say that i search for "car" my request is how i retrieve all relations that related with "car"
note:i used wordnet into java but the result is so poor
|
|
|
|
|

|
in documentation I found code describe all the ontology in java but what i want is when i ask for "car" the result be all relations that related to "car"
|
|
|
|

|
Hi All,
I have a problem which is bit tricky for me. The problem is - A table is get display on my screen by another application. I have no rights to access that application. This table is also get refreshed in a time interval of 5 to 10 seconds. Now my problem is to fetch the data from the table displayed on the screen and prepare a separate report for every time interval.
So please help me to write the api for desired functionality.
Thanks in advance.
rks
|
|
|
|

|
You will have to interact with the host operating system for this. Java is really the wrong tool for the job.
|
|
|
|

|
Member 7660635 wrote: So please help me to write the api for desired functionality.
Easy - you can't as stated.
Member 7660635 wrote: I have no rights to access that application.
Did you actually mean that you do not have the ability to change it? As stated you have no way to get to the application at all, which means nothing is possible.
Presuming that you can in fact access the running application then to get to the data depends on the specifics of the application. However in general it would require an OS specific app, so not java, but instead a C/C++ app (which you might or might not be able to find free/shareware/commercial.)
|
|
|
|

|
what kind of "application with a table" is that??
What language is the other application written in?
There might be a reason for that you are not allowed to access - copyright for example is a pretty good one. In that case one has do deny the request.
|
|
|
|
|

|
I have a question,please help me,how can i distinguish and declare 1 method and 1 object in java?
Example:static void main(String[]args)throws Exception{
public static Test(int a){
}
}
Why i have to declare(int a)?
I am a newbie and please help me.
|
|
|
|

|
Why are you trying to declare one method (Test) inside of another method (main)? I don't think Java supports that...
As for "int a", that's an argument to the method (something that gets passed in as input). So if you wanted to call your Test method, you would have to pass in an int, and inside the method you would refer to that int as a.
|
|
|
|

|
on you [age you have somethink like this:
public class nameOfYouClass{
static void main(String[]args)throws Exception{
}
}
If ou want create new class you may create new class write somethink like this:
public class nameOfYouClass{
static void main(String[]args)throws Exception{
nameOfYouNewClass nameOf = new nameOfYouNewClass();
nameOf.newMethod();
}
}
class nameOfYouNewClass{
public void newMethod(){
System.out.println("Hello Workd!!");
}
}
and you will create new Object with method called newMethod.
If you want use class nameOfYouNewClass just create this class in the you main function. And you may use methods from this class(object)
|
|
|
|

|
Work your way through these tutorials[^], and all your questions will be answered.
Binding 100,000 items to a list box can be just silly regardless of what pattern you are following. Jeremy Likness
|
|
|
|

|
I have this the code below:
I used this code based in HashSet to remove duplicates but does not work:
public static <Enterprise> void removeDuplicates(ArrayList<Enterprise> list) {HashSet<Enterprise> h = new HashSet<Enterprise>(list);
list.clear();
list.addAll(h);
}
public static void main(String args[]) {
ArrayList<Enterprise> array = new ArrayList<Enterprise>();
array.add(new Enterprise("Micro System", 2001));
array.add(new Enterprise("Delta Force", 1980));
array.add(new Enterprise("Micro System", 2001));
array.add(new Enterprise("Golden Mayer", 1781));
removeDuplicates(array);
for (Enterprise item : array) {
System.out.println(item);
}
}
}
public class Enterprise {
private String name;
private int yearFondation;
public Enterprise(String name, int yearFondation) {
this.name = name;
this.yearFondation = yearFondation;
}
public String getname() {
return name;
}
public int getYearFondation() {
return yearFondation;
}
public void setname(String name) {
this.name = name;
}
public void setYearFondation(int yearFondation) {
this.yearFondation = yearFondation;
}
@Override
public String toString() {
return "Enterprise : " + name + " Year of Fondation : " + yearFondation;
}
}
|
|
|
|

|
Enterprise is a class, so when you call
array.add(new Enterprise("Micro System", 2001));
twice, you are actually adding two different Enterprise objects to array; they just happen to have the same data.
If you want the identical objects to be treated as if they were the same object, unfortunately I don't recall how HashSet does the comparisons, but I'm guessing you'll either have to override equals or hashCode on the Enterprise class.
|
|
|
|

|
It does comparisons with equals and hashCode, yes. And if you override one you should override the other.
|
|
|
|

|
If you generate hashCode() and equals() in Enterprise class all must works. If you use Eclipse go into Source - > Generate hashCode() and equals()... and Eclipse will generate this code instead of you, if you don't know how to do this.
|
|
|
|

|
Hi People!
I search a educational imap client project without api´s.
Thanks!
|
|
|
|
|

|
I'm rolling my own text system, or trying to anyways...
I cycle through the bitmap to determine the texture coordinates of every character. Then add them to the map via their associated char. Later I cycle through a string to pull the texture coords and add them to the buffer... the coords are correct going in but not pulling out.
private HashMap<Character, float[]> glyphs = new HashMap<Character, float[]>();
glyphs.put(c[i], temp);
float temp[] = glyphs.get(a);
The array returned is the same one for every char sent to the retrieval function. I must be doing this wrong... any help?
EDIT: The coord to be retrieved is the coord of the last thing put into the map.
modified 2-May-12 18:27pm.
|
|
|
|

|
Figured it out... <.>
I wasn't instantiating a new temp each pass. So the last element is stored for every key. Easy fix, just re-instantiate the variable before setting a value and calling put()
|
|
|
|

|
snap! You got it while I was typing (and taking a phone call....)
Cheers,
Peter
Software rusts. Simon Stephenson, ca 1994.
|
|
|
|

|
Np, thanks for trying. ^^
|
|
|
|

|
I can't see the rest of your code, but it smells like you are reusing the same temp, effectively overwriting the same item on every put().
Peter
Software rusts. Simon Stephenson, ca 1994.
|
|
|
|

|
Yup, had just posted that. XD Thank you though ^^
|
|
|
|
 |