Share on Google+Share on Google+

Nibedita Pattnaik
struts validation
0 Answer(s)      5 years and 9 months ago
Posted in : Struts

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"%> <[email protected] 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:
Validation - Struts
Validation  what is the best way to use validation in Struts?either "validation.xml" or JavaScript
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  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
struts validation problem - Struts
struts validation problem  i used client side validation in struts 2 .but message will display only on the top of the component.i want to display.../struts/struts2/
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...://
Validation - Struts
Validation  How can i use validation framework i don't understand am...; Hi friend, Phone validation using javaScript function... return true; } Phone Validation
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
validation - Struts
information, Thanks
Regarding struts validation - Struts
Regarding struts validation  how to validate mobile number field should have 10 digits and should be start with 9 in struts validation?  Hi... ------------------------------------------------------------- For more information :
what is custom validation in struts
what is custom validation in struts  what is custom validatons in struts
Struts Validation - Struts
Struts Validation  Hi friends.....will any one guide me to use the struts validator...   Hi Friend, Please visit the following links: http
validation problem in struts - Struts
validation problem in struts  hi friends... m working on one project using struts framework. so i made a user login form for user authentication. nd i write d code for sql connection and user athunetication in d action class
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 validation not work properly - Struts
Struts validation not work properly  hi... i have a problem with my struts validation framework. i using struts 1.0... i have 2 page which... add.jsp (form). in this add.jsp i have several fields which requires some validation
Struts2 Validation Problem - Struts
Struts2 Validation Problem  Hi, How to validate field... in the browser having the example of handling the error in struts 2. http... information on Struts 2 visit to :
validation problem - Struts
validation problem  i want to create validation class for each action class bot project structure as i create a bean differnt and in action class i... is that in which name i create my validation xml file on bean name or action class name i also
validation message - Struts
validation message  sir, i took help of that example but in that we change only color of the message i want to shift the place of the error message.means all messages are put together at top of the form
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
validation using validator-rules.xml - Struts
validation using validator-rules.xml  Hi I am trying to validate my form using Validator-rules.xml. I am using Eclipse 3.0 Struts 1.1 and Tomcat... struts-config.xml
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
java struts validation - Java Server Faces Questions
java struts validation  i m unable to execute a validation page by struts . so please write u program and create a rar/jar file having all program with procedure and sand me . pls........ i m using bea weblogic 8.1 . my mail
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 2 Validation Example
Struts 2 Validation Example      ... the form validation code in Struts 2 very easily. We will add the form validation... will see how to generate client side validation code). The Struts 2 validation
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
); JLabel label=new JLabel("JTable validation Example",JLabel.CENTER); JPanel panel=new JPanel(); panel.add(scroll); JFrame frame=new JFrame("JTable validation
Java Spring Hibernate Struts Training Dynamic tabs in struts 1.2 Unable to upload a file to mysql database using struts1 Pagination in struts 2 struts2 filterdispatcher is deprecated please use the new filters viewing How to add struts2 dependency in Maven? Struts Exception Handling can you check below code if any erors multimedia how to display the value of termcell name in label class not found exception Where to learn Struts 2? dropdown cacheing Upload and Download Large files in jsp What is Struts 2 framework struts and hibernate based health care project source code struts and hibernate based health care project source code Struts 2 Integration with Struts 1 About captcha of strut2 About captcha of strut2 Which is the good website for struts 2 tutorials? advance java source code source code In Struts 2 how to pass the Struts struts internationalization for Korean language struts2 Struts2 and Hibernate Fetch Data Base Value Struts2 and Hibernate Fetch Data Base Value Struts2 and Hibernate i want to create an application with only a button which on click displays table from database using struts2 and hibernate on eclipse Struts2 and Hibernate Struts2 and Hibernate Struts2 validation Procedure Struts2 validation Procedure Struts2 validation Procedure Struts2 validation Procedure Struts 2 action-validation.xml not loading Struts-2 and Ajax integration STRUTS QUESTION conerting web project into .exe file About Select tag ScartApplication aplicacion ecommerce struts 1.3 struts 1.3 sms prob Need to know struts1 all jar file names struts with hibernate


Advertisement null