Skip to main content

Spring MVC



spring mvc framework is based on model - view - controller design pattern which separates the application logic in to 3 layers.

dispatcher servlet - intercepts all the incoming requests to the application and consults handler mapping to distinguish the controller to be used.

handler mapping - is responsible for finding out the controller who can handle the incoming request. mapping of requested url and the controller class method is done by xml configuration or annotations.

controller - controller will directly use the application classes to process the business request and attach the output to a model. the model will be sent to the view to render. view resolver will take of identifying the view to be rendered.

view resolver - will find the physical file to be rendered from the logical file name sent by the controller.

view - are physical files which can be jsp, velocity template etc.

web.xml - is the web deployment descriptor. declares the contextloaderListner and dispatcherServlet with root-context.xml and servlet-context.xml. it specifies a url mapping for requests to be handled by dispatcher servlet.


 root-context.xml - is loaded upon application startup by springs contextloadlistner class. specifies configuration for root spring container which will be shared by all the servlets and filters.

servlet-context.xml -

is loaded by dispatcher servlet. configurations in the servlet-context.xml is used by dispatcher servlet for all the request coming.
few configurations:
annotation driver - annotations or xml
resources mapping - maps static resourses like images, css which donot have to go through controllers.
internalresoursesviewresolver - tells the view resolver how to get the physical view name from logical name.

context:component-scan - packages to be scanned when using annotation based strategy.


Controller

@controller - specifies the class is a spring controller.
@RequestMapping - species the url to be handled by the method



Ref
http://www.codejava.net/frameworks/spring/spring-mvc-beginner-tutorial-with-spring-tool-suite-ide


Comments

Popular posts from this blog

Oracle Database 12c installation on Ubuntu 16.04

This article describes how to install Oracle 12c 64bit database on Ubuntu 16.04 64bit. Download software  Download the Oracle software from OTN or MOS or get a downloaded zip file. OTN: Oracle Database 12c Release 1 (12.1.0.2) Software (64-bit). edelivery: Oracle Database 12c Release 1 (12.1.0.2) Software (64-bit)   Unpacking  You should have following two files downloaded now. linuxamd64_12102_database_1of2.zip linuxamd64_12102_database_2of2.zip Unzip and copy them to \tmp\databases NOTE: you might have to merge two unzipped folders to create a single folder. Create new groups and users Open a terminal and execute following commands. you might need root permission. groupadd -g 502 oinstall groupadd -g 503 dba groupadd -g 504 oper groupadd -g 505 asmadmin Now create the oracle user useradd -u 502 -g oinstall -G dba,asmadmin,oper -s /bin/bash -m oracle You will prompt to set to password. set a momorable password and write it down. ...

DBCA : No Protocol specified

when trying to execute dbca from linux terminal got this error message. now execute the command xhost, you probably receiving No protocol specified xhost:  unable to open display ":0" issue is your user is not allowed to access the x server. You can use xhost to limit access for X server for security reasons. probably you are logged in as oracle user. switch back to default user and execute xhost again. you should see something like SI:localuser:nuwan solution is adding the oracle to access control list xhost +SI:localuser:oracle now go back to oracle user and try dbca it should be working

Slow CPU after resume / Ubuntu 16.04 LTS too slow after suspend and resume

you might experience a slow performance in ubuntu 16.04 after resuming back from a sleep or hibernate. reason for this is it doesn't move away from powersave mode automatically. intel_pstate driver is the one making this problem, so we have to disable it and use acpi-cpufreq  driver. first lets check weather your competer is on powersave.  cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor If your answer is powersave we have to move it to performance state. get your cpu info by cat /proc/cpuinfo | grep MHz  probabaly you seeing 4 cores lets update scaling governers     echo 'performance' > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor     echo 'performance' > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor     echo 'performance' > /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor     echo 'performance' > /sys/devices/system/cpu/cpu3/cpufreq/scaling_g...