Apparently nobody wants to tutor Computer Science these days.
Same situation here, can always consider teaching CS an option :D .
Apparently nobody wants to tutor Computer Science these days.
Same situation here, can always consider teaching CS an option :D .
Simple don't perform any authentication, since you want anyone and everyone to be able to access the page !!!
@stultuske
I think you misunderstood him, with the above question he wants to test our OOP skills :twisted:
Well you need to use the request
object in JSP to retrieve form data.
The request.getParameter("<element-name>")
, should get you the values of the respective elements in your form.
can any one send me this code? plzzzzzzzzzzzzzzzz send it ASAp
Yeah, sure the code is already available here
Do not connect to databases directly from within a JSP.
Please check out this tutorial for how exactly your web application code must be organized.
Plus another suggestion, all your code should be in one try block rather than multiple try / catch blocks. Cause in the current situation even though your driver loading ( Class.forName("...")
) may fail, your code would still try to proceed with making a database connection which is incorrect (similarly when it cant get a database connection, it would still proceed to try to get a Statement
from it using conn.createStatement();
which is also plain wrong.
Also from your code I can get a clear hint that you are new to JDBC so refer to this tutorial first and practice database connectivity in plain old Java and then jump to JSPs.
Are you sure you have used the combination of slf4j-api.jar+slf4j-simple.jar correctly ??
Well heres one I had come across a while ago : JeFTPd (Java Embeddable FTP Server).
I think it appears to be what you are looking for, but it is still in experimental stage.
You need to explain what you plan to do first, we cannot just blindly recommend one over the other without knowing what you plan to do with it.
And honestly speaking you need to learn how to ask questions in a forum.
Look at this site
This thread is more than a year old, most probably the thread starter has already solved this problem.
can anyone tell me how to make appear strings to appear in text box when i click a button.. i have multiple buttons on my form..
m doing a project in JSP..
i have tried using textarea but it is showing error.. is there any other alternative.?
with short examples will be more helpfull..
That query would belong to the Javascript forum (*I guess*), But you have to show us the relevant piece of code, So that we can point out where you are going wrong.
If you still would like to get some code samples I suggest you look at the Code Snippets section of Daniweb to see if you can find something useful or else google is your friend.
Sounds more like an School/College Assignment question . . . which almost every other book in Java answers, but you do not want to take the effort reading it.
This is ridiculous.
Creating a new thread just for ... the sake of creating it !!!
Took me little effort to stop short from giving you a RED.
First thing Amrita is DO NOT CONNECT DIRECTLY TO A DATABASE FROM A JSP.
It is a bad practice to do so. It looks like you are still just studying JSPs, so from the start itself learn how to correctly design you web applications by separating the processing logic and the User Interface. Check this thread by Peter for a good tutorial on how you should go about development is JSPs.
And one more thing please use code tags while posting code, look here for more information.
Note:-
A quick fix exists but I simply will not give it to you cause, you would then just implement the quick fix and skip the rest of the advice.
I tried your code by running it (with a few changes like extending JFrame instead of JPanel, adding a main to make it run as a stand alone), and it worked.
Its converting the temperature correctly when I click on the buttons also.
So whats the problem ????
Your button "output" doesn't work cause you haven't added an ActionListener for it like your JTextField
Also you have just one JButton object named "output" and you are first initializing here :-
output = new JButton ("Convert to Celsius: ");
and then overwriting it a few lines below here:-
output = new JButton ("Convert to Fahrenheit: ");
results_c = new JLabel (" ");
So sort out which initialization do you need.
You do one thing before craeting a war file you remove Source folder from src directory and let it have only complied classes
In this way when you will paste it in the webapps folder it wont be having SRC folder only classes will be there
Well about the desktop application you need to create GUI from swings or AWT then define events on buttons and you can just called functions used in your webapplicaton
Already masijade mentioned in his first post that even compiled java classes can be decompiled, So any point in mentioning this ????
You should also read replies of other posters (not to mention veterans like masijade) before simply increasing the post count ;)
Do not connect to a database directly from within a JSP Page.
Look at this thread for more information.
make reverse engineering diagrams of java code..like uml/sequence digs
I think Netbeans can do that, I have used it to generate class diagrams from code a few times.
explanation of the code
Sounds like you trying to copy someone else's work !!!
@complexcodes
Seems like you are confused in using CODE tags use [ CODE=java] and [ /CODE ] (without the spaces between CODE and brackets)to cover your java code.
This link should help you in getting NetBeans IDE sources and explain how to work with them.
A C Compiler would be an external application, so for invoking it you will need to use the Runtime class and process the output, Sorry had mixed it up with JNI when I posted at the start
Ever tried the getDate() method of ResultSet, It would give you a java.sql.Date object from the date in your MySQL table.
Extracting Month,Year and Day from it should be trivial then.
Well some of the conditions which could influence you use whether AWT or Swing are:-
Try creating a hidden field in your form with the name "tid" and assign it the value you wish it to hold and then set the action field of the form to only http://localhost/rentry.asp .
Do not perform database connectivity from a JSP directly.
Read this thread first and learn from it on how to organize you web applications, Then ask our help.
hi to all im new to this environmnt...i hav an error like this..in jsp..after connectin..it shows "no data found"...?(jsp with access)
Hijacking someone else's thread like this is considered rude, I see you have already started your own thread, have some patience and wait for replies there.
my professor would give us a program to write that doesn't use what we have already learned.
But the real question is why do you want to limit yourself to what you have already learned and not go a step ahead of the rest.
As far applications of regular expressions to your problem domain go, they are used to recognize patterns in a string.
eg [A-Za-z]
would match single occurrence of any letter in the english alphabet. similarly you can check for occurrences of digits and special characters.
OR you could forget all about them and Ezzaral's and my previous posts and use the normal but ... approach of parsing each character of the String of the text file contents using the charAt() function of the String class and perform each test for Digits/letters individually using the methods like isDigit() etc of the Character class
Do not connect to a database directly from within a JSP. JSPs are only for display purposes, your main business logic / database connectivity etc should be performed in Java code which you will include in your JSP and use as a API, So in case if in the future you have to switch from a JSP front end to maybe a Swing front end, you just have to redesign your interface, whereas the code which will be doing the important work of processing your data etc, can be reused without a problem.
Peter has made an excellent thread here on basics of how you should design your web applications, using the MVC architecture.
And you do not always need a DSN to connect to an Access database. But you should clear such concepts when you are working in core Java itself. If you are jumping to JSP without a firm foundation in Core Java, you are bound to spend more time in figuring out basics like this, rather than actually do some web development.
To connect to an MS Access database without a DSN use the following connection string:- jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=PATH_TO_MDB
My main issue is how to determine if the next character in the file is a string or integer or special symbol.
Thats exactly the reason why Ezzaral suggested using Regular Expressions.
If you would have simply googled for "Regular Expressions in Java" you would have found this excellent tutorial as your first search result (I say excellent cause even I got my Java Regex know how from there).
Well for that we need to know your skills , what are you good at, which domain are you looking for a project in etc... Also there are quite a few threads with similar topics, have you searched these forums and taken the look at them ?
Hmmm........ So you wish to extract the code of this applet and show of to others as your own.
I do not think any one will be too enthusiastic to help you on that !!!
Did you read this forum : http://www.daniweb.com/forums/forum72.html, you could check if anyone there wants someone on a per project basis like as an intern or something
Please search JSP forum section for the answer is definite there.
Hint, I made a specific post on the MVC that is listed often lately
Shameless self promotion :P
The place you start obviously is:-
http://tomcat.apache.org
And the first place to look for documentation is :-
http://tomcat.apache.org/tomcat-6.0-doc/index.html
Well I agree with ~sos~ as far as maintaining compatibility with legacy systems is concerned, but if we look at the current context, the thread starter I do not think is dealing with such critical systems and sounds more like a beginner to Java, so its got to be Ignorance :P.
<EDIT> @Peter Budo's post ... didn't see it, damn I should learn to refresh my pages more often :P
And yes I agree Small and Mid-Size firms prefer going for MySQL, an example is the firm which employs me has got 70% its critical data in MySQL DBs.
Eclipse IDE for Java Developers (85 MB) Vs Eclipse Classic 3.4.1 (151 MB)
Just wanted to know. Please advise.
They both are almost the same, Just the difference is that the "Eclipse IDE for Java Developers" as the name suggests comes with plugins for Java development only, whereas the Classic version may include some extra plugins.
For MS Access I think you do not have a choice but to use the JDBC-ODBC Bridge.
<EDIT> At least thats what I thought before I came across this page </EDIT>
Also if you would like to connect to your database with out creating a DSN by using the following connection string:-
"jdbc:odbc:Driver={MicroSoft Access Driver (*.mdb)};DBQ={PATH_TO_MDB_FILE}"
Just replace {PATH_TO_MDB_FILE} with the absolute path to your MS Access file.
By the way why are you using such an old version of the JDK ???
I do not really understand why people do not use free available MySQL Community Server
I can round up all the possible reasons from that in word "IGNORANCE".
Have you tried connecting to a database via a Normal Java program before jumping to Servlets ???
Added.......
retrieving values using the code on another jsp page.
thanks
From that anyone will assume the query was solved and one of the moderators might have marked it as solved.
Wrong forum, this is JAVA, If you would have cared to look there is a separate Javascript forum in the Web Development section.
Now as far as your problem goes, "+" is a concatenation operator (if the first operand is a String) in Javascript. So a+b
would concatenate the two.
Now if I am not wrong in JavaScript just like Java to display a + b
, you will need to do some thing like a + "+" + b
Which platform are you running this on ?
When I was running Eclipse 3.3 on Ubuntu 7.10, I remember encountering a similar error (for a Linux GCC toolchain based project), So I had to install the package build-essential (which includes GNU Make, GCC and other tools).
However I do not have much idea about about the first problem.
Well if the problem was solved then at least mention how it was solved, and mark the thread as solved so other people can use it.
Even previously I have noticed you just do not mention how a certain problem was solved, unless explicitly asked. Its not exactly fun to help such people.
Try checking out request.getParameterValues() method, It should fetch you all the values even if some of the input elements have the same name.
You **have not** pasted the code which is causing the problem or just displaying one record.
Right now I am just shooting in the dark here and assuming the problem lies in this piece of code, if it is inside the while loop :-
<input type="text" name="id" value="<%=id%>" size="4">
It is considered a bad practice to have multiple input elements (except radio buttons, check boxes) to be given the same name or ID.
Actually, I was able to solve this first one, but the one that is stumping me is the scores[]...
Is it similar?
Yep, its good to see you are learning :) .
names [index] = input.next();
The above code was valid when you were retrieving your data from the console, so now that should be changed as you are retrieving your value from the Input dialog box.
Its pretty simple you should actually have this:-
names [index] = JOptionPane.showInputDialog("Enter student's name: " +
(index + 1) + ": ");
If you would have indented your code even a little bit, I would have not forgotten the for (int index=0; index < names.length; index++)
loop at the beginning of your code.
Anyways This or this should help you get started on JOptionPanes.
Both links have almost the same content just the presentation is different.
Give a sample of what you want ??
We cant dream up things you know !!!
I checked out the link, and the code seems to do what you want.