BCS-053 Important Questions Summary
1. Static vs. Dynamic Web Pages
- Static pages have fixed content; dynamic pages change based on user interactions or database content.
- Static pages load faster and are easier to build; dynamic pages require server-side scripts (like PHP, JSP
- Static pages don't require a server for content updates; dynamic pages do.
- Static content does not change unless manually updated; dynamic pages can show real-time data.
- Static pages are less interactive; dynamic pages allow for forms, personalization, and interactivity.
2. HTTP GET and POST Methods
- GET is used to request data from a server without affecting the data; POST sends data to the server to cr
- GET appends data in the URL; POST hides data within the body of the request.
- GET requests are idempotent (no side effects), while POST requests may affect the server data.
- GET is usually used for fetching data, while POST is for submitting forms or sending user data.
- Example of GET: searching for a term in a search engine; Example of POST: submitting login credentials
3. Writing XML Documents and DTDs
- XML documents use tags to structure data (like HTML but for data).
- Elements are user-defined, and there are no predefined tags.
- DTD (Document Type Definition) defines the structure and rules for XML elements and attributes.
- DTD helps in ensuring data consistency by validating XML documents.
- Example of DTD declaration: <!DOCTYPE example [<!ELEMENT example (tag)>].
4. JSP <jsp:include> and <jsp:param> Elements
- <jsp:include> dynamically includes content from other JSP files.
- Used to reuse headers, footers, or other common sections across pages.
- <jsp:param> passes parameters to included pages, like variables or values.
- Allows for modular code and reduces duplication.
- Example: <jsp:include page='header.jsp'><jsp:param name='username' value='John'/></jsp:include>.
5. Session Management in JSP (including Cookies)
- Session management helps in tracking user activity across multiple pages.
- Cookies store user data on the client side, which the server reads to track sessions.
- HttpSession in JSP provides methods like getSession() to create/manage sessions.
- Sessions are often used for login data, shopping carts, and user preferences.
- Cookies are small text files, and the response.addCookie() method in JSP adds them to a client.
6. CSS Class and ID Selectors
- .class selector applies styles to multiple elements, marked with the class name in HTML.
- #id selector applies styles to one unique element with a specific ID.
- Class names start with a dot (.) and can be used multiple times; IDs start with a hash (#) and are unique.
- Example of a class: .button { color: blue; }; Example of an ID: #header { background-color: black; }.
- IDs have higher specificity than classes in the CSS hierarchy.
7. Document Object Model (DOM) in HTML
- DOM represents an HTML document as a tree of objects.
- Each HTML tag becomes a node in this tree, which can be accessed and manipulated using JavaScript.
- Changes in the DOM immediately reflect on the webpage.
- DOM allows dynamic updates, like changing text, attributes, or styles.
- Example: document.getElementById('header').innerHTML = 'New Text'; changes the content of an elemen
8. MVC Architecture
- Stands for Model-View-Controller, a design pattern for applications.
- Model manages the data, View displays the data, and Controller handles user inputs.
- Separates concerns, making applications easier to develop, test, and maintain.
- Controller updates the Model and View; the Model updates the View when data changes.
- Common in web frameworks, like Django and Ruby on Rails, for organized, scalable applications.
9. WML Usage for Mobile Profiles
- WML (Wireless Markup Language) was used in early mobile web design.
- Designed for devices with limited screen size, bandwidth, and resources.
- Enables creation of simple forms, navigation, and text-based pages for mobile.
- Similar to HTML but optimized for mobile content delivery.
- Popular before smartphones; now largely replaced by responsive HTML and CSS.
10. JSP Scriptlets and Error Handling
- Scriptlets allow embedding Java code in JSP using <% ... %> syntax.
- Used to insert small pieces of logic, like loops or conditional statements.
- Not recommended for complex logic; better to use servlets or JavaBeans.
- Error handling can be done using try-catch blocks in scriptlets.
- Example: <% try { /* code */ } catch(Exception e) { out.print('Error'); } %>.