Mcsl-054
PART-I: MCS-051 (Advanced Internet Technologies)
QUESTION-1: Develop a web page using Servlet which ask for your name and address and print a message “ Welcome! Mr./Miss. Your Name on this web page” and show the current date and time on the top of web page.
Soltion:
Imporr javax.servlet.*;
Imporr javax.servlet.http.*;
Imporr java.io.*;
Imporr java.utill.Date;
Public clasas HelloServlet extends HttpServlet
{
Public void (HttpServletRequest, request, HttpServlet response)
Throws IoException, ServletException
{
Response.setContentType(“Text/html”);
PrintWriter out = response.getWriter();
Out.println (“<Htmt>”);
Out.println (“<Body>”);
Out.println (“Enter your name<input type=”text” name=”a”>”);
Out.println (“Address <input type =”text” name =”b>”);
String n = request.getParameter (“a”);
Out.println (“Welcome! Mr./Miss” +a);
Out.println (“new.java.util.Date( ));
}
}
QUESTION-2 : Write a JSP Program, which displays a web page containing two web links one for your profiling and other for the schedule of theory of practical classes of your Batch. When one click on link for getting your profile it goes to a JSP page which display your personal profile and by clicking on link for classes schedule another JSP page will open to show the schedule
Solution:
Menu.Jsp
<html>
<body>
<form action =”profile.jsp” method = “post”>
<input type = “submit” value=”PROFILE”>
</form>
<form action=”schedule.jsp method=”post”>
<input type=submit” value=”SCHEDULE”>
</form>
</body>
</html>
</html>
Profile.jsp
<html>
<body>
<h1> MY PROFILE </h1>
NAME VINITA AGARWAL
ADDRESS A-16/F NEW DELHI
SCHOOL MCS.SBM., NEW DELHI
UNIVERSITY I.G.N.O.U
QULIFICATION B.C.A, Pursuing M.C.A
Skills C, C++, JAVA
Ph. No. 9811836816
</Body>
</html>
Schedule. Jsp
<html>
<body>
<h1> Schedulen OF MCA(5) THEORY <h1>
<b> MCS-051 </B>
Monday
Tuesday
Saturday
<b> MCS-052 </b>
Sunday
<b> MCS-053 </b>
Saturday
Sunday
</body>
<html>
QUESTION-3: Write a program using JDBC and JSP to display the computer books available in your Study Centres Library. Provide suitable options for issue/return of the books and searching and pupation in the library database.
Solution:
SO.jsp
<html>
<body>
<form action = “Book.jsp” method = “post”>
<input type =”submit” value = “BookInfo”>
</form>
<form action = “Issue.jsp” method = “post”>
<input type =”submit” value = “Issue”>
</form>
<form action = “Search.jsp” method = “post”>
<input type =”submit” value = “Search”>
</form>
<form action = “Retun.jsp” method = “post”>
<input type =”submit” value = “Return”>
</form>
</body>
</html>
Book.jsp
<% @ language=”java” import= “java.sql.*”, “java.io>
<html>
<body>
<%
Class.forName (“Com.mywqyl.jdbc.Driver”);
Connection con=DriverManager.getConection(“jdbc : mysql : // localhost / institute”, “root”, “1234”);
Statement st = con.createStatement( );
ResultSet rs = st.executeQuery(“Select * from Liabrary where subject =”computer”);
Int i= 0;
While (rs.next(i) = = True)
{
Out.println(rs.getString (i)”);
}
%>
</body>
</html>
Issue.jsp
<html>
<body>
<form action =”issued.jsp” method = “post”>
ID NO. <input type = “text” name=”b”>
<%
<input type = “submit” value= “IssueBook”>
</form>
</body>
</html>
QUESTION-4. Create an XML document for student’s record at your Study Centre.
Solution:
<?xml version=1.0 ?>
<student Records>
<student Record>
<Name> VINITA AGGARWAL</Name>
<PROGRAMME> MCA </PROGRAMME>
<E-No> 063501077</E-No>
<Address> g-14/B, Kiran Graden, uttam Naga r</Address>
<ph-no> 9811836856 </Ph-no>
<Student Record>
<Name> Shweta Chopra </Name>
<PROGRAMME> MCA </PROGRAMME>
<E-NO> 063502656 </E-NO>
<ADDRE SS> A-17/F,u.n </ADDRESS>
<ph.no> 9958621533 </ph.no>
</student record>
</student records>
Issued.jsp
<% @ language=”java” import=”java.co.x” %>
<html.
<body>
<% string b1 = response.getParameter(“a”);
Class.for Name(“Com.mysql.jdbc.Driver”);
Connection con = drivermanager.getconnetion(“jdbc:mysql://localhost”institute”, “root”, “1234”>
Statement st= con.createstatement();
Result rs= st.execute update (“update library set status=”issued” whereBook_title=””
%>
Search.jsp
<html>
<body>
<form action=”searchavailable” method=post”>
Enter Book name<input type=”text” name=”a”>
Search For availability
<input type=”submit” value”search for availability”>
</form>
</body>
</html>
Searchavailable.jsp
<% @ language=”java” import=”java.io.x”, “java.sql.x”%>
<html>
<body>
<%
String = response.getParameter(“a”);
Class.forName(“com.mysql.jdbs.Driver”);
Connection con=DriverManager.getConnection(“jdbc”.mysql://localhost/institute”, “root”, “1234”);
Statement sr-con.createstatement ();
Resukt rs=st.executeQuery (“select status from Library where Book_title=”+a+”’”);
String out= rs.getString(1);
Out.printer(n(“status=” +out+);
%>
</body>
</html>
HomeWork
-------------
Question 1: Write a program using Servlet/JSP that accepts the account number of a bank customer as input. The program should print the details of the account. Make necessary assumptions whereever required.
Question 2: Write a JSP Program, which displays a web page containing two web links one for showing schedule of counselling sessions at a Study Centre and other for FAQs on Programme on offer by the university. When one click on link Study Centre it goes to a page which show the counselling schedule for MCA students. Clicking on link for FAQs on Programme on Offer, another JSP page open, which consists of some FAQ related to different programme offered in the University.
Question 3: Write a program using JSP and JDBC to provide details of MCA/BCA/CIT students at a IGNOU study centres. Also the program should enable any student to change his/her address. This program should provide the practical attendance detail of students in different semesters of MCA/BCA/CIT.
Question 4: Create an XML document for keeping students record in a department of a University.


