1,963 Posted Topics
Re: The answer is very simple. You declare 2 variables: "min" "secondMin" that hold the values of the "min" and "second min". So why don't you declare 2 [U]more[/U] values that will hold the indexes: "minIndex" "secondMinIndex" [CODE] int min;// declare variable int secondMin;// declare variable int minIndex;// declare variable int … | |
Re: Have you imported Counter class at the jsp ? | |
Re: This is a small summary of your code: [CODE] Term term = new Term(); while () { if (str exists) { // don't add } else { // add term } } [/CODE] The problem is that term is declared outside of the while. So you do new Term() once. … | |
Re: What do you mean fetch the String. Since you already have the String, why do you need to fetch it? Also look at the String API: [URL="http://download.oracle.com/javase/1.4.2/docs/api/java/lang/String.html"]http://download.oracle.com/javase/1.4.2/docs/api/java/lang/String.html[/URL] for methods that you might want to use. | |
Re: Your Rational class seems ok. But you need to add private attributes to the class. When you call the constructor you need to assign the arguments. [CODE] class Rational{ private int numerator = 0; private int denominator = 1; // it cannot be zero! Rational(){ numerator = 0; } Rational(int … | |
Re: What output does it give? Did you enter anything? | |
Re: Use the String class. Check its API. Try to recognize if it is am or pm. If it is am then the result is the input, if you remove the last 2 characters: 2:00am - input 2:00 - output If it is pm, then just add 12 at the hour … | |
Re: Under which directory did you put the .java files as well as the .class files. I mean that for example you should do something like this: Folder : src/test1 File: p1.java Folder : src/test2 File: p2.java ----------- Folder : [I]folder path[/I]/[B]comp[/B]/test1 File: p1.class Folder : [I]folder path[/I]/[B]comp[/B]/test2 File: p2.class CLASSPATH … | |
Re: What code do you use to insert other types in the DB? Post the code that you have so far. Do you use Statements, or PreparedStatements? | |
Re: Buy a book, read a tutorial. How can anyone explain what you ask in a single post. What you ask is for someone to quote pages of books in a single post. Buy a book, read a tutorial. Write some code, compile it, deploy it. Use an IDE that does … | |
Re: [QUOTE=ajst;1428856]whats the diffrence between having auto complete avaible to you and going to sun website and looking at all the avaible methods in that class? They both achieve the same thing but going to the website will just take a bit longer.[/QUOTE] You need to know where to look. Or … | |
Re: First of all NobodySpecial doesn't need to have the unplugDrain, changeBulb methods because it doesn't implement the interfaces. It is not wrong, but the methods are not mandatory. As far as your question. You can put the main method in whatever class you want. You can put it in the … | |
Re: The format doesn't matter. It is used only for the presentation. As long as you have the date as a Date object there shouldn't be a problem. But if you have the date as a String, then you cannot insert it in the database if the column has Date type. … | |
Re: What exactly are you trying to accomplish? What do you want to build? Because from what I understand you want a software that will create your project for you. If you want to "develop application software and doing research regularly" then you should be learning the programming language on your … | |
Re: [QUOTE=manthra;1426915]hi all, I'm new to jsp.can any one help me to set URL authentication ?i.e., the user should use the link only by login not by typing in the URL. can anyone plz???[/QUOTE] When the user logs in, put the username in the session. Example: [CODE] String username = request.getParameter("username"); … | |
Re: That is an interesting question. Have tried this: [CODE] class R2<E> { E a; E get() { return a; } void set(E a) { this.a=a; } void print() { System.out.println(a.getClass()); } public static void main(String aa[]) { R2 nn1=new R2<Integer>(); nn1.print(); } } [/CODE] Can you tell us if it … | |
Re: [QUOTE=rohan_s;1424015]anyone please tell me how to find Krishnamurti number in java??[/QUOTE] Start a new thread and what is a Krishnamurti number? Do you know and you just want the java code? If not try searching the net for the definition of Krishnamurti number | |
Re: You posted the same exact question in a previous thread, which you got an answer. I don't know if it was the right one, but nevertheless, if you had problems you should have posted at the same thread. And [I]parry_kulk[/I], I believe that you also missed that in his jsp … | |
Re: Take a look at this: [CODE] <%my.print()%;> [/CODE] The quote is in the wrong place. The idea is that you write java code inside the <% .. %> Inside a JSP page: [CODE] <% int a = 0; a = my.print(); %> <!-- This is not java. It is displayed … | |
Re: What errors do you get? What is wrong? You give no information as what is not working | |
Re: Have you put the mysql-connector-java-5.0.8-bin.jar at the classpath ? | |
Re: [QUOTE=xxunknown321;1131984]The class should have as a field an ArrayList of T. Write a public method named add, which accepts a parameter of type T. When an argument is passed to the method, it is added to the ArrayList.[/QUOTE] Where in your code did you implement that requirement? | |
Re: You want that other "Button 4" to have a different functionality or simply change its label. For changing label use the set methods of the JButton class API. For changing the button, you can try to look at the API of JButton, if it has a setVisible method. You can … | |
Re: This is java: [CODE] if ( !("pass2").equals("pass2") ) { } [/CODE] Try to run that code and see what happens. The "pass2" string will always be equal to "pass2" string. You write: "pass2".equals("pass2") . Those are fixed values and it is always true. And the ! will always make it … | |
Re: There aren't any default databases. You can use whatever you want with jsp, depending on the application. | |
Re: You need to put the value attribute at the second option list of options like the first: [CODE] <select id="type" name="type"> <option>Please Choose</option> <option value="50">Single - 50£</option> <option value="60">Double - 60£</option> <option value="70">Luxury double - 70£</option> </select> [/CODE] Then submit the form to another page and take from the request … | |
Re: If you have that js variable, just display it using javascript. No java is involved. Assuming that you call a javascript function that calculates the resolution and you have that javascript variable calculated at the client. Then: [CODE] <script> function clacRes() { // when this function is called at client … | |
Re: The method str.charAt(i) that you are calling returns a char. Why don't you assign that call to a char variable and print that char. You can also call the toCharArray method: [CODE] String s = "1234"; char [] ch = s.toCharArray(); // Now print the elements of the ch array. … ![]() | |
Re: Read this post: [URL="http://www.daniweb.com/forums/thread327418.html"]http://www.daniweb.com/forums/thread327418.html[/URL] And it is against the rules to post your mail and ask for people to send you the code there. | |
Re: Can you be more specific in what way you will put them onto a website? Usually you something onto a website that has a GUI (Graphics user interface) How will the console application run on the net? | |
Re: [QUOTE=socheata;1396861]Can u tell me the formula or the key word that make me understand than this?[/QUOTE] You posted 4 questions. Where are you having problems? There is no keyword for all of them. About the 1st, don't you know how to initialize variables? Ask specific questions. Study and then tell … | |
Re: That would depend on the page. There is no way of doing, if you don't know the code of the page. If you want to login then the url mustn't be one of the main page but the page that it submits to with arguments the username and password. Although … | |
Re: Look at your Songs constructor. The error is there. Also besides the error, why do you call the toString method in the constructor? It doesn't do anything. | |
Re: Do you use in your code one of those methods: kb.nextInt() or kb.next() perhaps? The solution is very simple, but first let us know if the above is true and what other methods of the scanner class do you use. | |
Re: One small advice. You do this in a lot of places in your program: [CODE] ArrayList<Double> studentScores = new ArrayList<Double>(); studentScores = gradeBook.get(indexOfStudent); [/CODE] It is not necessary. What you actually do is create a new ArrayList<Double>. A new instance of ArrayList<Double> in memory. And then you never use it. … | |
Re: [QUOTE=bolzjohn;1395570]develop a program to accept a sentence then display the word in reverse form. take note that a sentence should start w/ a capital letters and ends w/ a period. Further , count the total number of words and total number A's - Z's and a's - z's implement using … | |
Re: The for loop should start at i=0. Print the all elements of the array. You call the dump twice with 2 different calls of the split method. Print the data of the array and then decide which split call suits you better [U]and[/U] which element of the array holds the … | |
Re: [QUOTE=kalpanakovuru;1395632]Hi Koushik, Below code is to set the session [B]//This code goes in server side (servlet).[/B] [code]HttpSession session = request.getSession(true); //create a session object session.setAttribute("key", "value"); [/code] [B]//This code goes in client side (jsp).[/B] [code]// this will return the value in session String value=(String) session.getAttribute("key"); [/code] After getting the session … | |
![]() | |
Re: [QUOTE=martin5211;1394060]Have you tried [ICODE]if(saw == "")[/ICODE]?[/QUOTE] [I]martin5211[/I] please, If you don't know what you are saying don't post wrong advices. Be sure about what you post and test it before you post it. Don't use ==. Never use ==. The problem is that if you don't enter anything at the … | |
Re: Delete everything you have written. Start by studying html, because your tags are wrong. Then put the "database" code in a separate method that returns a list with the values from the DB. Better create a class with attributes ID and NAME and return a list of that object. In … | |
Re: [QUOTE=rincethomas33;1394569]i want to create a menu. if i press the menuitem,then a certain action will occure.. and so on... give the details please...[/QUOTE] What you ask has been done so many times in this forum. Do some little searching. Also you should give it a try. It is not that … | |
Re: The error says: "non-static variable MainList" I assume that MainList is non static, so in order to access you need to have an instance of the class MainScreen | |
Re: Have you tried searching the net? Yahoo perhaps? | |
Re: That is because 23837472 is not a long it is an int. This is a long: 23837472L Try this: [CODE] long l = testApp(23837472L); [/CODE] When you use the 45638, that int number is turned into a long. The reason why you need to add the 'L' is because if … | |
Re: Of course you get null because the query doesn't return anything! Try to print the argument of the query or better yet the query itself: [CODE] System.out.println("SELECT * FROM student where sno='"+stname+"'"); [/CODE] You will also need to close the connection, the statement and the resultset before proceeding. I also … | |
Re: It seems that your problem is with reading from the database. That has nothing to do with gui. All you need is to read the data that you want and then use them in any way you want (pass it as parameter at the setText method). Search for tutorials and … | |
Re: I don't know if that is the problem or you simply forgot to post it, but you haven't closed the <a> tag. You didn't put the </a> [CODE] <td align=center> <a href="successLogs.jsp?strHour=<%=strDate+strHour%>&strcli=<%=strcli%>"> <%=totSuccCount%> </a> </td> [/CODE] And you don't need the <u> tags in order to have it underlined. Also … |
The End.