التخطي إلى المحتوى الرئيسي

المشاركات

عرض الرسائل ذات التصنيف Spring MVC

SpEL in Spring Core

SPEL in Spring Core:  It is Expression Language that provide Query and Manipulation using normal expression. it is basically used into Object Graph and Inline Operation on Spring Application. it is not directly connected with XML configuration, it can be directly used by Spring Expression class and methods. How to Use Spell: 1. Use ExpressionParser Class: create an instance of ExpressionParser to parse the SpEL expression. 2. Parse the Expression: Use the parseExpression() method of the ExpressionParser to parse the SpEL expression string. 3. Provide an EvaluationContext: An EvaluationContext provides the context in which the expression will be evaluated. It can be a StandardEvaluationContext or a custom implementation. 4. Evaluate the Expression: Use the getValue() method of the Expression object to evaluate the expression and get the result. 

Hibernate 5 Tutorials

Hibernate 5 Tutorials  Now Hibernate 3 and 4 are deprecated and Industry prefer Hibernate 5 and Hibernate 6. You  have knowledge of Hibernate 5 also if you have knowledge Hibernate 3 and four. Many Updating added in Hibernate 5 Now I am explaining Step by Step 1)  Open Eclipse Create Maven Project, Select Internal under Category and select QuickStart archetype 2)  Add Dependency under pom.xml file of hibernate and MySQL Connector <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">   <modelVersion>4.0.0</modelVersion>   <groupId>com.scs</groupId>   <artifactId>Hibernate5</artifactId>   <version>0.0.1-SNAPSHOT</version>   <packaging>jar</packaging>   <name>Hibernate5</name>   <url>http://maven.a...

Spring Introduction? What is Spring?

What is Spring: It is an application framework that is used to create Enterprise applications in Java using IoC Container, Dependency Injection, Spel, AOP, and other important features. Spring Framework specially design to provide better flexibility and performance to Java Enterprise Application. Java provides better security but less flexibility to a distributed design pattern that's why Spring Framework and Struts Framework have been launched. It has been created to enhance EJB(Enterprise Java Bean) because EJB is complex for configuration and it requires higher resources. What is Spring History? The first version of the Spring framework was written by Rod Johnson in 2002.  The framework was first released in June 2003 under the Apache license version 2.0.  The first milestone release of the Spring framework (1.0) was released in March 2004.  Spring 2.0, which came in 2006, simplified the XML config files. Spring 2.5, which came in 2007, introduced annotation configurat...

Create Addition Program using Spring MVC

Step1st:-  Create Dynamic Web Project using eclipse step2nd:-  Add Jar file under lib folder web-inf/lib step3rd:-   Create Dispatcher Servlet it should be filename-servlet.xml complete code of dispatcher servlet <?xml version="1.0" encoding="UTF-8"?>  <beans xmlns="http://www.springframework.org/schema/beans"      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"      xmlns:p="http://www.springframework.org/schema/p"      xmlns:context="http://www.springframework.org/schema/context"      xsi:schemaLocation="http://www.springframework.org/schema/beans  http://www.springframework.org/schema/beans/spring-beans-3.0.xsd  http://www.springframework.org/schema/context  http://www.springframework.org/schema/context/spring-context-3.0.xsd">      <context:component-scan base-package="bao"></context:component-scan> ...

Create Simple Interest Program using Bean class in Spring MVC

Step1st:-  Create a dynamic web project and add Dispatcher Servlet under web-inf/scs-servlet.xml <?xml version="1.0" encoding="UTF-8"?>  <beans xmlns="http://www.springframework.org/schema/beans"      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"      xmlns:p="http://www.springframework.org/schema/p"      xmlns:context="http://www.springframework.org/schema/context"      xsi:schemaLocation="http://www.springframework.org/schema/beans  http://www.springframework.org/schema/beans/spring-beans-3.0.xsd  http://www.springframework.org/schema/context  http://www.springframework.org/schema/context/spring-context-3.0.xsd">      <context:component-scan base-package="bao"></context:component-scan>     <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">     <pro...

Spring MVC With Hibernate Example, Hibernate and Spring MVC Tutorials

Step1st:- Create Table:- CREATE TABLE Employee(    EMPID   INT NOT NULL AUTO_INCREMENT,    EMPNAME VARCHAR(20) NOT NULL,    EMPAGE  INT NOT NULL,    SALARY BIGINT NOT NULL,    ADDRESS VARCHAR(20) NOT NULL    PRIMARY KEY (ID) ); Step2nd:-  Create hibernate.cfg.xml Step3rd:-  Add Jar File under lib folder Step4th:-  Create Dispatcher servlet and add it into web.xml step5h:-Create EmployeeBean.java public class EmployeeBean {  private Integer id;  private String name;  private Integer age;  private Long salary;  private String address;  public Long getSalary() {   return salary;  }  public void setSalary(Long salary) {   this.salary = salary;  }  public Integer getId() {   return id;  }  public void setId(Integer id) {   this.id = id;  }  public String getName() {   return nam...

Spring MVC With Hibernate Example, Database connectivity in Spring MVC + Hibernate + MYSQL

Step1s:- Create Database and Table. database name hiberdb and tablename employee(empid,empname,jo) Step2nd:- Create hibernate.cfg.xml:- <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> <hibernate-configuration> <session-factory> <property name="connection.driver_class">com.mysql.jdbc.Driver</property> <property name="connection.url">jdbc:mysql://localhost:3306/hiberdb</property> <property name="connection.username">root</property> <property name="dialect">org.hibernate.dialect.MySQLDialect</property> <mapping class="com.scs.dao.Emp"></mapping> </session-factory> </hibernate-configuration> Step3rd:- Create POJO or BEAN Class under package com.scs.dao packag...

How to use HashTable in Spring MVC Web Application

  Code of  Controller Class:- package bao; import java.util.*; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.ModelAndView; @Controller public class AdditionExample { @RequestMapping("/add") public String loadForm() { return "add"; } @RequestMapping("/addlogic") public ModelAndView addLogic(HttpServletRequest request, HttpServletResponse response) { int a = Integer.parseInt(request.getParameter("txtnum1")); int b = Integer.parseInt(request.getParameter("txtnum2")); Hashtable<String, Integer> ht = new Hashtable<>(); ht.put("num1",a); ht.put("num2",b); Set<Map.Entry<String,Integer>> se = ht.entrySet(); int sum=0; for(Map.Entry<String, Integer> me:se) {...