1,963 Posted Topics
Re: First of all in the CheckObject method you do this: [CODE] for(int i=0;i<object.length;i++){ if (object[i]!=null&&object[i].equals(object[i+1])) [/CODE] [B]i+1[/B] When you reach the last element of the array, meaning that i would be: object.length-1 you will call the object[i] . But then you will also call the object[i+1] which will give you … | |
Re: When you open a brace or a parenthesis close it immediately! Then write code inside it: Also you don't declare methods inside other methods. [B]main[/B] is a method: [ICODE]public static void main(String args[])[/ICODE] And you did this: [CODE] public static void main(String args[]) { public double getMPG() { MPG = … | |
Re: The rollback method throws an SQLException. It needs to be in a try-catch. You will put it where your logic dictates. | |
Re: Do you have any code? The assignment that you posted is actually an explanation of what you need to do: [I]"Data fields for your instrument should include number of strings, an array of string names representing string names (e.g. E,A,D,G), and boolean fields to determine if the instrument is tuned, … | |
Re: Can you post the code that you are having problem. You need to call the class ReadName - instantiate it. Can you post the code that you call and gives you the error | |
Re: The readLine() method that you use, in which class it belongs to? Because if you use the BuffereReader class, then when that method returns null it means that it has reached the end of the file. If the file's last line is for example: "aaa" Then when you call the … | |
Re: Which method are you using? There is the JTextArea.append and the JTextArea.setText. I believe you understand what they do. It is always best to check the API when you don't know why something doesn't work | |
Re: Let's assume that you use Scanner to read input: Scanner.readLine() I think is the method and you store it into a String variable. There is a method that turns the String into an int: [CODE] String s = "10"; int i = Integer.parseInt(s); [/CODE] The int i variable has the … | |
Re: That is correct assuming that the number of the lists will be fixed as well as their length. A more dynamic approach will be a little more complicated: Calculate first the number of possible combinations by getting their length and then have 1 for loop: [CODE] for (int i=0;i<12 /*number … | |
Re: You don't need the switch. And you cover only String with letters 'a' to 'z'. For a better approach: [CODE] String string2 = ""; char char1; for (int x = 0; x < input.length; x++){ char1 = input.charAt(x); int i = char1; string2 += i; } return string2; [/CODE] Also … | |
Re: Submit the page to a servlet or a jsp, take the value of the testbox from the request, call a method with the value as argument, that method should have code that inserts in the database, redirect to whatever page you want, or stay at the same jsp. | |
Re: Is this: tomcat/webapps/ROOT/WEB-INF/classes In the classpath? | |
Re: Can you post the jsp code. Also can you print in the jsp the elements of the list? | |
Re: Have you looked up, what is a Family Feud game ? | |
Re: So you are saying that the method kjennetegnErGyldig correctly returns false when you enter wrong data but when you enter the right data the loop doesn't go to the [ICODE]System.out.println("Ã…rsmodell: ");[/ICODE] call ? If yes then maybe the problem is with the kjennetegnErGyldig method. Try to add more prints at … | |
Re: What do you mean: "when we try to delete it" ? You have the .class file. That is what is executed | |
Re: Help for initializing Scanner: [CODE] Scanner keyBoard = new Scanner(System.in); [/CODE] The rest are up to you. | |
Re: Have you declared a constructor Car(int) ? When you get: "cannot find symbol" it is usually because you are using a method or class that doesn't exist. Meaning that you either haven't imported the class or you are calling the method/constructor with the wrong arguments or return type, or you … | |
Re: [QUOTE=DeadSoul;1235587]r u a nut chirag. have u ever used netbeans? i dont think so . you r totally wrong.[/QUOTE] No he is not wrong. He is absolutely right. You cannot run a java file. When you click the run button at the NetBeans (something that anybody can do), Netbeans creates … | |
Re: How do you redirect from the servlet to the jsp? | |
Re: Cross posted in this thread: [URL="http://www.daniweb.com/web-development/jsp/threads/75973"]http://www.daniweb.com/web-development/jsp/threads/75973[/URL] Do you have a question? The right way to do things: [URL="http://www.daniweb.com/web-development/jsp/threads/141776"]http://www.daniweb.com/web-development/jsp/threads/141776[/URL] The wrong way was just posted in this thread. | |
Re: Read the stack trace. It tells you exactly the error. It is very basic. For someone who writes jsp shouldn't have a problem in correcting it. | |
Re: [QUOTE=simply2smart;1648971]Hello again, static final String newline = System.getProperty("line.separator"); It does return null. How should I set the property now? Could you guide me a little bit more about it? Thanks everyone for the quick reponses[/QUOTE] The System.getProperty("line.separator") should return what you need. Why do you say it returns null. How … | |
Re: You can submit to the same page: file1.jsp and do the processing there. Take the data from the request. The first time you go to the page, the request will be empty so you can use that check. When you submit then you request will not by null: file1.jsp [CODE] … | |
Re: You have already written the code at your previous thread. Click the link that goes to the profile.jsp, call the method that gets the data and display them. Pass as argument to the method the username. When you login, put the username in the session and get it at that … | |
Re: Why do you call the updateQuery.next() inside the loop? You call it at the end of the loop and at the beginning. So you are missing a row each time you loop. Also you get that exception there because the array name is null. Delete what you have. Don't use … | |
Re: Simple way: When you change the select box use javascript to submit the form to the same page. When you do that take from the request the value of the select box. Remember the first time you load the page, there is nothing in the request, so if you try … | |
Re: Read the error message. It tells you exactly where the error is: org.apache.jasper.JasperException: Exception in JSP: [B]/index.jsp:15[/B] [U]File: index.jsp, line: 15[/U] Also: [B]java.lang.NullPointerException[/B] org.apache.struts.taglib.TagUtils.pageURL(TagUtils.java:1056) org.apache.struts.taglib.TagUtils.computeURLWithCharEncoding(TagUtils.java:448) org.apache.struts.taglib.TagUtils.computeURLWithCharEncoding(TagUtils.java:311) org.apache.struts.taglib.html.LinkTag.calculateURL(LinkTag.java:463) org.apache.struts.taglib.html.LinkTag.doStartTag(LinkTag.java:341) org.apache.jsp.index_jsp._jspx_meth_html_005flink_005f0(index_jsp.java:95) org.apache.jsp.index_jsp._jspService([B]index_jsp.java[/B]:67) At that line you probably try to use something which is null | |
Re: Do you have this: "com.ibm.db2.jcc.DB2Driver" in the classpath ? Or the jar that contains it? | |
Re: You need to post the whole stack trace. If you read it carefully you will find that it tells you which of your files has the error. | |
Re: [QUOTE=rasbihari sharm;1640929]hello,i m final year it student,i want a mini project on VB.Net so please help me.................[/QUOTE] Does this look like a VB.Net forum? You might want to try posting to the right forum and an administrator should close this thread. | |
Re: Use code tags when posting code. Click the button code and put your code inside. Then explain your problem. What errors do you get? | |
Re: You mean that this: [CODE] <% String link = ""; String user = (String)session.getAttribute("user"); if (user!=null) { link = user + ".jsp"; } else { // do something else since the user is not in the session } %> <a href = "<%=link%>" > some text </a> [/CODE] Is not … | |
Re: Probably because the variable jTextField1 is not static and the method where you put that code is static: This is wrong: [CODE] class A { private int a = 5; // non static variable private static void method() { System.out.println(a); } } [/CODE] The method is static, so you cannot … | |
Re: First, use code tags. Press the button CODE and put your code between the tags. Also I tried running your code and it didn't work, even though it is correct. It behaves very strange and the debug gives me strange behavior. Finally I found the problem. When you write (me) … | |
Re: What do you mean generic? Will the getSt be inherited from the subclasses? What do you mean: "so I can extend a single copy of this method" ? You don't extends methods. If getSt is only in the SuperClass then both A,B will have access to the same code. If … | |
Re: For columns, shouldn't you be doing: [CODE] for (int j = 0; j < N; j++){ sum += matrix[j][index]; } [/CODE] With N. When you enter values to the array you do: >> for (int i = 0; [B]i < N[/B]; i++) >> for (int j = 0; [B]j < … | |
Re: The '=' is used for assignments. The '==' is used for comparison: [CODE] if(Btn2.getSelected() == true){ } [/CODE] Or [U]better[/U] if the Btn2.getSelected() returns boolean: [CODE] if ( Btn2.getSelected() ){ } [/CODE] Edit: In your code you use Btn2.setSelected() . Perhaps you meant getSelected, because normally with set you pro-grammatically … | |
Re: You cannot run it because you haven't compiled it: Uncompilable source code - [B]cannot find symbol. symbol: class ResultsModel[/B] You need to import the ResultsModel or add to the classpath the jar that contains the ResultsModel, then compile and run | |
Re: Since you call the GetBookRecord in the jsp then this is the easy, but not so efficient way: In the jsp have an int variable let's say it counter. At first display the 1st record (counter=0) [ICODE]GetBookRecord.get(counter);[/ICODE] Have NEXT, BACK buttons and put the counter value in a hidden field. … | |
Re: The Person class seems ok. With the following corrections. You need to pass the name at the constructor as well. And you need to add get/set methods: Example: [CODE] public double getHeight() { return height; } [/CODE] This is wrong: Person.name You need to declare an instance of the Person … | |
Re: Assuming that you read the input: 11100000 as a String. You will create an int array with size the length of the input. Check the API of the String class. There are methods that return its length as well as each character of the String (charAt(index)) Loop the input, take … | |
Re: Are you sure that the values are updated to the table. Do you query it and see them updated? You cannot use javascript to run java code and update the table. Javascript has nothing to do with the java we run here. If the values are updated, reload the page. … | |
Re: [QUOTE=WishfulThinking;1626771]I am interested in a currency converter made from JAVA. I'm a beginner in learning JAVA programming language. I am thinking well I want the code to go out and get the current value of the US dollar and the current value of the EURO. Next I want it to … | |
Re: The declaration is wrong. There is no such thing as int void. It is either int or void. And in this case it should be int: [CODE] public int countTokens(String s) { StringTokenizer st= new StringTokenizer(); return st.countTokens(); } [/CODE] | |
Re: So you are saying that when you debug the messages: [U]Will read file[/U] , [U]Done reading file[/U] appear but when you run it, only the first one appears? I would suggest the following. More debug messages: [CODE] File file = new File("projects"); // print the file // print if the … | |
Re: You should better remove the initialization of BufferedWriter outside the loop. Why you need it in? Each time you create a new one, you close it then create again a new one? Put it outside the loop, in the loop call only the write method and close after the loop. … | |
Re: Can you post the code you have at the jsp page? | |
Re: When you get the exception, you also get a message that says where the error happened. Probably at the paint where you call the Integer.parseInt. If what you pass as parameter cannot be converted to an int you get the error. So make sure that inputxend.getText() and the others are … | |
Re: Can you post the logic beind the if? Maybe you meant to use the >= instead of the == |
The End.