I want to apply validation on my program.But i am failure to do that.I have followed all the rules for validation still I am unable to solve the problem. please kindly help me.. I describe my program below.. CreateGroup.jsp
<%@ page language="java" pageEncoding="ISO-8859-1"%>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %> <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %> <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> <%@ taglib uri="/WEB-INF/struts-template.tld" prefix="template" %> <%@ taglib uri="/WEB-INF/struts-nested.tld" prefix="nested" %>
<title>Crowdperks - Create Group</title> <link href="../../style/crowdperks.css" rel="stylesheet" type="text/css" /> <link href="../../style/font-face.css" rel="stylesheet" type="text/css" /> <link href="../../style/jquery.wysiwyg.css" rel="stylesheet" type="text/css" /> <script src="../../js/custom-form-elements.js" type="text/javascript"></script> <script src="../../js/jquery.js" type="text/javascript"></script> <script src="../../js/popup.js" type="text/javascript"></script> </head>
<div id="bgcontainer"> <!--START Menu --> <div class="menu"> <%@ include file="../common/UpMenu.jsp"%> <div class="clr"></div> </div> <!--END Menu --> <!--START Top Search --> <div class="topsearch"> <html:text property="name" styleClass="search" value="Item Description/ Name"/> <select name="1" class="styled_19" style="margin-right:8px;" > <option selected="selected" value="1">Interests</option> </select> <html:text property="name1" styleClass="search" value=""/> <html:link page="#"><img src="../../images/btn_search-group.jpg" border="0" align="absmiddle" /></html:link> </div> <!--END Top Search --> <!--START body --> <div class="body_resize"> <div class="body"> <div class="bodymiddle"> <div class="bodysearch"> <div class="columnA"> <h2>Create Group</h2> <div class="bg"></div> <div class="fields"> <html:errors/> <html:form action="/createGroup.do?method=insert" method="post" enctype="multipart/form-data"> <p><i><b>Display all error messages:</b></i><br/> <html:messages id="errors" ><bean:write name="errors"/><br/></html:messages></p> <p class="sep"><label class="small"><bean:message key="label.name"/></label> <html:text property="GROUP_NAME" styleClass="sText" ></html:text></p> <p class="sep"><label class="small" for="select01"><bean:message key="label.description"/></label> <html:text property="DESCRIPTION" styleClass="sText" ></html:text></p> <p class="sep"><label class="small" for="select01"><bean:message key="label.title"/></label> <html:text property="GROUP_TITLE" styleClass="sText" ></html:text></p> <p class="sep"><label class="textl" for="select01"><bean:message key="label.interest"/></label> <html:select property="interests" size="3" name="createGroupForm" multiple="true" styleClass="multipleselect"> <logic:iterate id="userMasterInterestBean" property="userMasterInterestBeanList" name="createGroupForm" scope="request"> <html:option value="<%=""+((UserMasterInterestBean)userMasterInterestBean).getInterestId()%>"><%=""+((UserMasterInterestBean)userMasterInterestBean).getDescription()%></html:option> </logic:iterate> </html:select> </p> <p class="sep"><label class="small" for="select01"><bean:message key="label.image"/></label><html:file property="theFile" styleClass="upload_field" size="30/"></html:file></p> <p class="sep"><label class="small" for="select01"><bean:message key="label.size"/></label> <html:text property="GROUP_SIZE" styleClass="sText" ></html:text></p> <p class="sep"><label class="small" for="select01"><bean:message key="label.status"/> </label> <html:select property="status" size="3" name="createGroupForm" multiple="true"> <logic:iterate id="statusMasterBean" property="statusMasterBeanList" name="createGroupForm" scope="request"> <html:option value="<%=""+((StatusMasterBean)statusMasterBean).getSTATUS_ID()%>"><%=""+((StatusMasterBean)statusMasterBean).getDESCRIPTION()%></html:option> </logic:iterate> </html:select> </p> <p class="sep"><label class="small" for="select01"><bean:message key="label.post"/></label> <textarea name="GROUP_POST" class="wysiwyg"></textarea></p> <p style="padding-top:20px;"> <form action="contact.php" method="post" id="contactform" class="block_content"> <ul> <li><label for="Post">post</label></li> <div class="wysiwyg" > <ul role="menu" style="float:left;" class="panel"> <li><a title="Bold" class="bold" role="menuitem" tabindex="-1" href="javascript:;">bold</a></li> <li><a title="Italic" class="italic" role="menuitem" tabindex="-1" href="javascript:;">italic</a></li> <li><a title="Strike-through" class="strikeThrough" role="menuitem" tabindex="-1" href="javascript:;">strikeThrough</a></li> <li><a title="Underline" class="underline" role="menuitem" tabindex="-1" href="javascript:;">underline</a></li> <li role="separator" class="separator"></li> <li><a title="Justify Left" class="justifyLeft" role="menuitem" tabindex="-1" href="javascript:;">justifyLeft</a></li> <li><a title="Justify Center" class="justifyCenter" role="menuitem" tabindex="-1" href="javascript:;">justifyCenter</a></li> <li><a title="Justify Right" class="justifyRight" role="menuitem" tabindex="-1" href="javascript:;">justifyRight</a></li> <li><a title="Justify Full" class="justifyFull" role="menuitem" tabindex="-1" href="javascript:;">justifyFull</a></li> <li role="separator" class="separator"></li> <li><a title="Indent" class="indent" role="menuitem" tabindex="-1" href="javascript:;">indent</a></li> <li><a title="Outdent" class="outdent" role="menuitem" tabindex="-1" href="javascript:;">outdent</a></li> <li><a title="Subscript" class="subscript" role="menuitem" tabindex="-1" href="javascript:;">subscript</a></li> <li><a title="Superscript" class="superscript" role="menuitem" tabindex="-1" href="javascript:;">superscript</a></li> <li role="separator" class="separator"></li><li><a title="Undo" class="undo" role="menuitem" tabindex="-1" href="javascript:;">undo</a></li> <li><a title="Redo" class="redo" role="menuitem" tabindex="-1" href="javascript:;">redo</a></li> <li role="separator" class="separator"></li> <li><a title="Insert Ordered List" class="insertOrderedList" role="menuitem" tabindex="-1" href="javascript:;">insertOrderedList</a></li> <li><a title="Insert Unordered List" class="insertUnorderedList" role="menuitem" tabindex="-1" href="javascript:;">insertUnorderedList</a></li> <li><a title="Insert Horizontal Rule" class="insertHorizontalRule" role="menuitem" tabindex="-1" href="javascript:;">insertHorizontalRule</a></li> <li role="separator" class="separator"></li> <li><a title="Create link" class="createLink" role="menuitem" tabindex="-1" href="javascript:;">createLink</a></li> <li><a title="Insert image" class="insertImage" role="menuitem" tabindex="-1" href="javascript:;">insertImage</a></li> <li role="separator" class="separator"></li> <li><a title="Header 1" class="h1" role="menuitem" tabindex="-1" href="javascript:;">h1</a></li> <li><a title="Header 2" class="h2" role="menuitem" tabindex="-1" href="javascript:;">h2</a></li> <li><a title="Header 3" class="h3" role="menuitem" tabindex="-1" href="javascript:;">h3</a></li> <li role="separator" class="separator"></li> <li><a title="Remove formatting" class="removeFormat" role="menuitem" tabindex="-1" href="javascript:;">removeFormat</a></li> </ul> <div style="clear: both;"><!-- --></div> <iframe tabindex="0" id="IFrame" style="min-height: 134px; width: 609px;" src="javascript:false;" frameborder="0"></iframe> </div> <textarea style="display:none;" class="wysiwyg"></textarea> <div id="header"> <ul> <li><a href="#">Publish</a><br></li> <li> <html:submit value="Save"></html:submit></li> </ul> </div> <br><br></li> </ul> </form> <tr> <td class="contact"> </tr> </html:form> </div> </div> <div class="columnB"> <%@ include file="../common/RightSideMenu.jsp"%> </div> <div class="clr"></div> </div> </div> </div> </div> </div>
<%@ include file="../common/footer.jsp"%>
CreateGroupForm.java /* * Generated by MyEclipse Struts * Template path: templates/java/JavaClass.vtl */ package com.Crowdperks.Customer.formBean;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionError; import org.apache.struts.action.ActionErrors; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionMapping; import org.apache.struts.upload.FormFile; import org.apache.struts.validator.ValidatorForm;
import com.Crowdperks.models.InterestIdBean; import com.Crowdperks.models.StatusMasterBean; import com.Crowdperks.models.UserMasterInterestBean;
public class CreateGroupForm extends ValidatorForm{
private int GROUP_ID; private String DESCRIPTION; private int DELETED; private String GROUP_NAME; private int GROUP_INTEREST; private String filePath; private int GROUP_SIZE; private String GROUP_TITLE; private String GROUP_POST; private int GROUP_STATUS; private String interests; private int interestId; private int status; private String fileName; private String statusDesc; private String itemGroupName; List<InterestIdBean> interestIdBeanList; InterestIdBean interestIdBean; List<UserMasterInterestBean> userMasterInterestBeanList; UserMasterInterestBean userMasterInterestBean; List<StatusMasterBean> statusMasterBeanList; StatusMasterBean statusMasterBean; public int getInterestId() { return interestId; } public void setInterestId(int interestId) { this.interestId = interestId; } public String getItemGroupName() { return itemGroupName; } public void setItemGroupName(String itemGroupName) { this.itemGroupName = itemGroupName; } public String getStatusDesc() { return statusDesc; } public void setStatusDesc(String statusDesc) { this.statusDesc = statusDesc; } public String getFileName() { return fileName; } public void setFileName(String fileName) { this.fileName = fileName; } private FormFile theFile; public List<InterestIdBean> getInterestIdBeanList() { return interestIdBeanList; } public void setInterestIdBeanList(List<InterestIdBean> interestIdBeanList) { this.interestIdBeanList = interestIdBeanList; } public InterestIdBean getInterestIdBean() { return interestIdBean; } public void setInterestIdBean(InterestIdBean interestIdBean) { this.interestIdBean = interestIdBean; } public FormFile getTheFile() { return theFile; } public void setTheFile(FormFile theFile) { this.theFile = theFile; } public String getInterests() { return interests; } public void setInterests(String interests) { this.interests = interests; } public List<StatusMasterBean> getStatusMasterBeanList() { return statusMasterBeanList; } public void setStatusMasterBeanList(List<StatusMasterBean> statusMasterBeanList) { this.statusMasterBeanList = statusMasterBeanList; } public int getStatus() { return status; } public void setStatus(int status) { this.status = status; } public StatusMasterBean getStatusMasterBean() { System.out.println("insde get statusmastre bean"); return statusMasterBean; } public void setStatusMasterBean(StatusMasterBean statusMasterBean) { System.out.println("inside setstatusmasterbean"); this.statusMasterBean = statusMasterBean; } public List<UserMasterInterestBean> getUserMasterInterestBeanList() { return userMasterInterestBeanList; } public void setUserMasterInterestBeanList( List<UserMasterInterestBean> userMasterInterestBeanList) { System.out.println("inside userinterestmasterbeanList"); this.userMasterInterestBeanList = userMasterInterestBeanList; } public UserMasterInterestBean getUserMasterInterestBean() { return userMasterInterestBean; } public void setUserMasterInterestBean( UserMasterInterestBean userMasterInterestBean) { System.out.println("userInterestmasterbean"); this.userMasterInterestBean = userMasterInterestBean; } public int getGROUP_ID() { return GROUP_ID; } public void setGROUP_ID(int gROUPID) { GROUP_ID = gROUPID; } public String getDESCRIPTION() { return DESCRIPTION; } public void setDESCRIPTION(String dESCRIPTION) { DESCRIPTION = dESCRIPTION; } public int getDELETED() { return DELETED; } public void setDELETED(int dELETED) { DELETED = dELETED; } public String getGROUP_NAME() { return GROUP_NAME; } public void setGROUP_NAME(String gROUPNAME) { GROUP_NAME = gROUPNAME; } public int getGROUP_INTEREST() { return GROUP_INTEREST; } public void setGROUP_INTEREST(int gROUPINTEREST) { GROUP_INTEREST = gROUPINTEREST; } public String getFilePath() { return filePath; } public void setFilePath(String filePath) { this.filePath = filePath; } public int getGROUP_SIZE() { return GROUP_SIZE; } public void setGROUP_SIZE(int gROUPSIZE) { GROUP_SIZE = gROUPSIZE; } public String getGROUP_TITLE() { return GROUP_TITLE; } public void setGROUP_TITLE(String gROUPTITLE) { GROUP_TITLE = gROUPTITLE; } public String getGROUP_POST() { return GROUP_POST; } public void setGROUP_POST(String gROUPPOST) { GROUP_POST = gROUPPOST; } public int getGROUP_STATUS() { return GROUP_STATUS; } public void setGROUP_STATUS(int gROUPSTATUS) { GROUP_STATUS = gROUPSTATUS; } public void reset(ActionMapping mapping, HttpServletRequest request) { // reset properties GROUP_NAME = ""; DESCRIPTION=""; GROUP_SIZE = 0; GROUP_TITLE=""; GROUP_POST=""; }
}
validation.xml
Ads