Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Struts struts validation

Have Programming Question? Ask it here!
 
 
 


Nibedita Pattnaik
struts validation
0 Answer(s)      3 years 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"%> <%@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>

</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

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

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

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

    </field>

</form>

strutsconfig.xml

Blockquote

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

<action
  attribute="createGroupForm"
  name="createGroupForm"
  input="/jsp/Customer/CreateGroup.jsp"
  path="/createGroup"
  scope="request"
  parameter="method"
   validate="true"
  type="org.springframework.web.struts.DelegatingActionProxy">
  <forward name="create" path="/jsp/Customer/CreateGroup.jsp" />
  <forward name="insert" path="/jsp/Customer/GroupHomePage3.jsp" />

</action>

If i have done any mistake please aware me..


Advertisement
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
Advertisements
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 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/ http://www.roseindia.net/struts/struts2/struts-2-client-side-validation
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
struts validation  Sir i am getting stucked how to validate struts using action forms, the field vechicleNo should not be null and it should...://www.roseindia.net/struts/strutsvalidatorframework.shtml http://www.roseindia.net
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
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 : http://www.roseindia.net/struts/struts_validator
validation - Struts
information, http://www.roseindia.net/struts/struts-login-form.shtml Thanks
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://www.roseindia.net/struts/struts_validator_framework.shtml 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 : http://www.roseindia.net
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  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
validation  we are doing payroll system project in java.So pls provide the complete validation code for employee master form
validation.....
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
Validation
); JLabel label=new JLabel("JTable validation Example",JLabel.CENTER); JPanel panel=new JPanel(); panel.add(scroll); JFrame frame=new JFrame("JTable validation
validation
validation  please help me to check validation for <form> <table class="form"> <tr> <td class="col1"> <label>Sno:</label> </td> <td
validation
:checkbox path="community" value="Struts" label="Struts" /><
validation query
validation query  where I should kept properties file inside struts Web application
validation - Framework
validation  how to validate the action forms in struts? could you please explain how cross validation is done for date?  You go the following url: http://www.roseindia.net/struts/struts-login-form.shtml
comboBox validation
comboBox validation  dear sir. i want to know . how to validate radio button in struts using xml validation. thanks
struts
struts   Hi how struts flows from jsp page to databae and also using validation ? Thanks Kalins Naik
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" "http://struts.apache.org
Client Side validation in Struts 2 application
Client Side validation in Struts 2 application   ... that will generate Java Script code for client side validation. In the last section we... validation. In this section we will use the same Login-validator.xml file
STRUTS
STRUTS   Validation: user entered as 123.34567 I want the value as 123.34 once the user submits. How you will validate
struts
struts  Hi, Here my quation is can i have more than one validation-rules.xml files in a struts application
validation files
validation files  If I place validation files in the folder where the action classes are present,will there any error arise
struts - Struts
struts  i want to learn more examples on struts like menu creation and some big application on struts.and one more thing that custom validation and client side validation in struts are not running which are present on rose india
javascript validation
javascript validation  validation of comparing dropdownlist and textbox in javascript
NSURL Validation
NSURL Validation  How to validate a NSURL string using special character validation
form validation
form validation  how the form validation is done in jsf form using javaScript
Struts - Struts
Struts  Dear Sir , I am very new in Struts and want to learn about validation and custom validation. U have given in a such nice way... validation and one of custom validation program, may be i can understand.Plz
Validation of datepicker
Validation of datepicker  I have a datepicker in my JSp...the seleted dates are put in a text box. I want the alert the user from selecting future... a future date is entered..How to do this validation in javascript or jsp
email validation
email validation  during email validation.... after domain name which it means if example example@gmail.co .... this address allowed by any validation program .... but i want to show invalid email address because domain name com
email validation
email validation  during email validation.... after domain name which it means if example example@gmail.co .... this address allowed by any validation program .... but i want to show invalid email address because domain name com
Advertisements
 

 

 

DMCA.com