1,963 Posted Topics
Re: From the screenshot, I assume that you took all the files form somewhere else and put them in eclipse? If that is the case, then I see that you took the .java files and the .class files and put them in same folder src/ I think, without knowing your settings, … | |
Re: You can do it with ajax, and you will also need to learn javascript. It is easier to use the jQuery library to make an ajax call. | |
Re: Where are the images located? Are they at same folder as the ButtonFrame class file is? | |
Re: Don't put everything in the main method and don't write everything at once. First create a Student class with attributes: name, hours, grade. Then have a single method: In that method read the file with the students and have the method return a list with the data. The List will … | |
Re: Delete the jsp. Remove the execution of the query from the jsp. | |
Re: Can you post the method and only the method that you use to read the rows from the database? | |
Re: [QUOTE=JamesCherrill;1602275]a user told me "x will never happen" and then it did, after I shipped the code[/QUOTE] Same here. | |
Re: Run the query (SELECT * FROM log) from a different method. Create a custom object, run the query, put the results inside the object and have that method return a list with the data. Call that method form the servlet. The servlet will have only that call. Once you get … | |
Re: [QUOTE=rufframa;1207605]I'm having the same problem. i have printed the SQL string and the syntax seems correct to me. Could the problem be located outside of Java maybe in the database driver?[/QUOTE] A new thread by you, with your code and the error merssage, would be helpful | |
Re: You don't need the commit command. It is done automatically, unless specified otherwise. Also try to print the query and what actually gets executed. Also the executeUpdate returns an int value. It shows how many rows have been updated/inserted. Try to print that too. Also your catch block is empty. … | |
Re: You don't need the selectCheckBox1,2,3. When the check box is clicked, it is checked automatically. Also there is no problem in having the name and id attributes having the same value. In some cases you need them to have different values but they can also have the same. Also what … | |
Re: Are you sure that this is exactly what the message has inside? "ORA-00001: unique constraint (WAJAHAT.INVOICE_UQ) violated" Try first to print the message like this for exmple: [CODE] System.out.println(">>"+e1.getMessage()+"<<"); [/CODE] Then you will know exactly what the message prints. An easier solution would also be: [CODE] if ( e1.getMessage().indexOf("WAJAHAT.INVOICE_UQ")!=-1 ) … | |
Re: The API is there for you to read it, not learn it by heart. As long you know how to call methods with the right number and type of arguments and put the return value inside the right type, you are ok. Of course that doesn't mean that for every … | |
Re: You can set all the attributes back to null yourself: [CODE] session.setAttribute("username", null); [/CODE] But I am sure that you have already thought of that. As far the invalidate method you can try and check the API. | |
Re: If I may add, I don't believe that the approach of using a try-catch for handling the length of the arguments is correct: [CODE] catch(Exception e) { System.out.println("There can only be four arguments entered for this program."); System.out.println("At the next prompt in this command line,"); System.out.println("enter 'java Test' followed by … | |
Re: I don't know if it is helpful but in case you don't know: Have you tried the to_date and to_char methods? They are sql oracle functions for converting dates to strings like the SimpleDateFormat in java. If the column is of type DATE, then it will store date, no matter … | |
Re: [QUOTE=ssaatt;1590975]i need jsp and servlet coding for login page where the username and password must b stored in a db table[/QUOTE] And I want vacation. Sorry I thought that this thread was for posting what we want but [U]you won't get[/U]! Seriously: This thread is very old. If you have … | |
Re: I don't believe that you need to put login.java. When you create a servlet it is defined in an xml file where the name of the servlet is set as well as the java class file. So there is a mapping between the servlet name and the class file. Netbeans … | |
Re: I tested your code and couldn't get it to work. The buttons weren't displayed. I would advise you not to use the paintComponent. It it used to paint graphics (circles, images, lines, ....) You don't need that method to add buttons and other components such as JLabels Try putting the … | |
Re: By using proper html. You align in the same way you would have aligned them if they weren't select tags. Do you use table tags? If yes then there is something wrong with your td,tr tags. Try to add the border="1" attribute at the <table> and see what is going … | |
Re: [QUOTE=masterjohji;1584703]that doesn't help at all , it works on my netbeans ide 7.0.[/QUOTE] Net beans is an IDE. It has nothing to do with the code. If the code is correct it should work no matter how you run it. Also if the code was given to you and you … | |
Re: Delete everything. Never put that code in a jsp. Have a class with a method that connects to the database, does whatever you want and returns the result. Call that method from the jsp. | |
Re: In the same way you studied and wrote all that code, you can do the same and create a gui. Surely, you shouldn't have a problem if you managed to study and write all that code, to program a gui. Look at your notes, create the gui and call the … ![]() | |
Re: Do you have any knowledge of java? Or any other programming language? The switch is the classic switch statement that you will find in any language. You will need to use scriplets. Try to find and read a book about jsps. If you are unfamiliar with java then you shouldn't … | |
Re: Maybe the admins should move the post to the "sticky" thread at the top of this forum with all the other resources about java. | |
Re: Hi, your question has already been answered in this forum. I had the same problem with you, but later I found the answer and posted it. Take a look at this thread: [URL="http://www.daniweb.com/web-development/jsp/threads/159630"]http://www.daniweb.com/web-development/jsp/threads/159630[/URL] It has my question, similar to yours, as well as the answer. One way would be to … | |
Re: 1 class -> 2 methods. 1 method that inserts 1 method that reads. Call those methods from the jsp. Create a class that saves the data as attributes. The rest of the code is wrong. The java is executed at the server. The javascript at the client. So when you … | |
![]() | Re: If you take a closer look at the code: [CODE] for(i=0;i<size;i++) { String temp=jComboBox1.getItemAt(i).toString(); if(temp.equals(tbl_pname)) { flag=1; break; } } if(flag==0) jComboBox1.addItem(tbl_pname); [/CODE] No wonder it takes that long. You run the query and then inside the while loop you have another for loop. In other words, you use java … ![]() |
Re: First of all, explain better your problem. What do you mean ? [I]an illegal charater(inside red) - other than what is provided now[/I] Also the code you posted makes no sense. How is it connected with what you ask. Not to mention that this is how it should be written: … | |
Re: Don't give wrong advices, just so you can make a post and display your mail. | |
Re: First of it makes a lot of difference how you reload the initial page. If you have a link that goes from the action page to the search page, you can send the parameters back to the search page. How do you "loaded" from the action page. What do you … | |
Re: [QUOTE=forhacksf;1560731]I found this looking for something and... dispose(); works well if you want to close one window, not all.[/QUOTE] The thread that you posted, is from 2004. Do you know that it is against the rules to revive dead threads? | |
Re: What actions do you take when you log in? How do you know the user is logged in? Also you can check the API for the session class. There is an invalidate method, I think, But answer first what I have asked and we'll see what needs to be done. | |
Re: You are using something that is not declared or doesn't exists or is not visible from where you are trying to use it | |
Re: If you are using the window.open javascript function, then look at its API. There are parameters where you can set what you want: [URL="http://www.w3schools.com/jsref/met_win_open.asp"]http://www.w3schools.com/jsref/met_win_open.asp[/URL] | |
Re: You don't say what is your problem. The code seems ok. Does it compile? Does it run? Does it give correct results? What are those logical issues? | |
Re: Read the error messages that you get. The method "findBiggest" returns a Rectangle. So why do you assign it to an array when you call it. Also you cannot use: '>' with objects: [ICODE]if(rects[i] > biggestSoFar)[/ICODE] If you want to compare them based on their area, then call the getArea() … | |
Re: Well the general idea would be to write 2 methods. One that saves the text file and the other saves the path. Those need to be independent with each other and with the rest of the program. That means: Write one method that takes as argument the text and the … | |
Re: Submit to the same page and add the code of the second page to the first. When the first page loads for the 1st time, the request is empty, it has [B][U]null[/U][/B], inside. So you can use that in order to decide what to display. Even if you submit the … | |
Re: Have you looked at the API. Check if there is a method to get the selected value of the JList. [URL="http://download.oracle.com/javase/1.4.2/docs/api/javax/swing/JList.html"]http://download.oracle.com/javase/1.4.2/docs/api/javax/swing/JList.html[/URL] | |
Re: Read the error messages that you get. They tell you exactly what the problem is: cannot find symbol symbol : variable count The program cannot find the count variable. Have you defined it? Is it visible? Also when you do: DVDcollection[index] , the DVDcollection needs to be an array. The … | |
Re: Go at the line where the error tells you. You are using something there which is null. Something you haven't initialized. Also you cannot read a file if you don't know that it has enough lines in it. [CODE] String line = in.readLine(); while (line!=null) { System.out.println("Line read: "+line); // … | |
Re: You can start by explaining what a a restuarant bill calculator is? After you explain it, start converting that explanation into java classes, and the calculations needed into methods. | |
Re: If you have used javascript and jquery before while developing web pages then you can put it, why not? You can never be sure how expert you are because there is always someone better, but if you are familiar with you can add it. | |
Re: What errors do you get and where are you having problems. The code seems ok. Which part of your assignment doesn't work. What test cases have you tried? | |
Re: I didn't understand much from your question, but if you have read the data from the database, and you want to have a link, and put some data to the url of that link then: [CODE] <% String someValue=""; %> <a href="page.jsp?paramName1=<%=someValue%>¶mName2=....¶mName3=...." >Display Text</a> [/CODE] And at page.jsp: [CODE] String … | |
Re: Usually when you have a check box and you submitted, then if it was not checked the request.getParameter("paramName") will return null, Otherwise it will return a not null value. Assuming that you have those check boxes in a for loop with index 'i', you can have the check box be … | |
Re: Why use StringBuffer and simply display at the hmtl the code: [CODE] <%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %> <%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %> <%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %> <html> <head> </head> <body> <font size="+1" color="#55BBEA">Not a member yet? Register here. It is FREE. </font><br> <html:form action="/register"> <table> <tr> <td align="left"> <bean:message … | |
Re: [QUOTE=coolbeanbob;1549416]Are you saying strRead is null for the first line of the text file? I don't think that is the case, but I will try to verify that.[/QUOTE] [ICODE]students[p].parse(line1); //<==Null Pointer??[/ICODE] I believe that [I]Majestics[/I] is right. You initialize the students array, but the elements of the array are null. … | |
Re: [QUOTE=adil24;1546965][code] <td colspan="3"><input name="text4" id="vid" type="text"/></td> <td colspan="1"> <select name="combo1" onchange="document.getElementById('vid').value=this.option[this.selectedIndex].text"> <option>Select One</option> <% stmt=con.prepareStatement("Select id from student order by id"); ResultSet rst=stmt.executeQuery(); while(rst.next()) { %> <option><%=rst.getString("id")%></option> <% } } catch (Exception e) { System.out.println("error in program:-"+e); } %> </select></td> [/code] hope it might work for u..[/QUOTE] That code is … |
The End.