1,963 Posted Topics

Member Avatar for feoperro

You cannot combine java and javascript that way. They are NOT the same: [CODE] document.getElementbyName('myCombo').selectedValue = '<%= session.getAttribute("choice") %>'; [/CODE] I see from your previous thread that you lack of lot basic knowledge about jsp and submitting requests. I would suggest to take sometime to learn the basics, study a …

Member Avatar for jerin francis
0
1K
Member Avatar for gabz16

[QUOTE=gabz16;1290452]yes..or maybe someone who knows the codes for this program[/QUOTE] No one is going to give you the code unless you show some code of your own; more specifically, what have you done so far?

Member Avatar for JamesCherrill
0
2K
Member Avatar for collinsislee

Have a counter in each of those methods. When you print something increase it by one. When it reaches 5 or 9, call the [ICODE]System.out.println();[/ICODE] and set it to 0. [CODE] int count = 0; for (loop) { System.out.print("something "); count++; if (count==5) { count=0; System.out.println(); } } [/CODE]

Member Avatar for JamesCherrill
0
367
Member Avatar for rahman86

Does the Student table actually exists? Have you trying running the query to an sql client? Do you need to set the username, password. Is the host correct? What driver are you using? Have you set that driver to the classpath? Try to find examples on how to connect to …

Member Avatar for bloggernewbie
0
3K
Member Avatar for rpjanaka

Don't use GOTO in jsps. Start a new thread where you explain what you are trying to achieve

Member Avatar for Ice515
0
2K
Member Avatar for VernonDozier

[icode]if (cp.bi == null)[/icode] What if cp is null ? Try to print everything before you run anything: [code] File saveFile = new File("SemiTransparentSquare.gif"); System.out.println("saveFile: "+saveFile); if (saveFile == null) System.out.println ("saveFile is null"); System.out.println("cp: "+cp); System.out.println("cp.bi: "+cp.bi); if (cp.bi == null) System.out.println ("cp.bi is null"); ImageIO.write(cp.bi, "gif", saveFile); [/code]

Member Avatar for JamesCherrill
0
2K
Member Avatar for joe_ojah

That is not a good example and it is a bad way to do things. Not to mention that the OP said nothing about html code. Only the database connectivity is almost ok. You forgot to close the ResultSet, Statement and ResultSet. First: How do you know that the table …

Member Avatar for ali.nazia999
0
2K
Member Avatar for apanimesh061

You also need to post the exception that you get. Did you put in the classpath the my-sql-connector.jar ?

Member Avatar for ghul-mur
1
344
Member Avatar for cwpent

[QUOTE=cwpent;1223018]anyone?[/QUOTE] Where you the one who wrote the Farm class? I need to know this because, I need to understand what was given to you initially. Also you could do this: [CODE] myFarm.add(new NamedCow("Elsie")); [/CODE]

Member Avatar for joankim
0
1K
Member Avatar for Sonny101

As the error message says, you have a syntax error at your query. You must first write your queries in an sql editor, run it with some values and then take it and put it into your code. In your case it seems that you forgot a comma: "UPDATE empDetail …

Member Avatar for aloncito
0
554
Member Avatar for japeeps

You can filter the results at your query by adding a WHERE. Look for some tutorials on how to write sql statements with WHERE: select * from emp_details WHERE fname='[I]something[/I]' Then at the jsp page that submits to the ifsServlet you can pass the name or whatever you want as …

Member Avatar for javaAddict
0
401
Member Avatar for mj_sexy14344

[QUOTE=rinoel;1063885]According to the output you wanted, I made something very simple, I don't know if that's what you wanted... [CODE]import java.util.Scanner; public class quiz { public static void main(String []arg) { Scanner input = new Scanner(System.in); int x, y, z; System.out.print("Enter your name: "); String name = input.next(); System.out.print("How many …

Member Avatar for stultuske
-2
348
Member Avatar for artemis_f

For reading lines from a file: [CODE] BufferedReader br=null; try { br = new BufferedReader( new FileReader( fileName ) ); String line = br.readLine(); while (line!=null) { //do something with line //you read each line of the file, You don't know how many lines the file will have //the last …

Member Avatar for stultuske
0
1K
Member Avatar for turpentyne

There is the : document.getElementsByTagName(tagname) from: [url]http://www.w3schools.com/jsref/met_doc_getelementsbytagname.asp[/url] I don't know that mehod, but probably returns all the elements of a specific tag type: document.getElementsByTagName("select") You can loop those and check for each one of those their selectedIndex. For the API of the select element refer to the link I provided …

Member Avatar for javaAddict
0
823
Member Avatar for Goldfinch

Try to add some System.out.println in the readFile method and see what happens. Also you need to declare the list as a private member of the class like filePath. With your way, you create it in the method readFile and then after it executes, you have lost it, you cannot …

Member Avatar for Goldfinch
0
966
Member Avatar for oonebaddog

Create a method in a class that executes the select query and retrieves the data. Save those data in an ArrayList. In your jsp call that method and with a combination of html and java (scriplet) populate the drop down box JSP: [CODE] <% ArrayList list = yourClass.getData(); int size …

Member Avatar for oonebaddog
0
1K
Member Avatar for TIM_M_91

[QUOTE=poojavb;1757567]Check if the connection is created to the database [CODE] Connection con; Statement stmt=con.createStatement(); ResultSet rs=null; String ss=("SELECT VIDEOID, VIDEONAME, DIRECTOR FROM VIDEOS"); rs=stmt.executeQuery(ss); while(rs.next()) { //code goes here } [/CODE][/QUOTE] That is not what [I]TIM_M_91[/I] has asked. @TIM_M_91: It is odd that you haven't found the correct syntax because …

Member Avatar for javaAddict
0
119
Member Avatar for hajjo

Then why don't you look at this link: [URL="http://www.daniweb.com/forums/thread141776.html"]JSP database connectivity according to Model View Controller (MVC) Model 2[/URL] It is at the top of the Jsp forum.

Member Avatar for javaAddict
0
335
Member Avatar for nore

[QUOTE=nore;1754302]i've got the answer, i hope it would be useful :) Set the varaible into the session in Page1.jsp and access the same in Page2.jsp. In Page1.jsp session.setAttribute("X", "value"); In Page2.jsp String x = session.getAttribute("X");[/QUOTE] Unfortunately that is the [U]wrong[/U] way to pass the value. You should never use session …

Member Avatar for javaAddict
0
244
Member Avatar for iamcreasy

You can load the servlet directly. Instead of writing at the url: [url]http://localhost:port/index.jsp[/url] you can write: [url]http://localhost:port/YourServlet[/url]

Member Avatar for nore
0
206
Member Avatar for long89

[QUOTE=rushikesh jadha;1752767]you can catch array index out of bound exception.[/QUOTE] Never use try-catch for ArrayIndexOutOfBoundsException. You already know at runtime the size or length of what you are trying to use. So always check that. long89: So when looping, it is good to do this instead of what you have: …

Member Avatar for rushikesh jadha
0
429
Member Avatar for toferdagofer

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at TheatreRevenue$CalcButtonListener.actionPerformed(TheatreRevenue.java:99) At that line and file: TheatreRevenue.java:99 you are using something which is null. Go to tha line and see what is null and make sure it is initialized. Also the code tags you are using should end with

Member Avatar for DavidKroukamp
0
1K
Member Avatar for grendel0

[QUOTE=grendel0;1750016]I split the connections and discovered I hadn't even declared stm2 as a prepared statement, rather a redular statement! This fixed the error, I have to agree with you about the amount of code on my JSPs, I'll look at changing the logic to servlets, though my lecturer insisted on …

Member Avatar for javaAddict
0
5K
Member Avatar for javaAddict

Hello everybody, My question is simple. I wish to develop a web site and I have been looking for web hosts and most offer MySql. At my job we use oracle, but after some searching I haven't found any great differences between them and any real reasons why I should …

Member Avatar for javaAddict
0
270
Member Avatar for autorunman22

You don't have to put all those ifs in the index jsp because what you are trying to do should be divided into 2 jsps. Assuming that your first jsp is called: login.jsp. There you don't have to check if the user is logged in. All you have to do …

Member Avatar for autorunman22
0
274
Member Avatar for HelloMe

What is the service pack of your windows and can you post the link you used for downloading?

Member Avatar for aliartos
0
722
Member Avatar for Litcandle

To [I]sumitlole[/I]. NO, it is not the easiest way, it is the wrong way. This thread is 2.5 years old. What do you think you can accomplish. In your code you have this: [CODE] System.out.println("Wrong Number Enter again"); if(s.charAt(0)==s.charAt(4) && s.charAt(1)==s.charAt(3)) [/CODE] You print the message "try again" but then …

Member Avatar for stultuske
0
412
Member Avatar for jcarbillon

It is not a function and on its own it means nothing. The only thing similar to this, is when I set the data option when making an ajax call with jQuery. [URL="http://malsup.com/jquery/form/"]http://malsup.com/jquery/form/[/URL]

Member Avatar for jcarbillon
0
102
Member Avatar for chandub

The inputs with type="file" work differently. You may be able to take the request.getParameter("importExtruderFile") but you cannot use that path to create a file and read it. I don't remember it exactly but if you search the net you will find what methods to use. Take a look at this …

Member Avatar for javaAddict
0
139
Member Avatar for rushi3311

It depends on where you put your image and how you deployed your web application and what server do you use. If you simply used NetBeans to create the .war file or just run your application then the image is not beeing read from where you think it is. In …

Member Avatar for rushi3311
0
370
Member Avatar for freakybeavis

I am sorry to tell you this, but if you are a beginer with java why do you write jsps? The code that you wrote has several errors, but not because of your lack of effort. Because there some things that you have confused and you need some studying to …

Member Avatar for javaAddict
0
161
Member Avatar for dhija22

Have you tried installing eclipse? Java is not an application. What I did was download java, install it, and installed an IDE (eclipse in your case) of my choice. When I run the IDE it asked me to enter the location of the java that I installed.

Member Avatar for dmanw100
0
166
Member Avatar for slasherpunk

Is the url correct: jdbc:mysql://localhost/test ? Maybe you are missing the port: jdbc:mysql://localhost:<port>/test As the exception says: Cannot connect to MySQL server on [B]localhost:3306[/B]. Is there a MySQL server running on the machine/port you are trying to connect to? Try to read first the exceptions that you get. They provide …

Member Avatar for slasherpunk
0
15K
Member Avatar for onosan

First of all remove all of the database code and put it in seperate methods and classes and call those methods from the jsp. Then read the exception that you get. It tells you exactly what the error is at line 66 The NumberFormatException is thrown when you cannot convert …

Member Avatar for javaAddict
0
1K
Member Avatar for ab_omid

You don't only get a NullPointerException. You also get a stack trace. Have you tried reading it? It tells you where the error is and what is the problem. You can try posting it, since it is unlikely someone will read AND compile your entire code in order to find …

Member Avatar for ab_omid
0
293
Member Avatar for mrabrar09

First of all check your query. Always print it before you run it and see what is going on. In this case you have this: [ICODE]"select *from student where no=' " +num+" ' ";[/ICODE] Can you see the blank spaces where you have the quotes. Also you need a space …

Member Avatar for javaAddict
0
331
Member Avatar for wallet123

Can you post some more code? Also you can look at the: [URL="http://docs.oracle.com/javase/1.4.2/docs/api/javax/swing/JOptionPane.html"]http://docs.oracle.com/javase/1.4.2/docs/api/javax/swing/JOptionPane.html[/URL]

Member Avatar for hfx642
0
154
Member Avatar for Narayanan87
Member Avatar for Traicey

If you have never done java then why should you get that position? And if you are looking for the entire code we are not going to help you. Besides we don't know if it swing or jsp, or if you want to use javascript to do the validation at …

Member Avatar for stultuske
0
166
Member Avatar for bzmommy

The descriptions are very clear. Just create separate classes for each part. For the account part just create the Account class. In the main call those constructors to create what is asked. You will need a menu for that. If you must have One account per Customer then you may …

Member Avatar for fausto1234
0
186
Member Avatar for javaAddict

Hello everybody. I have a question/problem. I have a select tag with several options. Sometimes the text of the option becomes very large. So I tried something like this for example: [CODE] <select> <option>A Very Big <br/> sentence</option> </select> [/CODE] But it didn't work. What I was trying is to …

Member Avatar for javaAddict
0
107
Member Avatar for Aardwolf

You will need pure javascript, not java. Have a button. when the button clicks, execute a function that takes the value of the text field. If the values is "username" make it empty: (value="") Check out the tutorials form the [URL="http://w3schools.com/"]W3Schools[/URL] site about javascript

Member Avatar for Aardwolf
0
402
Member Avatar for anitha19
Member Avatar for tqmd1

Use : [URL="http://download.oracle.com/javase/1.4.2/docs/api/java/text/SimpleDateFormat.html"]java.text.SimpleDateFormat[/URL] [CODE] Date now = new Date(); SimpleDateFormat sdf = new SimpleDateFormat("EEEE, MMMM dd, yyyy"); String s = sdf.format(now); System.out.println(s); [/CODE] Try to experiment by changing the number of 'E's and 'M' Check this example: [CODE] Date now = new Date(); SimpleDateFormat sdf = new SimpleDateFormat("EEE, MMM dd, …

Member Avatar for javaAddict
0
85
Member Avatar for pote86

The encryption takes place in the servlet not when you submit the page. You pass the password the user entered from the gui, so the password at the url is unencrypted. It goes to the servlet where you do the encryption. There is no way to avoid that. (Actually there …

Member Avatar for pote86
0
2K
Member Avatar for javaAddict

This is not much of a question, but a discussion and searching for opinions. I have seen that many use the Scanner class for getting input from the keyboard. Some, like myself, use the BufferedReader. Why will someone use one over the other? Or they both do the same thing …

Member Avatar for StephNicolaou
0
551
Member Avatar for glamourhits

The pop method of the Stack class is not complete. Maybe you have fixed it already, but you need to check if the stack is empty before removing the top element.

Member Avatar for Taywin
0
589
Member Avatar for fausto1234

When you divide an int with an int you get an int: 12/100 = 0 12.0/100.0 = 0.12 [CODE] double percentageH = (1.0*frequencyHeads/totalTosses); double percentageT = (1.0*frequencyTails/totalTosses); [/CODE] You multiply by 1.0 which is a double, so 1.0*frequencyHeads is also now double and 1.0*frequencyHeads/totalTosses is also now double And you …

Member Avatar for fausto1234
0
159
Member Avatar for AQWst

[QUOTE=gap_89;1043565]hey can u help me by dis problem write down an application to display a window with various GUI components available in the awt packages[/QUOTE] You revived an old thread, when the best advice would be to use the javax.swing package.

Member Avatar for stultuske
0
421
Member Avatar for vijaykavin10

You don't call the actionperformed. It is automatically called whenever you click a button. You implement it normally in the same way you do when you use javax.swing. Your applet should implement the ActionListener interface, then you will declare the actionPerformed method and write code inside it. Then you will …

Member Avatar for mKorbel
0
149

The End.