struts validation


struts validation

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"%> <%@page import="com.Crowdperks.Customer.formBean.CreateGroupForm"%> <%@ include file="../common/header.jsp"%>

<%@ 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>


<div id="bgcontainer">
<!--START Menu -->
    <div class="menu">
        <%@ include file="../common/UpMenu.jsp"%>
    <div class="clr"></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>
        <html:text property="name1" styleClass="search" value=""/>
        <html:link page="#"><img src="../../images/btn_search-group.jpg" border="0" align="absmiddle" /></html:link>


    <!--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:form action="/" 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>
                            <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>
                            <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>

                            <p class="sep"><label class="small" for="select01"><bean:message key=""/></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">

                                        <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>
                                                <div style="clear: both;"><!-- --></div>
                                                <iframe tabindex="0" id="IFrame" style="min-height: 134px; width: 609px;" src="javascript:false;" frameborder="0"></iframe>

                                            <textarea style="display:none;" class="wysiwyg"></textarea>
                                            <div id="header">

                                        <li><a href="#">Publish</a><br></li>

                                        <li> <html:submit value="Save"></html:submit></li>

                         <td class="contact">



                    <div class="columnB">
                        <%@ include file="../common/RightSideMenu.jsp"%>
                    <div class="clr"></div>

<%@ include file="../common/footer.jsp"%> /* * 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) {
    this.userMasterInterestBean = userMasterInterestBean;

public int getGROUP_ID() {
    return GROUP_ID;

public void setGROUP_ID(int gROUPID) {

public String getDESCRIPTION() {
    return DESCRIPTION;

public void setDESCRIPTION(String dESCRIPTION) {

public int getDELETED() {
    return DELETED;

public void setDELETED(int dELETED) {

public String getGROUP_NAME() {
    return GROUP_NAME;

public void setGROUP_NAME(String gROUPNAME) {

public int getGROUP_INTEREST() {
    return GROUP_INTEREST;

public void setGROUP_INTEREST(int 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) {

public String getGROUP_TITLE() {
    return GROUP_TITLE;

public void setGROUP_TITLE(String gROUPTITLE) {

public String getGROUP_POST() {
    return GROUP_POST;

public void setGROUP_POST(String gROUPPOST) {

public int getGROUP_STATUS() {
    return GROUP_STATUS;

public void setGROUP_STATUS(int gROUPSTATUS) {

public void reset(ActionMapping mapping, HttpServletRequest request) {

    // reset properties

    GROUP_NAME = "";
    GROUP_SIZE = 0;




mask ^[a-zA-Z]*$ min 1 max 125

    <field property="GROUP_TITLE" depends="required">
        <msg name="required"  key="errors.required" />

     <field property="GROUP_POST" depends="required">
        <msg name="required" key="errors.required" />





type="com.Crowdperks.Customer.formBean.CreateGroupForm" />

  <forward name="create" path="/jsp/Customer/CreateGroup.jsp" />
  <forward name="insert" path="/jsp/Customer/GroupHomePage3.jsp" />


If i have done any mistake please aware me..

View Answers


Related Tutorials/Questions & Answers:
Struts 2 - Validation - Struts
Struts 2 - Validation annotations  digging for a simple struts 2 validation annotations example
Struts validation
Struts validation  I want to put validation rules on my project.But... validation rules,put the plugins inside strutsconfig.xml, put the html:errors tag... that violate the rules for struts automatic validation.So how I get the solution
struts validation
struts validation  Sir i am getting stucked how to validate struts using action forms, the field vechicleNo should not be null and it should...://
struts validation
struts validation  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...;%@ include file="../common/header.jsp"%> <%@ taglib uri="/WEB-INF/struts
struts validation
struts validation  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...;%@ include file="../common/header.jsp"%> <%@ taglib uri="/WEB-INF/struts
validation - Struts
validation  Hi Deepak can you please tell me about struts validations perticularly on server side such as how they work whats their role etc.? thank you
what is custom validation in struts
what is custom validation in struts  what is custom validatons in struts
struts client side validation
struts client side validation  how can i code for client side validation
server side validation in struts
server side validation in struts  Hello sir, i want to do server side validation in struts based on 3 fields. those 3 field are BatchNo,LotNo,StepNo.Here we can have the same batchno,lotno for different forms
Struts 2 Validation
Struts 2 Validation  Hello,I have been learning struts. I have a problem in the validator tag. I have tried tutorials and got those. I have to add the Users to the database. So, have implemented the code. See attachement
Struts validation for j-query tabs data
Struts validation for j-query tabs data  Hi, I want apply struts validation for J-query tabs data while saving into database, can any body tell please
Struts 2 Validation (Int Validator)
Struts 2 Validation (Int Validator)       Struts 2 Framework provides in-built validation functions to validate user.... This section discusses all the validation functions available with Struts 2
struts   Hi how struts flows from jsp page to databae and also using validation ? Thanks Kalins Naik
STRUTS   Validation: user entered as 123.34567 I want the value as 123.34 once the user submits. How you will validate
validation  validation
code.Ok if you use struts then you can use Validation method valid the in put... madu dil, Can you please add code.Ok if you use struts then you can use Validation method valid the in put. otherwise call the javascript onsubmit to check
validation  we are doing payroll system project in java.So pls provide the complete validation code for employee master form
validation.....  hi.......... thanks for ur reply for validation code. but i want a very simple code in java swings where user is allowed to enter only numerical values in textbox , if he enters string values then it should
Struts  what is SwitchAction in struts
Struts  how to learn struts
STRUTS   Request context in struts? SendRedirect () and forward how to configure in struts-config.xml
validation query
validation query  where I should kept properties file inside struts Web application
); JLabel label=new JLabel("JTable validation Example",JLabel.CENTER); JPanel panel=new JPanel(); panel.add(scroll); JFrame frame=new JFrame("JTable validation
Struts Login Validation. In This code setter of login page is called only one time again it doesnt call it. Why..?
Struts Login Validation. In This code setter of login page is called only one...="1.0" encoding="UTF-8" ?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "
:checkbox path="community" value="Struts" label="Struts" /><
validation  please help me to check validation for <form> <table class="form"> <tr> <td class="col1"> <label>Sno:</label> </td> <td
struts  in industry, struts 1 and struts 2. which is the best? which is useful as a professuional   Have a look at the following link: Struts Tutorials
Struts  Tell me good struts manual
struts  what are the 4 methods of struts framework