1,963 Posted Topics

Member Avatar for pooran.c

You can have the action of the form be the same page. Like: [ICODE]<form action="" method="get">[/ICODE] The submit tag should be like this: [ICODE]<input type="submit" value="Send" name="submitTag" >[/ICODE] Then at the same page; you can write that code wherever you want: [CODE] String name = request.getParameter("name"); .... String submit = …

Member Avatar for javaAddict
0
179
Member Avatar for kalpanaSankhya

Try to print the stack trace in order to get a better understanding: [CODE] <% try{ java.net.URL url =config.getServletContext().getResource("/textfile.txt");BufferedReader buffreader =new BufferedReader(new InputStreamReader(url.openStream())); String strLine; while ((strLine = buffreader.readLine()) != null) { out.println(strLine); } }catch (Exception e){ e.printStackTrace(); // HERE System.err.println("Error: " + e.getMessage()); } %> [/CODE] You probably get …

Member Avatar for javaAddict
0
2K
Member Avatar for xiiopao
Member Avatar for nHulk

First of all: Delete the entire code. Never do that again. That code needs to be in a separate class. Create such a class and put the code that connects to the database and does whatever you want in a method and call that method. That method should return(true/false) whether …

Member Avatar for javaAddict
0
116
Member Avatar for cms271828

The NullPointerException could mean that something is null at that line. Can you try this small debug code: [CODE] <%@page import="bank.User"%> <%@page import="java.util.List"%> <%@page import="bank.BankHelper"%> <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>JSP Page</title> </head> <body> <h1>Hello World!</h1> <% BankHelper …

Member Avatar for javaAddict
0
137
Member Avatar for vishalbhavsar

When you login, put the user name into the session: [ICODE] session.setAttribute("USERNAME", <username_of_the_user>); [/ICODE] When you log out remove it: [ICODE] session.setAttribute("USERNAME", null); [/ICODE] And in every page take the USERNAME from the session and check if it's null. If it is then who ever went to that page hasn't …

Member Avatar for javaAddict
0
69
Member Avatar for computerwizard

Take the name as a String and then manipulate it. Shouldn't be that hard since you are already moved on to jsps.

Member Avatar for javaAddict
0
171
Member Avatar for sumprit

Post the line where you get the exception. If you read the stack trace you will find it. Also it is clear from the message what the problem is: [B]java.lang.ArrayIndexOutOfBoundsException: 1 >= 0[/B] You are trying to access an array (or some thing like that) with invalid index. Also this …

Member Avatar for javaAddict
0
158
Member Avatar for gman1991

Each if checks a different number. You should be checking only one variable which should be renamed to choice for easier reading and understanding the code. Just because you can name a variable: [ICODE]int shdnjbscsfdcmc = 1;[/ICODE] It doesn't mean you should because no one understands what it does. Read …

Member Avatar for gman1991
0
89
Member Avatar for Dannyo329

Did you enter an integer number? Usually when I got that exception with scanner it was because of that. Because I see this at what you posted: [B]Enter Employee Contact Number:456645[/B] Are you sure that is where you get the error. The exception tells you where you got that error: …

Member Avatar for Dannyo329
0
4K
Member Avatar for kandyhyatt

Example: [CODE] class Contact { private String name = null; public Contact() { } public Contact(String name) { setName(name); } public void setName(String name) { this.name = name; } public String getName() { return name; } } [/CODE] The name is private so no one can access it outside the …

Member Avatar for kandyhyatt
0
237
Member Avatar for pooran.c
Member Avatar for abhishek20
0
191
Member Avatar for gcclinux

The aList is java.io.File. When you do: [B]System.out.println(aList)[/B] What the compiler actually does is, it calls the toString method of the object you passed as argument to the println method. So: [B]System.out.println(aList.toString())[/B] So my question is. What do you want to save in your file? The file names? : ScanFiles.getFileList() …

Member Avatar for gcclinux
0
199
Member Avatar for sumprit

Loop the ArrayList. Then each element is also an ArrayList. So take each element of the first ArrayList and loop that to in an inner loop: [CODE] ArrayList<ArrayList> [B][COLOR="Red"]list[/COLOR][/B] loop [B][COLOR="Red"]list[/COLOR][/B] { take each array_list inside [B][COLOR="Red"]list[/COLOR][/B] loop that array_list { // do whatever } } [/CODE] But I don't …

Member Avatar for sumprit
0
191
Member Avatar for Jaydenn

Doesn't the JList already do what you want? Why do you need the tag? [CODE] MyObject myObject = (MyObject)jList.getSelectedElement(); [/CODE] Have you looked the API for JList, or examples? EDIT. Why don't you put "My Object" as a String attribute in the class MyObject and loop the JList and search …

Member Avatar for javaAddict
0
89
Member Avatar for rampapz
Member Avatar for sindhuravindran

[QUOTE=sindhuravindran;1455731]hi.. i want to develop a GUI for the Grid in my company.. so pls someone provide me with a code for job submission in grid.. job submission module includes submission of a job, status of job, cancelling and retrieving output of a job.. if not a complete code, atleas …

Member Avatar for Stefano Mtangoo
0
159
Member Avatar for Tackey

The exception must be in its own class - file. So you will have 3 files: MyDateException.java TestMyDate.java MyDate.java In the constructor of MyDate if the isValid method returns false, you will throw the exception. Apart from that you are ok. Although you will need to correct the logic in …

Member Avatar for Tackey
0
127
Member Avatar for heryirawan1

[CODE] String []irawan=new String [i]; [/CODE] The 'i' needs to be an integer. You initialize like this: String []irawan=new String [5]; Not like this: String []irawan=new String ["5"]; Also you loop the array like this: for(int k=0;k<[B]p.length[/B];k++) p is the array. Not like this: for(int k=0;k<[B]i.length[/B];k++ ) i is not …

Member Avatar for heryirawan1
0
228
Member Avatar for MoreHelp09

Can you post again the code using code tags? Just click the button (CODE) and put your code between the tags.

Member Avatar for dononelson
0
1K
Member Avatar for coervivekmca
Member Avatar for javaAddict
0
68
Member Avatar for ohgee

I don't remember the exact syntax for the auto-increment, but you can try this: Instead of having the auto-increment part in the insert query: ex: insert into table (id, ... ) values (NEXT_VAL, ... ) You can have a select that returns that auto-increment value: ex: select NEXT_VAL from dual …

Member Avatar for javaAddict
0
142
Member Avatar for rupadiyabipin

Read the error messages:[B] Only a type can be imported. org.apache.commons.fileupload.disk.DiskFileItemFactory resolves to a package[/B] Since DiskFileItemFactory is a package, you [U]know[/U] that it cannot be imported like that. Packages are imported like this: org.apache.commons.fileupload.disk.DiskFileItemFactory[B][COLOR="Green"].*[/COLOR][/B] Example: java.util[B][COLOR="Green"].*[/COLOR][/B] or java.util[B][COLOR="Green"].Date[/COLOR][/B] NOT: java.util

Member Avatar for javaAddict
0
586
Member Avatar for asif49

First of all phrase is the input file and phrase2 is the word you want to search. why do you compare them. Also never compare Strings with == or != . Use: equals: str1.equals(str2) Try running this code: [CODE] while (fileScan.hasNext()) { String line = fileScan.nextLine(); if (phrase2.equals(line)) { System.out.println("This …

Member Avatar for javaAddict
0
88
Member Avatar for fyezool

Read the error messages, go to the lines they say and try to correct them. Also do some studying. Most of the mistakes are because you failed to "copy" correctly the commands from your book or notes to the editor. Look again how the commands are syntax-ed. You should have …

Member Avatar for Sadun89
0
133
Member Avatar for jrosh

How many [B]columns[/B] does the query return? Try: [CODE] textAr.append(rs.getString(1)+"\n"); textAr.append(rs.getString(2)+"\n"); textAr.append(rs.getString(3)+"\n"); [/CODE] Or [CODE] ResultSet rs = stmt.executeQuery("Select col1, col2 from names"); ..... textAr.append(rs.getString("col1")+"\n"); textAr.append(rs.getString("col2")+"\n"); [/CODE]

Member Avatar for henadeera
0
313
Member Avatar for kukuruku
Member Avatar for mayursharma

session.setAttribute("[B]sessumobile[/B]", user1) session.getAttribute("[B]sesspassword[/B]")

Member Avatar for mayursharma
0
740
Member Avatar for churva_churva

First of all, the methods for smallest, largest are wrong. You initialize at both cases with zero. For example you set smallest=0, but what if the user enters only positive numbers, at the accept method?: [B]1[/B],2,3,4,5,.... Then the smallest 0 will always be smaller than all the elements of the …

Member Avatar for javaAddict
0
138
Member Avatar for coervivekmca

You can use the same code you use to get the file from the request in order to get the text. Can you use post some part the code that you use to take the file from the request? There are different libraries for that.

Member Avatar for javaAddict
0
70
Member Avatar for dreamer14

[QUOTE=erdhaval;1504912]i have this type of code like User:<select> <option>Faculty</option> <option>Student</option> </select> now what i want when i am selected Faculty option then page will be redirect to Faculty.jsp page is it possible in jsp ...plz reply me ...[/QUOTE] Start a new thread and read about onclick events: [CODE] <select onchange=""> …

Member Avatar for javaAddict
0
232
Member Avatar for sasi_88

What do you mean lost focus. All we see here is the same code posted twice. Do you submit at the same page? If yes then what happens is that the page reloads. You need to take the value of the radio button from the request and set the attribute …

Member Avatar for sasi_88
0
112
Member Avatar for Chrissie1185

Delete everything. Don't use the above code. (Html in servlets) Create a class with attributes the id, nme(name ?), twn(town ?), cny(country ?). Create a class that has a method that does the database operations and returns the data. Probably a list of the above class (id, nme, twn, cny) …

Member Avatar for javaAddict
0
145
Member Avatar for sneha mehta

As [I]masijade[/I] said the error has nothing to do with database. You call a method that throws an exception. Regardless if that method will ever throw that exception at Runtime or not, according to the declaration of that method you must catch the exception that it throws. The above has …

Member Avatar for masijade
0
148
Member Avatar for ajuv_001

Submit to the same page with the results, instead of going to a new page. Always display the search criteria and if there was any input in the request and there were results also display those. Assuming that you submit to a servlet, you take the results and send them …

Member Avatar for ajuv_001
0
118
Member Avatar for jonhunter89

Are you saying that your professor didn't teach you how to create forms (JFrame) ? How to click buttons (ActionListener) Or how to create your own classes? [CODE] class Book { String name; String author; .... } [/CODE]

Member Avatar for Taywin
0
141
Member Avatar for desert564

Actually, if I may suggest, the initialization should take place in the constructor. So when the user creates that object, the array would be initialized and not having to call any other methods. We usually initialize things in the constructor. Of course the method init_matrix could be private and be …

Member Avatar for javaAddict
0
135
Member Avatar for vijiraghs

First of post what errors you get. Specifically the exception. Don't use: System.out.println(e) , use e.printStackTrace. And show us the line where you get the error. Test that method in a main method first Also this is wrong: if(r == null) ResultSet is never null. Use: if (r.next()) { return …

Member Avatar for vijiraghs
0
722
Member Avatar for smslive2

You said that you wantd help, not someone to do your program from scratch. There are a lot of solutions fro this problem, so don't expect someone just to hand you the complete code. You need to show us how you want to implement it in order to point you …

Member Avatar for Taywin
0
413
Member Avatar for kaneyip

[QUOTE=JamesCherrill;1498417]You have two challenges - first to think through the logical process you need, second to translate that into Java code. You can't start the second until you've completed the first. So the best thing you can do is to set the PC aside, grab a pencil and pad of …

Member Avatar for JamesCherrill
0
112
Member Avatar for churva_churva
Re: JSP

Apparently he wants to add java scrip-lets. Like this: [CODE] <body> <select> <% for (int i=0;i<12;i++) { %> HTML CODE FOR MONTH OPTIONS. <% } %> </select> </body> [/CODE] Try to run the above and see what it prints. I would advise you to study a little bit more about …

Member Avatar for javaAddict
0
178
Member Avatar for jwenting

Actually I believe that you need to call the setLenient method of the SimpleDateFormat class. Check the API. I think that is something that needs to be added to the code.

Member Avatar for javaAddict
0
258
Member Avatar for bindhub

This assignment looks very familiar with this one: [URL="http://www.daniweb.com/software-development/java/threads/347028"]http://www.daniweb.com/software-development/java/threads/347028[/URL] Someone posted the same exact question. The answer that I gave, can be found there

Member Avatar for stultuske
-3
1K
Member Avatar for pramod lekkala

You can do that with javascript. Example, add an onchange event at the select tag. When you change something make the fields editable. Then take the values of those fields and check them if they are filled. You can use javascript to change the content of the select box. For …

Member Avatar for javaAddict
0
74
Member Avatar for Dean_Grobler

May be this time you can skip the servlet part and the RequestDispatcher. I don't know if it will work, but instead of submitting to the servet you can submit directly to he page you want, and put scriplets in the page. Assuming you submit directly to a page. Then …

Member Avatar for javaAddict
0
1K
Member Avatar for venkatnams

First of all, that is not proper way to write jsp. A minor error is that in a jsp you never do this: [ICODE]<% out.println(hav);%>[/ICODE] You do this: [ICODE]<%= hav %>[/ICODE] And for the rest of the code this is how you need to proceed: Create a separate class, called …

Member Avatar for javaAddict
0
174
Member Avatar for javaAddict

Hi, I recently decided to learn how to program and distribute applications for iPad. After some research I have some questions. I found similar threads in this forum but none where exactly what I wanted. 1) Do I have to buy a Mac to develop my iPad program? After reviewing …

Member Avatar for javaAddict
0
252
Member Avatar for Dean_Grobler

Actually, you never create pages nor write HTML code in servlets. You may be able to do that, but you don't. You use servlets for handing data, doing operation, reading from database and then you send the results to the jsp page. It is not a good idea to write …

Member Avatar for Dean_Grobler
0
290
Member Avatar for Sheena26

In the mean time you can you look at the java.lang.String API. There are methods you can use. I think there is one called "endsWith".

Member Avatar for peter_budo
0
613
Member Avatar for kubiak

Is this line 19: if(first.next == null) { //this line If yes then according to the exception you are trying to use something which is null. In this case I assume that it is the "first" I don't know your logic but, maybe you need this: if(first == null) { …

Member Avatar for javaAddict
0
312

The End.