Sergeonclear

  • Subscribe to our RSS feed.
  • Twitter
  • StumbleUpon
  • Reddit
  • Facebook
  • Digg
Showing posts with label Spring portlet mvc and spring servlet mvc validation. Show all posts
Showing posts with label Spring portlet mvc and spring servlet mvc validation. Show all posts

Wednesday, August 29, 2007

Spring portlet mvc and spring servlet mvc validation

Posted on 11:10 PM by Unknown
Spring mvc is easy to get along with, unless we get the basic flow right. We end up wasting lot of time figuring out the flow of control/binding of errors for validation/etc.

Spring portlet mvc validation
  1. extend AbstractCommandController or SimpleFormController
  2. In case of AbstractCommandController implement the method handleRenderView(req,res,command,errors)
  3. Important thing to note is that you should return the ModelAndView as new ModelAndView(jspPage, errors..getModel());

  • Note the method handleRenderView() is called even if validation fails. Hence we have to return back the command object having errors using errors.getModel().

Spring servlet mvc validation
  • Implemented a simple form controller.
class ManageProfileController extend SimpleFormController
{
public ModelAndView onSubmit(HttpServletRequest request, HttpServletResponse response, Object command, BindException errors) throws Exception
{
Map modelMap = new HashMap();
return new ModelAndView(forwardJSP, modelMap);
}
}

  • The configuration in *-servlet.xml is as below (assume dispatcher servlet is configured already)

<bean id="manageProfileController" class="com.TEST.web2.portlet.controller.common.ManageProfileController">        
<property name="registrationService" ref="registrationService"/>
<property name="formView"><value>common/manageprofile</value></property>
<property name="commandClass"><value>com.TEST.web2.model.DpsUser</value></property>
<property name="validator" ><ref bean="userValidator"/></property>
<property name="successView"><value>common/manageprofile</value></property>

</bean>

  • On validation error, in servlet mvc, the onSubmit() is not called and the command object is available with errors.

  • To extract the errors in JSP use:


<spring:bind path="command.confirmPassword">

<c:out value="${status.expression}"/> <input name=confirmPassword type="password" style="width:200px; " onKeyUp="document.getElementById('cpw').value=this.value" value="<c:out value="${status.value}"/>">
<font > <c:out value="${status.errorMessage}"/> </font>

</spring:bind>
Read More
Posted in Spring portlet mvc and spring servlet mvc validation | No comments
Older Posts Home
Subscribe to: Posts (Atom)

Popular Posts

  • Texter - An auto text expander
    I just cant imagine how many times I would have typed the same sentence again and again... Texter to the rescue.... thanks to  Adam Pash !! ...
  • setting up a static ip with SKY broadband
    Setting up a static ip on SKY broadband log into the router Navigate to LAN IP SET UP under advanced settings. Click add under address reser...
  • Liferay CMS/ web content management/ workflow/ staging
    Liferay out of the box has a web content management system. The web pages can mostly have these web content (articles) as web pages. The web...
  • Batch script to load developer environment
    Wrote a simple windows bat script to start my project work environment. This would save me 4 + 2 + 3 + 2+2 = 14 mouse clicks 4+2 + 5 = ...
  • Windows AntiSpyware Solution Virus Removal - How to Get Rid Of Windows AntiSpyware Solution
    Windows Anti Spyware Solutions is one of the rogue anti-virus bendable articles marketed by affected Microsoft Security Essentials alert. Th...
  • Oracle fix for schema table prefix and running scripts from sql developer
    In oracle it appears like a NON_OWNER user though granted access(select, insert, delete, update) to tables created by OWNER of the table ca...
  • XSLT caching Transformers
     The usage of cached transformer objects is recommended here A sample implementation of CachingTransformerFactory is here The above code abs...
  • Gods Debris By Scott Adams
    For a change have been reading a novel called  Gods Debris by Scott Adams(creator of Dilbert comics).  It has no plot as such but an exchang...
  • Drools - Java Rules engine
    An implementation of JSR 94  spec. More here
  • Webdriver with Lift
    A briefing on webdriver is here : Applying lift makes tests more readable: LiFT allows writing automated tests in a style that makes them ve...

Categories

  • AJAX javascript
  • All about UK Visa HSMP VS H1
  • All about UK Visa HSMP VS H1 hsmp assistance
  • amazon
  • android apps ship control radio hindi
  • Apache 2.x setup Quick guide for Linux
  • apache commons configurator usage
  • apache commons usage
  • arsenals for developers
  • article
  • Batch script to load developer environment
  • Blind folded chess
  • Castor castor convert dtd to xsd
  • cloud comparision price
  • cloud comparison blog
  • cloud computing monthly price
  • cloud usage
  • Cobertura- junit coverage tool
  • Code generators
  • cron jobs expressions
  • cruisecontrol cruise control
  • debugging eclipse tips
  • developer tools
  • document library
  • easy mock jmock vs mocking java tdd
  • External Javascript from Java Servlets
  • fedora 9 lenovo 3000 n200 windows xp dual boot problem
  • Fire fox plugins and tweaks
  • Free PHP hosting
  • gods debris the religion war scott adams dilbert
  • google app engine
  • gwt javascript
  • hibernate second level cache
  • i18n locale localization internationalization spring liferay portlet locale
  • ibatis sybase mapping
  • image gallery
  • iphone apps bri8 apple
  • iphone shsh 3gs ipsw downgrade ifaith tinyumbrella ios5.1.1 to ios5.0
  • java
  • java JDBC
  • javascript junit testing
  • Javascript trouble shooting tool
  • Jboss overview
  • jmeter load testing custom java sampler javasamplerclient xml test
  • JNDI test JSP page
  • Joomla CMS
  • JProfiler setup jprofiler on linux
  • jquery IE AJAX issues
  • jquery spring AJAX
  • keyboard music java typing soothing notes auto suggest
  • liferay kids version
  • liferay web 2.0 java/j2ee
  • linux - the difference between hard and soft links
  • linux mysql
  • linux mysql setup quick start
  • Linux ssh autologin with putty
  • LINUX usefuls
  • linux)
  • LinuxPerformance Tuning(apache
  • log4j setup useful
  • lucene solr
  • mac m701 android skype not working crash
  • maven
  • maven cut reduce build time
  • microsoft ODBC oracle dll connection issues
  • Mobile Ad Services (adwhirl)
  • opsourcecloud
  • oracle connect by hierarchy
  • oracle table previlege
  • Oracle thin vs OCI(type II/thick) drivers
  • pdf 2 text
  • Pega PRPC
  • php
  • rackspacecloud
  • Rewrite rules in apache and IIS
  • scaffold
  • setting up a static ip on SKY broadband
  • setup quick start
  • Single Sign on - OpenSSO with Liferay
  • smart gwt
  • smtp email test mock server james
  • SMTP MAIL telnet windows
  • Software tools mind map freemind j2ee tools
  • Speed typing tips.
  • Spring + Hibernate Usefuls BaseDAOHibernate
  • Spring annotations with spring-mock not working 2.0 2.5.6
  • spring jndi datasource lookup
  • Spring portlet mvc and spring servlet mvc validation
  • Spyware trojan and virus removal tools
  • struts magic
  • SVN/ Subversion Tips and traps
  • tabbed ms dos console cygwin console
  • Texter - An auto text expander autotyper
  • Textpad tricks
  • The art of debugging
  • tomcat
  • Tomcat Exploded war - cut deployment time
  • Tomcat on linux tips
  • Tomcat on linux tips commands
  • TypeIt4Me
  • Typinator
  • Useful Eclipse Plugins
  • Useful Eclipse Plugins eclipse shortcuts keys
  • Useful tools
  • web content
  • xcode cocos2d iphone box2d
  • xpath xml xquery

Blog Archive

  • ▼  2013 (19)
    • ▼  August (17)
      • Free Anti-Virus Programs - Quite Powerful To Safeg...
      • Anti Virus and Anti Spyware Software - How to Choo...
      • Windows AntiSpyware Solution Virus Removal - How t...
      • Recommended Anti-Spyware & Virus Program
      • How To Remove Fake Anti-Virus Programs From Your C...
      • The Best Anti-Spyware and Anti-Virus Still Can't P...
      • The Best Anti Virus Spyware Removers
      • Free Spyware Anti Virus Software Download from Google
      • Viruses and Anti-Virus Programs
      • Top 5 Anti Virus Software Packages Review - Spywar...
      • Adware, Spyware, Anti-Virus Software - Beware
      • Best Anti Virus Software Reviews - Anti Spyware Sc...
      • Anti Virus Software, Anti Spyware and Registry Cle...
      • Firewall, Anti-Virus and Anti-Spyware Programs - 3...
      • The Actual Difference Associated With Adware, Spyw...
      • Anti Spyware Anti Virus Protection Software Review
      • Way to make Your Computer Software In Tip Top Cond...
    • ►  July (1)
    • ►  January (1)
  • ►  2012 (7)
    • ►  August (1)
    • ►  June (4)
    • ►  April (2)
  • ►  2011 (20)
    • ►  November (1)
    • ►  October (1)
    • ►  August (1)
    • ►  July (3)
    • ►  June (1)
    • ►  April (2)
    • ►  March (4)
    • ►  February (1)
    • ►  January (6)
  • ►  2010 (27)
    • ►  December (3)
    • ►  July (2)
    • ►  May (3)
    • ►  April (2)
    • ►  March (5)
    • ►  February (10)
    • ►  January (2)
  • ►  2009 (32)
    • ►  December (5)
    • ►  November (2)
    • ►  September (3)
    • ►  August (6)
    • ►  June (4)
    • ►  May (4)
    • ►  April (3)
    • ►  March (2)
    • ►  February (3)
  • ►  2008 (28)
    • ►  December (1)
    • ►  October (2)
    • ►  September (2)
    • ►  August (4)
    • ►  July (7)
    • ►  June (1)
    • ►  April (2)
    • ►  March (2)
    • ►  February (2)
    • ►  January (5)
  • ►  2007 (24)
    • ►  December (3)
    • ►  November (2)
    • ►  October (6)
    • ►  September (1)
    • ►  August (3)
    • ►  July (8)
    • ►  June (1)
Powered by Blogger.

About Me

Unknown
View my complete profile