Session 34 - JDBC Best Practices, Introduction to Design PatternsPawanMM
In this session, you will learn:
1. Deployment Descriptor
2. Configuring and Mapping a Servlet
3. The flow of the demo web apps
4. JDBC Best practices
5. Design Patterns
In this session, you will learn:
1. Hibernate
2. Advantages of Hibernate
3. Hibernate Architecture – High Level
4. Hibernate – Detailed Architecture
5. Hibernate Architecture – Important Levels
6. Hibernate jar files
7. Hibernate tools download
8. CRUD Operations
9. Hibernate with Annotations
10. Design Patterns in Java
Session 34 - JDBC Best Practices, Introduction to Design PatternsPawanMM
In this session, you will learn:
1. Deployment Descriptor
2. Configuring and Mapping a Servlet
3. The flow of the demo web apps
4. JDBC Best practices
5. Design Patterns
In this session, you will learn:
1. Hibernate
2. Advantages of Hibernate
3. Hibernate Architecture – High Level
4. Hibernate – Detailed Architecture
5. Hibernate Architecture – Important Levels
6. Hibernate jar files
7. Hibernate tools download
8. CRUD Operations
9. Hibernate with Annotations
10. Design Patterns in Java
In this session, you will learn:
1. Generator Class in Hibernate
2. SQL Dialects
3. Collection Mapping
4. One-to-one Mapping
5. Cascade Types
6. Many to one / One to many
7. Hibernate Lazy Loading
8. Transaction Management
9. HQL – Hibernate Query Language
10. HCQL – Hibernate Criteria Query Language
11. Hibernate Caching
In this Java JSP Training session, you will learn JSP. Topics covered in this session are:
• JSP vs Servlet
• LifeCycle of Servlet
• JSP Elements
• JSP Page directive
• Directives vs Action tags
For more information, visit this link:
https://www.mindsmapped.com/courses/software-development/jsp-and-servlets-designing-web-applications-with-java/
In this Java Spring Training session, you will learn Spring MVC. Topics covered in this session are:
For more information, visit this link:
• Spring framework
• Inversion of Control
• Dependency Injection – Two types
• Defining beans using XML
• Inheriting beans
• Auto-wiring
• Annotations based configuration
• Java based configuration
• Spring AOP
https://www.mindsmapped.com/courses/software-development/spring-fundamentals-learn-spring-framework-and-spring-boot/
In this Java Hibernate Training session, you will learn Integrating Struts with Hibernate. Topics covered in this session are:
• Struts 2
• Struts Action Class
• Validation
• Control Tags
• Data Tags
For more information, visit this link:
https://www.mindsmapped.com/courses/software-development/learn-hibernate-fundamentals-from-scratch/
In this Java JSP Training session, you will learn JSP. Topics covered in this session are:
• JSP (Java Server Pages Technology)
• JSP vs Servlet
• MVC Architecture
• Scriplet
For more information, visit this link:
https://www.mindsmapped.com/courses/software-development/jsp-and-servlets-designing-web-applications-with-java/
In this Java Hibernate Training session, you will learn Hibernate part -2. Topics covered in this session are:
• Generator Class in Hibernate
• SQL Dialects
• Collection Mapping
• One-to-one Mapping
• Cascade Types
• Many to one / One to many
• Hibernate Lazy Loading
• Transaction Management
• HQL – Hibernate Query Language
• HCQL – Hibernate Criteria Query Language
• Hibernate Caching
For more information, visit this link:
https://www.mindsmapped.com/courses/software-development/learn-hibernate-fundamentals-from-scratch/
Session 43 - Spring - Part 1 - IoC DI BeansPawanMM
In this session you will learn:
1.Spring Framework
2. Core Container
3. Data Access/Integration
4. Web Layer
5. Spring Setup
6. Key features
7. Spring Bean
8. Dependency Injection
9. Relation between DI and IoC
10. Spring IoC Containers
11. Spring DI
JSF 2 Notes with coding examples topics include introduction , managed bean, jsf tags, navigation, jsf life cycle and phase listners,jsf validation and converters, i18n
In this Java Hibernate Training session, you will learn Introducing Struts Framework. Topics covered in this session are:
• Introduction to Struts Framework
• Features
• Evolution
• Struts Demo
• Declarative validation
• Architecture
• Validators
• Interceptors
For more information, visit this link:
https://www.mindsmapped.com/courses/software-development/learn-hibernate-fundamentals-from-scratch/
In this session, you will learn:
1. Generator Class in Hibernate
2. SQL Dialects
3. Collection Mapping
4. One-to-one Mapping
5. Cascade Types
6. Many to one / One to many
7. Hibernate Lazy Loading
8. Transaction Management
9. HQL – Hibernate Query Language
10. HCQL – Hibernate Criteria Query Language
11. Hibernate Caching
In this Java JSP Training session, you will learn JSP. Topics covered in this session are:
• JSP vs Servlet
• LifeCycle of Servlet
• JSP Elements
• JSP Page directive
• Directives vs Action tags
For more information, visit this link:
https://www.mindsmapped.com/courses/software-development/jsp-and-servlets-designing-web-applications-with-java/
In this Java Spring Training session, you will learn Spring MVC. Topics covered in this session are:
For more information, visit this link:
• Spring framework
• Inversion of Control
• Dependency Injection – Two types
• Defining beans using XML
• Inheriting beans
• Auto-wiring
• Annotations based configuration
• Java based configuration
• Spring AOP
https://www.mindsmapped.com/courses/software-development/spring-fundamentals-learn-spring-framework-and-spring-boot/
In this Java Hibernate Training session, you will learn Integrating Struts with Hibernate. Topics covered in this session are:
• Struts 2
• Struts Action Class
• Validation
• Control Tags
• Data Tags
For more information, visit this link:
https://www.mindsmapped.com/courses/software-development/learn-hibernate-fundamentals-from-scratch/
In this Java JSP Training session, you will learn JSP. Topics covered in this session are:
• JSP (Java Server Pages Technology)
• JSP vs Servlet
• MVC Architecture
• Scriplet
For more information, visit this link:
https://www.mindsmapped.com/courses/software-development/jsp-and-servlets-designing-web-applications-with-java/
In this Java Hibernate Training session, you will learn Hibernate part -2. Topics covered in this session are:
• Generator Class in Hibernate
• SQL Dialects
• Collection Mapping
• One-to-one Mapping
• Cascade Types
• Many to one / One to many
• Hibernate Lazy Loading
• Transaction Management
• HQL – Hibernate Query Language
• HCQL – Hibernate Criteria Query Language
• Hibernate Caching
For more information, visit this link:
https://www.mindsmapped.com/courses/software-development/learn-hibernate-fundamentals-from-scratch/
Session 43 - Spring - Part 1 - IoC DI BeansPawanMM
In this session you will learn:
1.Spring Framework
2. Core Container
3. Data Access/Integration
4. Web Layer
5. Spring Setup
6. Key features
7. Spring Bean
8. Dependency Injection
9. Relation between DI and IoC
10. Spring IoC Containers
11. Spring DI
JSF 2 Notes with coding examples topics include introduction , managed bean, jsf tags, navigation, jsf life cycle and phase listners,jsf validation and converters, i18n
In this Java Hibernate Training session, you will learn Introducing Struts Framework. Topics covered in this session are:
• Introduction to Struts Framework
• Features
• Evolution
• Struts Demo
• Declarative validation
• Architecture
• Validators
• Interceptors
For more information, visit this link:
https://www.mindsmapped.com/courses/software-development/learn-hibernate-fundamentals-from-scratch/
Mumbai Academics is Mumbai’s first dedicated Professional Training Center for Training with Spoke and hub model with Multiple verticles . The strong foundation of Mumbai Academics is laid by highly skilled and trained Professionals, carrying mission to provide industry level input to the freshers and highly skilled and trained Software Professionals/other professional to IT companies.
JSP technology is used to create web application just like Servlet technology. It can be thought of as an extension to Servlet because it provides more accuracy.
A JSP page consists of HTML tags and JSP tags. The JSP pages are easier to maintain than Servlet because we can separate designing and development. It provides some additional features such as Expression Language, Custom Tags, etc. Extension to Servlet, Easy to maintain, Fast Development: No need to recompile and redeploy, Less code than Servlet
This slide is about basics of java servlet and java server page.
A basic example of JSP using multiple directives.
Further information of setting up and using of Apache Tomcat server.
Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 7 ...WebStackAcademy
Creating JavaServer Pages (JSP) files
Most types of JSP files can be created using the New JSP File wizard. To create a basic JSP file using the wizard, complete the following steps:
Create a dynamic Web project if you have not already done so.
In the Project Explorer, expand your project and right click on your WebContent folder or on a subfolder under WebContent. Note that if you choose any other folder in which to create the JSP, then it will not be included in the WAR file that is deployed to the server. In addition, link validation will not encompass files that are not under the WebContent folder.
From the context menu, select New > JSP. The New Java Server Page window appears with your folder selected
Type a file name into the File name field, making sure you include the jsp extension (jsp, jsv, jtpl, or jspx) in the file name.
You have several options for proceeding:
To accept the defaults associated with a new JSP file, select Finish.
To link to a file in the file system and specify path variables, select Advanced and then make your selections using the Browse and Variables buttons.
To use a template file for the initial content of your JSP page, select Next. The Select JSP Template window appears. Select the Use JSP Template check box, and then select one of the sample templates. You can also select the JSP Templates link to add or remove JSP templates to your list of templates.
In this session you will learn:
1. Spring framework
2. Inversion of Control
3. Dependency Injection – Two types
4. Defining beans using XML
5. Inheriting beans
6. Auto-wiring
7. Annotations based on a configuration
8. Java-based configuration
9. Spring AOP
In this session you will learn:
1. Introduction to Struts Framework
2. Features
3. Evolution
4. Struts Demo
5. Declarative validation
6. Architecture
7. Validators
8. Interceptors
In this session you will learn:
1. Recap of Arrays, ArrayLists
2. Basically, there can be 2 operations that you would want to perform on Arrays/ArrayLists.. (and maybe, other collections)
3. Search: Override equals() and hashCode().
4. Sort: provide comparison logic – Two ways
4.1 Comparable interface
4.2 Comparator interface
UiPath Test Automation using UiPath Test Suite series, part 3DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 3. In this session, we will cover desktop automation along with UI automation.
Topics covered:
UI automation Introduction,
UI automation Sample
Desktop automation flow
Pradeep Chinnala, Senior Consultant Automation Developer @WonderBotz and UiPath MVP
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Ramesh Iyer
In today's fast-changing business world, Companies that adapt and embrace new ideas often need help to keep up with the competition. However, fostering a culture of innovation takes much work. It takes vision, leadership and willingness to take risks in the right proportion. Sachin Dev Duggal, co-founder of Builder.ai, has perfected the art of this balance, creating a company culture where creativity and growth are nurtured at each stage.
Search and Society: Reimagining Information Access for Radical FuturesBhaskar Mitra
The field of Information retrieval (IR) is currently undergoing a transformative shift, at least partly due to the emerging applications of generative AI to information access. In this talk, we will deliberate on the sociotechnical implications of generative AI for information access. We will argue that there is both a critical necessity and an exciting opportunity for the IR community to re-center our research agendas on societal needs while dismantling the artificial separation between the work on fairness, accountability, transparency, and ethics in IR and the rest of IR research. Instead of adopting a reactionary strategy of trying to mitigate potential social harms from emerging technologies, the community should aim to proactively set the research agenda for the kinds of systems we should build inspired by diverse explicitly stated sociotechnical imaginaries. The sociotechnical imaginaries that underpin the design and development of information access technologies needs to be explicitly articulated, and we need to develop theories of change in context of these diverse perspectives. Our guiding future imaginaries must be informed by other academic fields, such as democratic theory and critical theory, and should be co-developed with social science scholars, legal scholars, civil rights and social justice activists, and artists, among others.
DevOps and Testing slides at DASA ConnectKari Kakkonen
My and Rik Marselis slides at 30.5.2024 DASA Connect conference. We discuss about what is testing, then what is agile testing and finally what is Testing in DevOps. Finally we had lovely workshop with the participants trying to find out different ways to think about quality and testing in different parts of the DevOps infinity loop.
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...James Anderson
Effective Application Security in Software Delivery lifecycle using Deployment Firewall and DBOM
The modern software delivery process (or the CI/CD process) includes many tools, distributed teams, open-source code, and cloud platforms. Constant focus on speed to release software to market, along with the traditional slow and manual security checks has caused gaps in continuous security as an important piece in the software supply chain. Today organizations feel more susceptible to external and internal cyber threats due to the vast attack surface in their applications supply chain and the lack of end-to-end governance and risk management.
The software team must secure its software delivery process to avoid vulnerability and security breaches. This needs to be achieved with existing tool chains and without extensive rework of the delivery processes. This talk will present strategies and techniques for providing visibility into the true risk of the existing vulnerabilities, preventing the introduction of security issues in the software, resolving vulnerabilities in production environments quickly, and capturing the deployment bill of materials (DBOM).
Speakers:
Bob Boule
Robert Boule is a technology enthusiast with PASSION for technology and making things work along with a knack for helping others understand how things work. He comes with around 20 years of solution engineering experience in application security, software continuous delivery, and SaaS platforms. He is known for his dynamic presentations in CI/CD and application security integrated in software delivery lifecycle.
Gopinath Rebala
Gopinath Rebala is the CTO of OpsMx, where he has overall responsibility for the machine learning and data processing architectures for Secure Software Delivery. Gopi also has a strong connection with our customers, leading design and architecture for strategic implementations. Gopi is a frequent speaker and well-known leader in continuous delivery and integrating security into software delivery.
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Tobias Schneck
As AI technology is pushing into IT I was wondering myself, as an “infrastructure container kubernetes guy”, how get this fancy AI technology get managed from an infrastructure operational view? Is it possible to apply our lovely cloud native principals as well? What benefit’s both technologies could bring to each other?
Let me take this questions and provide you a short journey through existing deployment models and use cases for AI software. On practical examples, we discuss what cloud/on-premise strategy we may need for applying it to our own infrastructure to get it to work from an enterprise perspective. I want to give an overview about infrastructure requirements and technologies, what could be beneficial or limiting your AI use cases in an enterprise environment. An interactive Demo will give you some insides, what approaches I got already working for real.
Neuro-symbolic is not enough, we need neuro-*semantic*Frank van Harmelen
Neuro-symbolic (NeSy) AI is on the rise. However, simply machine learning on just any symbolic structure is not sufficient to really harvest the gains of NeSy. These will only be gained when the symbolic structures have an actual semantics. I give an operational definition of semantics as “predictable inference”.
All of this illustrated with link prediction over knowledge graphs, but the argument is general.
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...UiPathCommunity
💥 Speed, accuracy, and scaling – discover the superpowers of GenAI in action with UiPath Document Understanding and Communications Mining™:
See how to accelerate model training and optimize model performance with active learning
Learn about the latest enhancements to out-of-the-box document processing – with little to no training required
Get an exclusive demo of the new family of UiPath LLMs – GenAI models specialized for processing different types of documents and messages
This is a hands-on session specifically designed for automation developers and AI enthusiasts seeking to enhance their knowledge in leveraging the latest intelligent document processing capabilities offered by UiPath.
Speakers:
👨🏫 Andras Palfi, Senior Product Manager, UiPath
👩🏫 Lenka Dulovicova, Product Program Manager, UiPath
The Art of the Pitch: WordPress Relationships and SalesLaura Byrne
Clients don’t know what they don’t know. What web solutions are right for them? How does WordPress come into the picture? How do you make sure you understand scope and timeline? What do you do if sometime changes?
All these questions and more will be explored as we talk about matching clients’ needs with what your agency offers without pulling teeth or pulling your hair out. Practical tips, and strategies for successful relationship building that leads to closing the deal.
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualityInflectra
In this insightful webinar, Inflectra explores how artificial intelligence (AI) is transforming software development and testing. Discover how AI-powered tools are revolutionizing every stage of the software development lifecycle (SDLC), from design and prototyping to testing, deployment, and monitoring.
Learn about:
• The Future of Testing: How AI is shifting testing towards verification, analysis, and higher-level skills, while reducing repetitive tasks.
• Test Automation: How AI-powered test case generation, optimization, and self-healing tests are making testing more efficient and effective.
• Visual Testing: Explore the emerging capabilities of AI in visual testing and how it's set to revolutionize UI verification.
• Inflectra's AI Solutions: See demonstrations of Inflectra's cutting-edge AI tools like the ChatGPT plugin and Azure Open AI platform, designed to streamline your testing process.
Whether you're a developer, tester, or QA professional, this webinar will give you valuable insights into how AI is shaping the future of software delivery.
JMeter webinar - integration with InfluxDB and GrafanaRTTS
Watch this recorded webinar about real-time monitoring of application performance. See how to integrate Apache JMeter, the open-source leader in performance testing, with InfluxDB, the open-source time-series database, and Grafana, the open-source analytics and visualization application.
In this webinar, we will review the benefits of leveraging InfluxDB and Grafana when executing load tests and demonstrate how these tools are used to visualize performance metrics.
Length: 30 minutes
Session Overview
-------------------------------------------
During this webinar, we will cover the following topics while demonstrating the integrations of JMeter, InfluxDB and Grafana:
- What out-of-the-box solutions are available for real-time monitoring JMeter tests?
- What are the benefits of integrating InfluxDB and Grafana into the load testing stack?
- Which features are provided by Grafana?
- Demonstration of InfluxDB and Grafana using a practice web application
To view the webinar recording, go to:
https://www.rttsweb.com/jmeter-integration-webinar
UiPath Test Automation using UiPath Test Suite series, part 4DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 4. In this session, we will cover Test Manager overview along with SAP heatmap.
The UiPath Test Manager overview with SAP heatmap webinar offers a concise yet comprehensive exploration of the role of a Test Manager within SAP environments, coupled with the utilization of heatmaps for effective testing strategies.
Participants will gain insights into the responsibilities, challenges, and best practices associated with test management in SAP projects. Additionally, the webinar delves into the significance of heatmaps as a visual aid for identifying testing priorities, areas of risk, and resource allocation within SAP landscapes. Through this session, attendees can expect to enhance their understanding of test management principles while learning practical approaches to optimize testing processes in SAP environments using heatmap visualization techniques
What will you get from this session?
1. Insights into SAP testing best practices
2. Heatmap utilization for testing
3. Optimization of testing processes
4. Demo
Topics covered:
Execution from the test manager
Orchestrator execution result
Defect reporting
SAP heatmap example with demo
Speaker:
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
Let's dive deeper into the world of ODC! Ricardo Alves (OutSystems) will join us to tell all about the new Data Fabric. After that, Sezen de Bruijn (OutSystems) will get into the details on how to best design a sturdy architecture within ODC.
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...DanBrown980551
Do you want to learn how to model and simulate an electrical network from scratch in under an hour?
Then welcome to this PowSyBl workshop, hosted by Rte, the French Transmission System Operator (TSO)!
During the webinar, you will discover the PowSyBl ecosystem as well as handle and study an electrical network through an interactive Python notebook.
PowSyBl is an open source project hosted by LF Energy, which offers a comprehensive set of features for electrical grid modelling and simulation. Among other advanced features, PowSyBl provides:
- A fully editable and extendable library for grid component modelling;
- Visualization tools to display your network;
- Grid simulation tools, such as power flows, security analyses (with or without remedial actions) and sensitivity analyses;
The framework is mostly written in Java, with a Python binding so that Python developers can access PowSyBl functionalities as well.
What you will learn during the webinar:
- For beginners: discover PowSyBl's functionalities through a quick general presentation and the notebook, without needing any expert coding skills;
- For advanced developers: master the skills to efficiently apply PowSyBl functionalities to your real-world scenarios.
2. Page 1Classification: Restricted
Copyright @ 2000 Jordan Anastasiade. All rights reserved. 1
Agenda
• JSP (Java Server Pages Technology)
• JSP vs Servlet
• MVC Architecture
• Scriplet
3. Page 2Classification: Restricted
Copyright @ 2000 Jordan Anastasiade. All rights reserved. 2
JavaServer Pages Technology
• JavaServer Pages (JSP) technology provides a simplified, fast way to create
web pages that display dynamically-generated content.
• Server Page technology = the web pages are dynamically built on the server
side. E.g. JSP, ASP, BSP
4. Page 3Classification: Restricted
Copyright @ 2000 Jordan Anastasiade. All rights reserved. 3
JSP vs Servlet
Servlet = HTML in a Java class
JSP = Java in an HTML page
out.println(“<h1> Hello World! </h1>”);
<%= request.getParameter("title") %>
7. Page 6Classification: Restricted
Model 2 Architecture
(also known as MVC or Model-View-Controller)
Single Responsibility Principle,
Separation of Concerns.
8. Page 7Classification: Restricted
Copyright @ 2000 Jordan Anastasiade. All rights reserved. 7
JSP Page
• A JSP page is a page created by the web developer that includes JSP
technology-specific tags, declarations, and possibly scriptlets, in
combination with other static HTML or XML tags.
• A JSP page has the extension .jsp; this signals to the web server that the JSP
engine will process elements on this page.
• Pages built using JSP technology are typically implemented using a
translation phase that is performed once, the first time the page is called.
The page is compiled into a Java Servlet class and remains in server
memory, so subsequent calls to the page have very fast response times.
9. Page 8Classification: Restricted
Copyright @ 2000 Jordan Anastasiade. All rights reserved. 8
Overview
• JavaServer Pages (JSP) lets you separate the dynamic part of your pages
from the static HTML.
HTML tags and text
<% some JSP code here %>
HTML tags and text
<I>
<%= request.getParameter("title") %>
</I>
You normally give your file a .jsp extension, and typically install it in any
place you could place a normal Web page
11. Page 10Classification: Restricted
Copyright @ 2000 Jordan Anastasiade. All rights reserved. 10
Translation Time
• A JSP application is usually a collection of JSP files, HTML files, graphics
and other resources.
• A JSP page is compiled when your user loads it into a Web browser
1. When the user loads the page for the first time, the files that make up the
application are all translated together, without any dynamic data, into
one Java source file (a .java file)
2. The .java file is compiled to a .class file. In most implementations, the
.java file is a Java servlet that complies with the Java Servlet API.
12. Page 11Classification: Restricted
Copyright @ 2000 Jordan Anastasiade. All rights reserved. 11
Simple JSP Page
<%@ page info=“A Simple JSP Sample” %>
<HTML>
<H1> First JSP Page </H1>
<BODY>
<% out.println(“Welcome to JSP world”); %>
</BODY>
</HTML>
13. Page 12Classification: Restricted
Copyright @ 2000 Jordan Anastasiade. All rights reserved. 12
How JSP Works?
User Request – JSP File Requested
Server
File
ChangedCreate Source from JSP
Compile Execute Servlet
16. Page 15Classification: Restricted
Copyright @ 2000 Jordan Anastasiade. All rights reserved. 15
JSP Elements
• Declarations <%! code %>
• Expressions <%= expression %>
• Scriptlets <% code %>
17. Page 16Classification: Restricted
Copyright @ 2000 Jordan Anastasiade. All rights reserved. 16
HTML Comment
• Generates a comment that is sent to the client.
• Syntax
<!-- comment [ <%= expression %> ] -->
• Example:
<!-- This page was loaded on
<%= (new java.util.Date()).toLocaleString() %>
-->
18. Page 17Classification: Restricted
Copyright @ 2000 Jordan Anastasiade. All rights reserved. 17
Declaration
• Declares a variable or method valid in the scripting language used in the JSP page.
• Syntax
<%! declaration; [ declaration; ]+ ... %>
• Examples
<%! String destin; %>
<%! public String getDestination()
{return destin;}%>
<%! Circle a = new Circle(2.0); %>
• You can declare any number of variables or methods within one declaration
element, as long as you end each declaration with a semicolon.
• The declaration must be valid in the Java programming language.
19. Page 18Classification: Restricted
Copyright @ 2000 Jordan Anastasiade. All rights reserved. 18
Declaration Example: Variables declaration
<HTML>
<HEAD><TITLE>JSP Declarations</TITLE></HEAD>
<BODY><H1>JSP Declarations</H1>
<%! private int keepCount = 0; %>
<H2>
Page accessed:
<%= ++keepCount %>
times
</H2>
</BODY>
</HTML>
Best Practice: Never use instance
variables in Servlets. (Multithreading)
20. Page 19Classification: Restricted
Declaration example: Methods declaration
<html>
<head>
<title>Methods Declaration</title>
</head>
<body>
<%!
int sum(int num1, int num2, int num3){
return num1+num2+num3;
}
%>
<%= "Result is: " + sum(10,40,50) %>
</body>
</html>
21. Page 20Classification: Restricted
Copyright @ 2000 Jordan Anastasiade. All rights reserved. 20
Predefined Variable – Implicit Objects
• request – Object of HttpServletRequest (request parameters, HTTP headers, cookies
• response – Object of HttpServletResponse
• out - Object of PrintWriter buffered version JspWriter
• session - Object of HttpSession associated with the request
• application - Object of ServletContext shared by all servlets in the engine
• config - Object of ServletConfig
• pageContext - Object of PageContext in JSP for a single point of access
e.g. pageContext.getSession()
• page – variable synonym for this object
e.g. <%= ((Servlet)page).getServletInfo () %>
22. Page 21Classification: Restricted
Copyright @ 2000 Jordan Anastasiade. All rights reserved. 21
Expression
• Contains an expression valid in the scripting language used in the JSP page. Syntax:
<%= expression %>
<%! String name = new String(“JSP World”); %>
<%! public String getName() { return name; } %>
<B><%= getName() %></B>
• Description:
An expression element contains a scripting language expression that is
evaluated, converted to a String, and inserted where the expression appears in
the JSP file.
• Because the value of an expression is converted to a String, you can use an
expression within a line of text, whether or not it is tagged with HTML, in a
JSPfile. Expressions are evaluated from left to right.
23. Page 22Classification: Restricted
Copyright @ 2000 Jordan Anastasiade. All rights reserved. 22
Expression Example
<HTML>
<HEAD>
<TITLE>JSP Expressions</TITLE>
</HEAD>
<BODY>
<H2>JSP Expressions</H2>
<UL>
<LI>Current time: <%= new java.util.Date() %>
<LI>Your hostname: <%= request.getRemoteHost()%>
<LI>Your session ID: <%= session.getId() %>
</UL>
</BODY>
</HTML>
25. Page 24Classification: Restricted
Expression Example 3
<html>
<head>
<title>JSP expression tag example2</title>
</head>
<body>
<%
int a=10;
int b=20;
int c=30;
%>
<%= a+b+c %>
</body>
</html>
26. Page 25Classification: Restricted
Expression Example 4
index.jsp
<html>
<head>
<title> JSP expression tag example3 </title>
</head>
<body>
<% application.setAttribute("MyName", "Chaitanya"); %>
<a href="display.jsp">Click here for display</a>
</body>
</html>
display.jsp
<html>
<head>
<title>Display Page</title>
</head>
<body>
<%="This is a String" %><br>
<%= application.getAttribute("MyName") %>
</body>
</html>
27. Page 26Classification: Restricted
Copyright @ 2000 Jordan Anastasiade. All rights reserved. 26
Scriptlet
• Contains a code fragment valid in the page scripting language.
• Syntax
<% code fragment %>
<%
String var1 = request.getParameter("name");
out.println(var1);
%>
• This code will be placed in the generated servlet method:
_jspService()
28. Page 27Classification: Restricted
Copyright @ 2000 Jordan Anastasiade. All rights reserved. 27
Scriplet Example
<HTML>
<HEAD><TITLE>Weather</TITLE></HEAD>
<BODY>
<H2>Today's weather</H2>
<% if (Math.random() < 0.5) { %>
Today will be a <B>sunny</B> day!
<% } else { %>
Today will be a <B>windy</B> day!
<% } %>
</BODY>
</HTML>
29. Page 28Classification: Restricted
Copyright @ 2000 Jordan Anastasiade. All rights reserved. 28
Topics to be covered in next session
• JSP vs Servlet
• LifeCycle of Servlet
• JSP Elements
• JSP Page directive
• Directives vs Action tags