€ Student Registration system ¾ PROFESSOR ¾ STUDENT ¾ COURSE ¾ TRANSCRIPT .

€ ‡Install Eclipse ¾ Integrated Development Environment € € € ‡Install Java SDK ‡Install Apache Tomcat Create Sample Web Application ¾ Helios/Callisto .

you will need an appropriate software to act as a container .€ Apache Tomcat ¾ application server ¾ renders Web pages which includes Java Server Page coding ¾ If you are going to be running Java Code in the form of Java Server Pages on your web server.

apache.€ Apache Tomcat ¾ provides a Java Virtual Machine and associated elements to give a complete Java Runtime Environment. ¾ provides web server software to make the environment accessible on the Web. ¾ You can get everything you want from the link below: ¾ .

You Also need Connector/J for JDBC to connect MySQL € Download Connector/J from ector/j/ € Copy it under WebContent/WEB-INF/lib € Already done in the war file € .

html Copy/Paste the contents of Java Resources/ owslab/services/mysql.sunysb.sql to the scripting window and execute € .€ € Install MySQLQuery Browser http://www.cs.

€ € € € € € Go to File->Import->WAR file Select the WAR to import ‡Replace username with your netID in all jsp files ‡Replace password with your SBU ID ‡Project->Run As->Run on Server ‡Go to .

Graphical User Interface € a type of user interface that allows users to interact with programs in more ways than typing € offers graphical icons. and visual indicators € .

€ You can learn the basic things about HTML here: http://www. Microsoft Front Page. € € .com/html/ Use HTML pages to develop GUI and add appropriate elements (button. textfield.w3schools. radio buttom) to take the user·s input and output your computing result on the screen Some recommended developing tools for HTML: Microsoft Visual Studio 2005. etc. UltraEdit. .€ JavaScript is the most popular scripting language on the internet. ¾ JavaScript was designed to add interactivity to HTML pages ¾ A scripting language is a lightweight programming language ¾ JavaScript is usually embedded directly into HTML pages € You can learn the basic things about JavaScript here: http://www.

com/ Link JavaScript functions to some input elements in your GUI in order to handle the users· input.€ For Detailed Information about JavaScript. please go to http://www. Especially link JavaScript to the buttons or radio buttons.javascript. € € .

myForm.htm". } </script> end of Javascript </head> end of head .submit() } submit the form function Button2_onclick() { handle button2 click window."_self").<html> Specify that this is an HTML document <head> head part <script language="javascript" type="text/javascript"> javascript begin here function Button1_onclick() { handle button1 click if("RegisterPage.username.value == "") get the value of username field alert("UserName Can Not Be Null!") javascript:myForm.

<body> body part <form name="myForm" action="login.jsp" method="post"> define a form (used to submit information of the input elements) <input id="Text1" name="username" type="text" /> <input id="Password1" name="userpasswd" type="password" /> define two input fields <input id="Button1" type="button" value="Log In" onclick="return Button1_onclick()" /> <input id="Button2" type="button" value="Register" onclick="return Button2_onclick()" /> define two buttons and their corresponding functions </form> end of form </body> end of body </html> end of html .

Java Server Pages (JSP) are normal HTML with Java code pieces embedded in them € .€ A technology for controlling the content or appearance of Web pages through the use of small programs that are specified in the Web page and run on the Web server to modify the Web page. . My Eclipse € You can find everything you want about JSP at: http://java.jsptut.€ Recommended developing tools for JSP: Microsoft Visual Studio http://www.

When you want to use the computing result of the Java Codes in HTML or JavaScript. You can simply add the java int b = 10.<% int a = 5. codes here between ´<%µ and int c = a + b. you can simply use <% = variable name %> to get its value. such as <%=c%> </body> </html> . John. Your age is <%=c%>. ´%>µ to compute everything %> you want <html> <body> HTML codes here Hello. Here is Your Personal Information.

¾ String mysURL = "jdbc:mysql://sbcstldb. ¾ String mysUserID = username. ¾ String mysPassword = password.€ 06/username". ¾ username = your netID ¾ password = your SBU ID .sunysb.cs.translab.jdbc. please add these String Variables in your Java codes between ´<%µ and ´%>µ in JSP ¾ String mysJDBCDriver = "com.mysql.Driver".

getProperties(). java.sql. sysprops.Then add these codes after the definition of String variables (still between ´<%µ and ´%>µ): ¾ ¾ ¾ ¾ ¾ ¾ ¾ ¾ ¾ ¾ java. // a new connection try { Class.DriverManager.getConnection(mysURL.sql. //the above is used to set property //connect to the database now conn=java.mysPassword).put("user".newInstance(). .sysp rops).Connection conn=null.util.Properties sysprops=System. sysprops.mysUserID).put("password".forName(mysJDBCDriver).

} finally{ try{conn. } . catch(Exception ee) {}. out.printStackTrace().System.close().out. //add your SQL query and update sentences here // try{ } catch(Exception e) { e.println("Connected successfully to database using JConnect").toString()).print(e.

executeQuery ("select * from Student where age = ¶µ + c + ´·µ).getString(´IDµ). } . Age). where ID and Age are both String: ¾ ¾ ¾ ¾ ¾ ¾ ¾ ¾ ¾ // a new SQL Statement java.€ ‡An example of SQL Query. rs records all the query //results from Student Table where Age is c { strID = rs.sql.out. // a new Result Set java. String strID = new String().println(µStudent µ+ strID +µ s age is µ + c + ´!µ).Statement stmt1 = conn. suppose we have a table Student (ID.ResultSet rs = stmt1.createStatement(). while( // now. System.

Sign up to vote on this title
UsefulNot useful