Home Tutorialhelp Comment Example of validation by annotation + modeldriven

 
 

Comment

pinki
Example of validation by annotation + modeldriven,
September 19, 2008 at 9:00 PM

@Validation public class PostItemAction extends BaseAction { //here BaseAction extends ActionSupport implements ModelDriven, ServletResponseAware, ServletRequestAware @Validations( requiredStrings={ @RequiredStringValidator(type = ValidatorType.SIMPLE, fieldName = "item.itemName", message = "", key = "errorItemNameRequired"), @RequiredStringValidator(type = ValidatorType.SIMPLE, fieldName = "item.itemdescription", message = "", key= "errorItemDescriptionRequired"), @RequiredStringValidator(type = ValidatorType.SIMPLE, fieldName = "amount", message = "", key= "errorStartPriceRequired") } ) public String sellItem() throws IOException{ return SUCCESS; } } ------------------ Here item.itemName--> item is object of ItemVO.java (simple pojo or talking to db..) itemName is field of ItemVo --------------------- key -->errorItemNameRequired-->you have in Resource file --------- JSP contains .. something like <s:form action="PostItemAction_sellItem"> <s:textfield name="item.itemName" /> <s:textfield name="item.itemdescription" /> <s:datetimepicker name="item.startDate" /> </s:form> --------- strust.xml-->entry <action name="PostItemAction_*" method="{1}" class="com.action.PostItemAction"> <result>/item/yourother.jsp</result> </action>
View All Comments | View Tutorial
Advertisement
Related Tutorial and Articles
Struts and Hibernate Integration Tutorial

Hibernate criteria example using struts2
Hibernate criteria example using struts2 This hibernate criteria example using struts2 is used for defining the basics of criteria. The hibernate criteria... create query without HQL. In this hibernate criteria example using struts2, we 

Struts 2 Tutorials

How to create pdf file in struts2.
How to create pdf file in struts2. In this example, you will see the how to create PDF in struts, and how to write message in generated PDF file in struts2...;%@taglib uri="/struts-tags" prefix="s" 

Struts 2 Tutorials

Introduction to ModelDriven interface with example
Model Driven Interface With Example Model driven interface is an Action... ActionSupport class and also implement the ModelDriven interface... into the value stack instead of action itself. An example given below illustrates 

Struts 2 Tutorials

Struts 2.2.1 - Struts 2.2.1 Tutorial
Validators Login form validation example Struts 2.2.1 Tags Type... Struts 2 hello world application using annotation Running and testing the example Advance Struts Action Struts Action 

Struts 2 Tutorials

Interceptors in Struts 2
. In Struts 2 interceptors perform multiple tasks including Logging, Validation... of Struts making it more users friendly and efficient. Though, Struts2 comprises... action of interceptor in Struts 2 application like validation, exception handling 

Struts 2 Tutorials

Struts 2 Tutorials - Struts version 2.3.15.1
IDE Hello World application annotation version Struts 2 in Agile Development... in Struts 2 with example code Struts 2 Development mode - Learn about... of ModelDriven interface Struts 2 Interceptors: Interceptors can be configured 

Struts 2 Tutorials

Skinning example in Struts 2.2.1
Skinning example in Struts 2.2.1 An example of Skinning is given below...;%@ taglib prefix="s" uri="/struts-tags"%> <s:head/>...="/struts-tags" %> <html> <head> <title>Home 

Struts-Tutorials

advancestrutsactionclasses.htm
the advance action classes in struts framework implements ModelDriven interface...Struts Advance Action Classes Actually configuration in struts.xml file is very important, because the struts2 framework does a lots of work easily 

Struts 2 Tutorials

Struts 2 Interceptors
Struts 2 Interceptors Struts 2 framework relies upon Interceptors to do most... part of Struts 2 default stack and are executed in a specific order.... Model Driven Interceptor modelDriven Whenever 

Struts 2 Tutorials

Mailing Application in Struts2.2.1
;);     Transport.send(msg); An example for sending an email in struts...Mailing Application in Struts2.2.1 A Mailing application in struts is given... on the local SMTP server. To run this example you fist need to install and run the SMTP 

Struts 2 Tutorials

Writing Actions
an application. You can make any java class as action. But struts have some... using struts you can either user Action interface or use ActionSupport class... in action class you either you may use ModelDriven interface or simply define 

Struts 2 Tutorials

Struts2.2.1 and hibernate integration application
implements ModelDriven { private AddInformation obAddInfo; private List 

Advertisements Advertisements
 

 

 

DMCA.com