1,963 Posted Topics

Member Avatar for solarmotion

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 …

Member Avatar for solarmotion
0
116
Member Avatar for crazybeaner

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 = …

Member Avatar for javaAddict
0
397
Member Avatar for newbie14

The rollback method throws an SQLException. It needs to be in a try-catch. You will put it where your logic dictates.

Member Avatar for newbie14
0
249
Member Avatar for moonknightt

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, …

Member Avatar for peter_budo
0
283
Member Avatar for london-G

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

Member Avatar for Taywin
0
154
Member Avatar for pradeep_java

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 …

Member Avatar for pradeep_java
0
589
Member Avatar for bokz06

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

Member Avatar for Ezzaral
0
690
Member Avatar for esy928

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 …

Member Avatar for abors
0
640
Member Avatar for blackrobe

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 …

Member Avatar for Mavericks
0
9K
Member Avatar for niamul

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 …

Member Avatar for jon.kiparsky
0
2K
Member Avatar for Raj619

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.

Member Avatar for anand01
0
99
Member Avatar for jigglypuff13
Member Avatar for javaAddict
0
380
Member Avatar for anand01
Member Avatar for anand01
0
288
Member Avatar for w0ot28
Member Avatar for java.util

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 …

Member Avatar for javaAddict
0
1K
Member Avatar for Jessurider

What do you mean: "when we try to delete it" ? You have the .class file. That is what is executed

Member Avatar for javaAddict
0
81
Member Avatar for jcooler

Help for initializing Scanner: [CODE] Scanner keyBoard = new Scanner(System.in); [/CODE] The rest are up to you.

Member Avatar for chiiqui
0
215
Member Avatar for TigerTeck

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 …

Member Avatar for NormR1
0
353
Member Avatar for Kamal_Java

[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 …

Member Avatar for peter_budo
0
256
Member Avatar for anand01
Member Avatar for dharma117

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.

Member Avatar for SagarSe7en
-2
333
Member Avatar for sabirsk

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.

Member Avatar for javaAddict
0
211
Member Avatar for simply2smart

[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 …

Member Avatar for javaAddict
0
200
Member Avatar for Hand

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] …

Member Avatar for Hand
0
707
Member Avatar for SagarSe7en

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 …

Member Avatar for SagarSe7en
0
6K
Member Avatar for bowmaster

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 …

Member Avatar for bowmaster
0
190
Member Avatar for jyo1988

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 …

Member Avatar for javaAddict
0
273
Member Avatar for jackisback13

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

Member Avatar for jackisback13
0
363
Member Avatar for debasree
Member Avatar for javaAddict
0
36
Member Avatar for manish250

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.

Member Avatar for javaAddict
0
229
Member Avatar for alpa shah

[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.

Member Avatar for Ezzaral
0
97
Member Avatar for authi

Use code tags when posting code. Click the button code and put your code inside. Then explain your problem. What errors do you get?

Member Avatar for JamesCherrill
0
4K
Member Avatar for luddite

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 …

Member Avatar for luddite
0
156
Member Avatar for aldeene

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 …

Member Avatar for Onlineshade
0
1K
Member Avatar for Ensanvoration

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) …

Member Avatar for Ensanvoration
0
153
Member Avatar for warlord902

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 …

Member Avatar for javaAddict
0
178
Member Avatar for janice91

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 < …

Member Avatar for javaAddict
0
128
Member Avatar for superjj

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 …

Member Avatar for superjj
0
116
Member Avatar for Fatima10

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

Member Avatar for javaAddict
0
162
Member Avatar for SagarSe7en

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. …

Member Avatar for SagarSe7en
0
3K
Member Avatar for janice91

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 …

Member Avatar for JeffGrigg
0
2K
Member Avatar for Nathan_11

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 …

Member Avatar for JeffGrigg
0
291
Member Avatar for raviaaaa

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. …

Member Avatar for javaAddict
0
307
Member Avatar for WishfulThinking

[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 …

Member Avatar for javaAddict
0
373
Member Avatar for sarathsshanker

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]

Member Avatar for stultuske
0
380
Member Avatar for carloskire

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 …

Member Avatar for carloskire
0
273
Member Avatar for asif49

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. …

Member Avatar for asif49
0
109
Member Avatar for raghujosh
Member Avatar for jex310

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 …

Member Avatar for Muralidharan.E
0
130
Member Avatar for rotten69

Can you post the logic beind the if? Maybe you meant to use the >= instead of the ==

Member Avatar for NormR1
0
193

The End.