I want to create a online examination system.i want to know to how to get questions 1 by 1 on the same jsp page and on clicking the submit button the result should be saved in database.
I am trying to create an empty array that has no assigned length as the amount of elements it needs to hold will be dependent on another value. I then want to use a while loop to assign values to it. Here is an example of what im looking for it doesnt work. Iam trying to do:
int x = 12; int i = 1; int k = 0; int[] factors = {} while (i<x) { if (x%i==0) { factors[k] = i; k++; i++;
I have done 90% of the coding however i am stuck with producing the output, i just cant get the user fields to show.
I have attached a picture of the output that is required. The program consists of two classes i have attached the database class, and have inserted my coding below.
import java.sql.*; import java.io.*; import java.util.*; public class QueryDB { private Connection con = null; String userID,
I have to get my output to show as per the image attached i am very close but not there yet. I have also attached the database where i extract my information from
/* Program Name: QueryDBDB.java Purpose: to build an initial database for the stocktrakcer application */
import java.sql.*; import java.io.*; import java.util.*; public class QueryDB { private Connection con = null; String userID,firstName,lastName,name,symbol; public QueryDB() throws Exception
ResultSet rs = result.executeQuery(selectsql); int columns = rs.getRow(); while(rs.next()){
[Code].....
I can print out the result correctly, there are three rows of result from the database, but they are shown in one row on the browser, how could i show the result one row after another to let it looks pretty?
I am trying display the result set from the database.I am getting the following exception :
Caused by: javax.servlet.jsp.JspTagException: Don't know how to iterate over supplied "items" in <forEach> at org.apache.taglibs.standard.tag.common.core.ForEachSupport.toForEachIterator(ForEachSupport.java:286)
My Jsp code :
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <!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=ISO-8859-1">
I am learning how to program in JAVA servlet+MySQL. Decided to make a simple program where it shows who is celebrating birthday today by retrieving data from database. At the moment I managed to get it working by loading a form.html and pressing the button in it which gets to the result.jsp and shows results there.
My plan was to get a list of people who are celebrating there birthdays initially when the website is loaded/being loaded, I mean when you enter URL into your web browser and you get it instantly in browser. Is there a way to do it the way I want (JAVA+servlet+MySQL) instead of pressing a button/link?
My query retrieves more than 5000 records from Oracle database. I want to display the records 100 per page. I know it is called pagination. Any detailed styp-by-guide or tutorial or example available?
public void actionPerformed(ActionEvent ae){ float A=0; int a = Integer.parseInt(tf1.getText()); if(ae.getSource()==b2) { A=(((30*a*14) / 100)+(30*a));
We are currently trying to use the "confirm" button on our GUI as a fully functioning feature that saves the data input into a database. Here is the code for the GUI we have created...
We are trying to save some details of users for a database.
I've attached our work in zipped folder as i couldn't upload a thread with some many "URLs" .....
I have jFrame where I have to display data from database on button click. There are 4 buttons, first to display the first record in database, last to display the last record in database, next to display the next record and previous to display the previous record. I have done first and last record but what should I do to display the next and previous record.
I am developing my first Java application and the database I use is MySQL. I have created two separate buttons; one to insert new data into my database and the other to update the database when changes are made.
Each button is working perfectly, but I now want to combine both functions into just the save button. Thus, whether I am entering new data or modifying existing data, the save button should use an IF ELSE condition to decide whether to use the INSERT or UPDATE command.
My problem is, how do I write this IF ELSE statement? What should be the condition? For example;
IF(what? ){ String sql ="Insert into Table1 (classID,className,counselorID,startDate,endDate) values (?,?,?,?,?)"; }ELSE{ String sql2 = "update Table1 set classID = '"+value1+"',className='"+value2+"',counselorID='"+value3+"',startDate='"+value4+"',endDate='"+value5+"' where classID = '"+value1+"'"; }
I am trying out jsp and servlets now for the first time. I have to insert two data, car code and car name into a mysql table. I got those details using jsp but if I use form, it redirects to another page for insertion. I want the data to be inserted and still remain in same jsp page. I am thinking of using onClick from javascript but as I googled this many places have said it is a bad idea to use jsp inside javascript. If so how can we insert data to mysql table without redirecting to another page?
How can I get id from db table for each column values with java or oracle query? I did get before each column content from file and now i need get the id of this column values from db. I read csv files from folder and then load the data from these files into subfolder, and here with line li = line.split(","); I get the values that i have in csv file and split them and become in li the value name, and then in else block i create a P objekt where i set this values from csv files, and with [I]p.setLid(li); I set the value for all valuenames, and then get these valuenames in separate column with other content from this csv.
My question is, i need to do this with db, and write these csv file values to the table in db (it will be done with another java class), what i need, that to write the ids of these values into the table in db, instead of valuename, and while there is no ids for valuenames in csv files, i need to get the id from the table in db where these are already listed with sequences, and i don't know how can i write in data table the id of this valuenames and other content, this data table should contain the ids of valuenames timestamp values and the ids of the csv files name, i don't know how to do this with the ids, i must get the ids from the db table and then set these on [I]p.setLid(li); where i set early the valuenames, instead of valuenames i should set ids, that will set ids automatically for all these valuenames.
Java Code:
try { while ((line = br.readLine()) != null) { if (lc == 0) { li = line.split(",");
[Code] ....
with
Java Code : li = line.split(","); mh_sh_highlight_all('java');
I got the values that then will be given to [I]p.setLid(li); and iterate, but now i want to get id from the table in db where this values stored with id instead of this column values, how can i do it?
I have a button in which I need to do the following:
After I click it It reads the values given in a jtextfield1 and in the other jtextfields I need it to settext in them from the database I mean if I have for example id=1 when I click the button it goes to the database and find the id 1 then write the infos in the other textfields
How to pass the value of a field in a database from one view to another. I currently have a list of members drawn from a database.
The members view is a list of members. From the list the user clicks view button to view a particular member. This is achieved by using a inputHidden tag with the value of the list of members in a data table.
in the RequestScoped bean I am able to use FacesContext to extract the value of idToken from the requestParameters and create the view for the particular member.
One field in the member view I would like to toggle - "Y" to "N" or vice versa via a commandButton. The issue is I can find no way of passing this single value back to the bean as is.
<td>Active:</td> <td><h:outputText value="#{controllerBean.member.active}" /></td> <td> <h:outputLabel value="To change toggle active button below" /> <h:inputHidden id="actToken" value="#{controllerBean.active}"/> </td> //further down the view <h:commandButton style="float: right" value="Toggle Active" action="#{controllerBean.toggleActive()}"/>
The issue is the value is displayed within the output text - how to pass the value into the inputHidden value.
I am using primeface in this project. I have a database with orders, order details and customers. The index page displays the order details and I click on one of the orders I want the customer details of that order to be displayed. But right now when I click on an order the dialog box that appears is empty. I'm not sure if the problem is with the jsf for the customer class.
The program contains username and password which on submission checks with the database if the details entered are right or wrong....on right details it Displays Welcome (name) and (lastname) parameters from database.
On jsp page i have created table with dynamically added rows now i want to insert the data from dynamic row field into database. How would I get the ids of those dynamically created rows to insert into database using hibernate.
i have a problem, im trying to get some values from a jtable (tabla) and insert them in a mysql database, so i scan the table for some values to know which of the rows i must insert ("s" or "n").
I'm able to insert few rows, but when the last row with "s" or "n" is inserted it launch me a NullPointerException and I dont know why.
This is my insert.jsp page I want to insert multiple values into database Including multiple values of checkbox, other values are getting inserted but only problem at selecting multiple checkbox values in same column and radio button value in same column.
---------------------look for servlet page below----------------
Connection con = null; ResultSet rs = null; PreparedStatement pst = null; int user = 0; String User_Id1 = null; String Other_Services = ""; String Title = request.getParameter("Title");
[Code]...
Is there any solution to insert this...By mistake in query I have followed with extra questionmark in following line This is correctline for inserting 5 values in database
The gist of it is to create a very basic memory game. There are 12 buttons, each associated with an icon. Every button that you click will display the icon and will stay there until clicked again. I got the bulk of it taken care of, but my issue lies with switching the icons back and forth. I can get them to display one at a time, but when I click on a new button, all the icons except the button I just clicked don't display. Essentially, only one shows up at a time.