Client side validation in struts using validation framework

Hi ,
am new to struts.....
I want to validate a simple login page using struts validation framework...
For that i created,
login.jsp ( contains html:errors and html:javascript and onsubmit)
LoginForm extends ValidatorForm
LoginAction
resource bundles
validation.xml ( required, minlength and maxlength rules for both fields)
struts-config.xml ( configured action mapping and form beans)
whats my problem is....
i will get error messages through server side validation...
i cant able to get the error messages using javascript i.e alert messages.
i seen the page resource in that all javascript functins are inserted.
on seeing the javascript error console... it shows
formName has no properties...............
exactly at this line
oRequired = eval('new ' + formName.value + '_required()'); //function validateRequired(form)

Thanks for your valuable reply.....
Ya of course what you said was correct....
I got error messages while submitting the form without any value....
error messages are displayed using the <html:errors/> tag (server side validation ).
But it fails to show the alert messages for those errors ( client side validation).
i inserted the <html:javascript formName="form bean name" /> tag in the bottom of my login jsp.....
on seeing the error console, it shows formName has no properties.
Could anybody help me to sort out this problem........

Similar Messages

  • Problem in creating client side PDF with image using flex and AlivePD

    I need a favor I am creating client side PDF with image using flex and AlivePDF for a web based application. Images have been generated on that pdf but it is creating problem for large size images as half of the image disappeared from that pdf.I am taking the image inside a canvas . How do i control my images so that they come fit on that pdf file for any image size that i take.
    Thanks in advance
    Atishay

    I am having a similar and more serious problem. It takes a
    long time to execute, but even attaching a small image balloons the
    pdf to 6MB plus. After a few images it gets up to 20MB. These are
    100k jpeg files being attached. The resulting PDF is too large to
    email or process effectively. Does anyone know how to reduce
    size/processing?

  • Client side system requierments for using enterprise portal??

    Hi
    Does anybody know if there are some official client side system requirements published for using the enterprise portal?
    Also, is there any experience on client side requirements for having all features operating at a decent usability?
    Regards,
    Nana

    Hi,
    SUS is mostly untouched in SRM7.0 and it is still using BSP application.
    Regards,
    Ranjan

  • Read and write info from/to file available at client side.

    Hi,
    I have some table name in one CSV file at client side.
    once you get list of tables name from input CSV file at client side.
    Need to run one query to know total rows and size of table in MB , this i need to repeat for all tables which i got from input file.
    finally write 'table name | total rows | size of table in MB' whole info in another CSV file at client side. this output CSV file name will contain timestamp.
    Please guide me in detail how to read and write file avail at client side.
    I am using sql developer at client side.
    version : oracle11g
    Thanks in advance.

    This is a simple SQL question and this forum is for SQLDEveloper, however, this is a question for our SQL*Plus support which can help with this.
    clear SCREEN
    set FEEDBACK off
    set head off
    --Gather stats to populate rownums and avg length of rows.
    --These are not exact sizes (obviously) but you get the idea.
    begin
    dbms_stats.gather_schema_stats ('<YOUR_SCHEMA');
    end;
    select TABLE_NAME||','||NUM_ROWS||','||ROUND((NUM_ROWS*AVG_ROW_LEN)/(1024*1024)) CSV
    from USER_TABLES
    where num_rows is not null order by num_rows desc;

  • Printing web page at client side

    i want to print web page at client side . Page & printer settings are through coding. i tried using
    DocFlavor myFormat = new DocFlavor("text/plain; charset=utf-16be","java.net.URL");
    i found exception invalid flavor

    If you are trying to print a web page on the client side, you have to use the browser's print function which can be invoked through JavaScript. What you are trying to do can't possibly work. Even if you weren't getting an exception, it wouldn't work. Any Java code in the JSP will have no effect on what happens on the client's machine.

  • Client-side UserTransaction

    Ok,
              POJO client side. API code uses JNDI to find TransactionManager and determines that there are no current XA connection running so it uses JNDI to lookup javax.transaction.UserTransaction.
              It starts the transaction by calling begin()
              It calls some other code that sends a JMS message.
              It commits the transaction.
              end of story, eh.... no.
              I use JView 2004 to get performance data like transaction throughput and cannot see that a transaction was started and committed. To see that a transaction actually was started I use userTransaction.getState() after begin() and verifies that it is active.
              I then get the thread name after begin and just before the queueSender.send(....) code and it is the same.
              Finally, I verify with success that the transaction was committed.
              If I use a MDB to read the message from the queue I can see the transaction throughput in JView.
              Is it some bizarre I have forgot that a getStatus()==Status.STATUS_ACTIVE wouldn't catch or do you think JView cannot "see" client initiated transactions?
              Lars

    My guess is JView cannot see the transaction, have you tried using the weblogic console to monitor the transaction.
              servers>monitoring>JTA
              you can then select to monitor the transaction by name, resource or inflight.
              Tell me how you get on.

  • Client Side Support for NTLM

    Hi
    I have been trying to read my mails from Microsoft Exchange Server by using java library developed by Various Software Products like Javamail,Mousetrap,Icemail,Jscape,JavaMail, and IPWorks.
    On our server side we are having "Secure Password Authentication"(NTLM) in order to encode and decode mails, So we need to use the same Authorisation Mechanism on Client Side so that we can read mails from the Exchange Server.
    ( As Server Side Autherisation Mechanism should match with Client Side Autherisation Mechansim to read mails from Exchange Server)
    On Client Side, I have tried using the software products that i specified above. All the above listed products are supporting CRAMMD5,PLAIN,LOGIN,DIGEST-MD5 Autherisation Mechanisms But, No one are supporting NTLM Autherisation.
    As we have NTLM autherisation mechanism set on the server side, so i need to use the same Autherisation mechanism on client side too.
    The current Exchange server version we are using is " 5.5.2654.50". I have also tried installing the Evaluation version of Microsoft Exchange server 2003 and checked whether it supports any other authentication other than NTLM. I found that, it is allowing me to use either "Clear Text" or "NTLM".
    could anyone help me in providing any Software Product (Java Library) that supports "NTLM Autherisation" to read mails from Exchange Server.
    Protocol that we are using - IMAP
    I will be greatful if anyone can help me in this
    thanks
    Srinivasa Kanchiraju
    Dynalivery Corporation
    Saint Louis MO - 63043
    Tel - 314 205 8995 ext 21

    The problem is that NTLM is a Microsoft proprietary authentication mechanism.
    I believe there are some products in the JavaMail Third Party Products page
    that support NTLM.
    http://java.sun.com/products/javamail/Third_Party.html

  • STRUTS: client-side validation in jsp using  DynaValidatorForm

    I am supposed to work on struts on as project and it is like learning a crash course and work the next day.
    In Struts 1.1 enviroment, I am using DynaValidatorForm to create a bean form and then perform validation.
    1. I write a DynaValidatorForm definition in struts-config.xml
    2. I write xml for action so that when /getQuotes.do in invoked by a jsp form, the form data is put into the QuoteDetailsBean.
    3. add the plugin script for ValidatorPlugIn
    xml fragment from struts-config:
    //form bean
    <form-beans>
    <form-bean name="QuoteDetailsBean" type="org.apache.struts.validator.DynaValidatorForm">
        <form-property name="forename" type="java.lang.String"/>
       <form-property name="surname" type="java.lang.String"/>
    <form-bean>
    </form-beans>
    <action
            path="/getQuotes"
            type="com.kainos.quickquotes.struts.QQGetQuotesAction"
            validate="true"
            name="QuoteDetailsBean"
            input="/userform1.do"
            parameter="save"
            scope="session">
            <forward name="success" path="/pages/jsp/result.jsp"/>
            <forward name="back" path="/userform1.do"/>
    </action>
    <plug-in className="org.apache.struts.validator.ValidatorPlugIn">
         <set-property
             property="pathnames"
             value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml"/>
      </plug-in>Now I write a validation code for getQuotes.do. note that I can write the validation code with
    <form name="QuoteDetailsBean"> but this form bean is shared by many jsp, so i am using the name of the action
    (getQuotes) as the name of the form in the validation.xml.
    So far this looks okay, as I am going by some example.
    xml fragment from validation.xml:
    <formset>
              <form name="/getQuotes">
                 <field property="forename" depends="required,minlength">
                    <arg0 key="QuoteDetailsBean.forename" />
                    <arg1 name="minlength" key="${var:minlength}" resource="false"/>
                    <var>
                       <var-name>minlength</var-name>
                       <var-value>2</var-value>
                    </var>
                 </field>
                 <field property="surname" depends="required,minlength">
                <arg0 key="QuoteDetailsBean.surname" />
                <arg1 name="minlength" key="${var:minlength}" resource="false"/>
                <var>
                   <var-name>minlength</var-name>
                   <var-value>2</var-value>
                </var>
                 </field>
    </formset>Now I write the JSP. I use the <html:javascript> tag to allow front-end validation based on the xml in validation.xml.
    The jsp code:
    <%@ taglib uri="/tags/struts-bean" prefix="bean" %>
    <%@ taglib uri="/tags/struts-html" prefix="html" %>
    <%@ taglib uri="/tags/struts-logic" prefix="logic" %>
    <html:html locale="true">
    <head>
    <title><bean:message key="welcome.title"/></title>
    <html:base/>
    <html:javascript formName="/getQuotes"
                method="validateForm"
                dynamicJavascript="true"
                staticJavascript="false"
                cdata="false" />
    </head>
    <body bgcolor="#FFCC9F">
    <html:errors />
    <html:form action="getQuotes.do" onsubmit="return validateForm(this);" >
    Forename:</td> <td>���<html:text property="forename"/></td></tr>
    <tr> <td>Surname:</td> <td>���<html:text property="surname"/></td></tr>
    <html:submit value="Quotes" /></td></tr>
    </html:form>
    </body>
    </html:html>Does this looks okay. I wrote so far based on some tutorials n help online.
    Now when I open the JSP and then do a submit, there is no validation (I tried by submitting with empty forename and surname. I mean i could invoke the action class and the invoke class
    redirects(forwards) to the appropriate path. so the code works fine except validation is not done
    Q1. So what should i do more to get client-side validation?
    What actually happens in client-side validation? does a pop up alert appears?
    nothing happens so far in my case.
    Q2. What should I do more for server side validation. Since the form is incomplete, what happens?
    I thought the same form returns and the error messages are printed in the jsp page since i have the <html:errors />
    tag just below the <body> tag.
    The action class is pretty simple so far:
    public class QQGetQuotesAction extends Action {
        public QQGetQuotesAction(){
    public ActionForward execute(ActionMapping mapping,
                 ActionForm form,
                 HttpServletRequest request,
                 HttpServletResponse response)
        throws Exception {
            DynaValidatorForm dynaform = (DynaValidatorForm)form;
            System.out.println("forename:"+dynaform.get("forename");
            System.out.println("surname:"+dynaform.get("surname");
            return forward=mapping.findForward("back");
    }Please help me out. I think I am missing something which i need to do
    thanks
    Tanveer

    I think the validations are to be declared on the form
    name and not the action path.
    Your formName is QuoteDetailsBean but your are using
    the action path(/getQuotes) both in the validation
    rules and the jsp tags. Use the formName on both the
    places.
    Also your html:javascript tag will not generate the
    static javascript to validate the fields. For this you
    will have to add code like below.
    <html:javascript dynamicJavascript="false"
    staticJavascript="true"/>
    Other options is to set the attribute
    staticJavascript="true" in your html:javascript tag.
    Hope it helps.hi
    staticJavascript="true" did the trick. :)
    I think the validations are to be declared on the form name and not the action path.It is not necessary. You can declare the validation on the action class. This is essential if a form bean is shared by several JSPs having its own action class. This is as per as I read in a tutorial and it works.

  • Client Side Javascript Validation not Working in Struts 1.x version

    hi,
    I'm following the steps provioded in the below link for Javascript Client side validation but still it is not working.I'm struggling to get this work.
    [http://www.visualbuilder.com/jsp/struts/tutorial2/pageorder/9/|http://www.visualbuilder.com/jsp/struts/tutorial2/pageorder/9/]
    "The framework automatically generates the browser specific JavaScript and validate the data only at the client side."From the above statement i undertstand that framework itself generates the javascript function for validating the field mentioned in validations.xml file so that we dont have to explicitly write a javascript function for
    validating the fields
    (or)
    Do we need to call an explicit function
    Please need help on this.
    I have followed all the steps mentioned on the above link but Client Side Javascript Validation not Working in Struts 1.x version....
    Thanks and Regards,
    Deepak

    Hi,
    Please find my steps below....still getting an error.
    2> which version of commons-validation.jar needs to be downloaded ...Link please
        downloaded the latest commons-validation.jar and placed in lib.refreshed the project,and did a build.
        3> which DTD name to be specified in "validator-rules.xml" which is in accordance to commons-validator.jar file.
    validator-rules.xml ::
    <!DOCTYPE form-validation PUBLIC
              "-//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.0//EN"
              "http://jakarta.apache.org/commons/dtds/validator_1_0.dtd">validation.xml:
    <!DOCTYPE form-validation PUBLIC
    "-//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.0//EN"
    "http://jakarta.apache.org/commons/dtds/validator_1_0.dtd">
    i did as u said and im gettiong the below errorNov 5, 2009 4:33:08 PM org.apache.struts.validator.ValidatorPlugIn initResources
    SEVERE: Invalid byte 2 of 2-byte UTF-8 sequence.
    org.apache.commons.digester.xmlrules.XmlLoadException: Invalid byte 2 of 2-byte UTF-8 sequence.
         at org.apache.commons.digester.xmlrules.FromXmlRuleSet.addRuleInstances(FromXmlRuleSet.java:139)
         at org.apache.commons.digester.Digester.addRuleSet(Digester.java:1610)
         at org.apache.commons.digester.xmlrules.DigesterLoader.createDigester(DigesterLoader.java:89)
         at org.apache.commons.validator.ValidatorResourcesInitializer.initialize(ValidatorResourcesInitializer.java:122)
         at org.apache.struts.validator.ValidatorPlugIn.initResources(ValidatorPlugIn.java:238)
         at org.apache.struts.validator.ValidatorPlugIn.init(ValidatorPlugIn.java:181)
         at org.apache.struts.action.ActionServlet.initModulePlugIns(ActionServlet.java:1036)
         at org.apache.struts.action.ActionServlet.init(ActionServlet.java:455)
         at javax.servlet.GenericServlet.init(GenericServlet.java:212)
         at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1139)
         at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:966)
         at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3996)
         at org.apache.catalina.core.StandardContext.start(StandardContext.java:4266)
         at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:760)
         at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:740)
         at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:544)
         at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:927)
         at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:890)
         at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)
         at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1150)
         at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
         at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)
         at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1022)
         at org.apache.catalina.core.StandardHost.start(StandardHost.java:736)
         at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
         at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
         at org.apache.catalina.core.StandardService.start(StandardService.java:448)
         at org.apache.catalina.core.StandardServer.start(StandardServer.java:700)
         at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
         at java.lang.reflect.Method.invoke(Unknown Source)
         at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
         at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
    Need help forum members.....
    Please reply to my question 1  which has been asked before as belowDo i need to write explicit javascript function for validation in Struts (or) struts generates the javascript function by itself.??? Please explain with an example....
    Edited by: Deepak_A_L on Nov 5, 2009 4:37 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Struts 2 Client side validation getting skipped.

    I am doing a simple program using struts 2. Usually in struts2 bean class will be combined with action class unlike in struts 1.2. But for enhancing readability I made a seperate bean class and I reference it in my action class. But after seperating bean from action class Client side validation using xml is not happening. It is getting skipped. But server side validation inside execute() is happening. Will anyone please help me to find a solution to make client side validation run.
    here are the different files.
    1) JSP File - SEmail.jsp
    <%@ taglib prefix="s" uri="/struts-tags"%>
    <html>
    <s:head theme="ajax" />
    <title>SEmail </title>
    <body>
    <center><font color="blue" size="5" face="bold">
    <s:label     value="Secure Email - Non Registered User" /> </font></center>
    <br>
    <font color="red" size="3"> <s:label
         value="Want to contact us?."></s:label>
    </font>
    <center><s:form action="/Semail.action" method="POST"
         validate="true">
         <s:actionerror />
         <s:select label="Topic" name="user.topic" headerKey="-1" required="true"
              list="#{'Plan Coverage':'Plan Coverage','Sales':'Sales','Others':'Others'}">
         </s:select>
         <s:textarea name="user.message" label="Message" rows="4" cols="50"
              required="true" />
         <br>
         <s:label value="Contact Information" />
         <br>
         <table align="center" width="500">
              <tr align="left">
                   <td align="left"><s:select label="Title" name="user.title"
                        headerKey="-1" required="true"
                        list="#{'-- Select One --':'-- Select One --','Mr.':'Mr.','Ms.':'Ms.','Mrs.':'Mrs.'}">
                   </s:select></td>
              </tr>
              <tr align="left">
                   <td align="left"><s:textfield label="First Name"
                        name="user.firstname" size="20" maxlength="35" required="true" /></td>
              </tr>
              <tr align="left">
                   <td align="left"><s:textfield label="Family Name"
                        name="user.familyname" size="20" maxlength="35" required="true" /></td>
              </tr>
              <tr align="left">
                   <td align="left"><s:textfield label="Profession"
                        name="user.profession" size="20" maxlength="20" /></td>
              </tr>
              <tr align="left">
                   <td align="left"><s:textfield label="Address" name="user.address"
                        size="20" maxlength="100" /></td>
              </tr>
              <tr align="left">
                   <td align="left"><s:textfield label="Telephone Number"
                        name="user.telnumber" size="20" maxlength="20" /></td>
              </tr>
              <tr align="left">
                   <td align="left"><s:textfield label="P.O. Box" name="user.pobox"
                        size="20" maxlength="8" /></td>
              </tr>
              <tr align="left">
                   <td align="left"><s:textfield label="City"
                        name="user.emirate" size="20" maxlength="35" required="true" /></td>
              </tr align="left">
              <tr>
                   <td align="left"><s:textfield label="Region and Country"
                        name="user.country" size="20" maxlength="35" /></td>
              </tr>
              <tr align="left">
                   <td align="left"><s:textfield label="E-mail Address"
                        name="user.email" size="20" maxlength="70" required="true" /></td>
              </tr>
         </table>
         <br>
         <s:file name="user.uploadFile" label="Upload Document" />
         <br>
         <br>
         <s:submit value="Submit" align="center"></s:submit>
    </s:form></center>
    <font color="red" size="3"> <s:label
         value="All fields marked (*) are mandatory."></s:label>
    </body>
    </html>
    2) struts.xml
    <!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
    "http://struts.apache.org/dtds/struts-2.0.dtd">
    <struts>
         <package name="semail" extends="struts-default">
              <action name="Semail" class="semail.NonregUser">
                   <result name="input">/SEmail.jsp</result>
                   <result name="error">/SEmail.jsp</result>
                   <result>/SEmail.jsp</result>
              </action>          
         </package>     
    </struts>
    3) Bean Class - User.java
    package semail;
    public class User {
         private String topic;
         private String message;
         private String title;
         private String firstname;
         private String familyname;
         private String profession;
         private String address;
         private int telnumber;
         private String pobox;
         private String city;
         private String country;
         private String email;
         private String uploadFile;
         private String testing;
         public String getTopic() {
              return topic;
         public void setTopic(String topic) {
              this.topic = topic;
         public String getMessage() {
              return message;
         public void setMessage(String message) {
              this.message = message;
         public String getTitle() {
              return title;
         public void setTitle(String title) {
              this.title = title;
         public String getFirstname() {
              return firstname;
         public void setFirstname(String firstname) {
              this.firstname = firstname;
         public String getFamilyname() {
              return familyname;
         public void setFamilyname(String familyname) {
              this.familyname = familyname;
         public String getProfession() {
              return profession;
         public void setProfession(String profession) {
              this.profession = profession;
         public String getAddress() {
              return address;
         public void setAddress(String address) {
              this.address = address;
         public int getTelnumber() {
              return telnumber;
         public void setTelnumber(int telnumber) {
              this.telnumber = telnumber;
         public String getPobox() {
              return pobox;
         public void setPobox(String pobox) {
              this.pobox = pobox;
         public String getCity() {
              return city;
         public void setCity(String city) {
              this.city= city;
         public String getCountry() {
              return country;
         public void setCountry(String country) {
              this.country = country;
         public String getEmail() {
              return email;
         public void setEmail(String email) {
              this.email = email;
         public String getUploadFile() {
              return uploadFile;
         public void setUploadFile(String uploadFile) {
              this.uploadFile = uploadFile;
         public String getTesting() {
              return testing;
         public void setTesting(String testing) {
              this.testing = testing;
    This is my bean class. Instead of putting it with action class NonregUser.java , I have seperated it out for readability. And I am referencing it in the action class.
    4) Action Class - NonregUser.java
    package semail;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import org.apache.struts2.interceptor.ServletRequestAware;
    import org.apache.struts2.interceptor.ServletResponseAware;
    import com.opensymphony.xwork2.ActionSupport;
    public class NonregUser extends ActionSupport implements ServletRequestAware,
              ServletResponseAware {
         private static final long serialVersionUID = 2451855813074437309L;
         HttpServletRequest request = null;
         HttpServletResponse response = null;
         private User user = null;
    /* I am referencing my bean class here instead of writing all the getters and setters here.*/
         public User getUser() {
              return user;
         public void setUser(User user) {
              this.user = user;
         public String execute() throws Exception {
              System.out.println("Validating login");
              if(user!=null){
                   System.out.println(user.getFirstname());
                   System.out.println(user.getEmail());
                   System.out.println(user.getTopic());
                   System.out.println(user.getTitle());
    // this server side validation is happening
                   if (user.getTitle().trim().equals("-- Select One --")) {
                        addActionError("Please select Title");
                        return ERROR;
                   } else {
                        return SUCCESS;
              }else{
                   return SUCCESS;
         public void setServletRequest(HttpServletRequest arg0) {
              System.out
                        .println("HttpServletRequest : " + NonregUser.this.getClass());
              request = arg0;
         public void setServletResponse(HttpServletResponse arg0) {
              System.out.println("HttpServletResponse : "
                        + NonregUser.this.getClass());
              response = arg0;
    This is my acation class. Here I am referencing my bean class User.java.
    5) xml validation file - NonregUser-validation.xml
    /*This client validatin is not working*/
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE validators PUBLIC
              "-//OpenSymphony Group//XWork Validator 1.0.2//EN"
              "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
    <validators>
         <field name="topic">
              <field-validator type="requiredstring">
                   <param name="trim">true</param>
                   <message>Please select the Topic</message>
              </field-validator>
         </field>
         <field name="message">
              <field-validator type="requiredstring">
                   <param name="trim">true</param>
                   <message>Please enter Message</message>
              </field-validator>
              <field-validator type="stringlength">
                   <param name="maxLength">8000</param>
    <message>Message cannot contain more than 8000 characters</message>
              </field-validator>
         </field>
         <field name="title">
              <field-validator type="requiredstring">
                   <param name="trim">true</param>
                   <message>Please select the Title</message>
              </field-validator>
         </field>
         <field name="firstname">
              <field-validator type="requiredstring">
                   <param name="trim">true</param>
                   <message>Please enter First name</message>
              </field-validator>
              <field-validator type="stringlength">
                   <param name="maxLength">35</param>
    <message>First Name cannot contain more than 35 characters</message>
              </field-validator>
         </field>
         <field name="familyname">
              <field-validator type="requiredstring">
                   <param name="trim">true</param>
                   <message>Please enter Family name</message>
              </field-validator>
              <field-validator type="stringlength">
                   <param name="maxLength">35</param>
    <message>Family Name cannot contain more than 35 characters</message>
              </field-validator>
         </field>
         <field name="emirate">
              <field-validator type="requiredstring">
                   <param name="trim">true</param>
                   <message>Please enter Emirate/City</message>
              </field-validator>
         </field>
         <field name="email">
              <field-validator type="requiredstring">
                   <param name="trim">true</param>
                   <message>Please enter Email address</message>
              </field-validator>
              <field-validator type="email">               
                   <message>Please enter a valid Email address</message>
              </field-validator>
         </field>
    </validators>
    6) web.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app>
         <filter>
         <filter-name>struts2</filter-name>
         <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
         </filter>
         <filter-mapping>
         <filter-name>struts2</filter-name>
         <url-pattern>/*</url-pattern>
         </filter-mapping>
         <welcome-file-list>          
              <welcome-file>/SEmail.jsp</welcome-file>
         </welcome-file-list>     
         <error-page>
    <error-code>404</error-code>
    <location>/pagenotfound.jsp</location>
    </error-page>
    <error-page>
    <exception-type>java.lang.Exception</exception-type>
    <location>/error.jsp</location>
    </error-page>
    </web-app>
    Edited by: L-J-K on Jul 22, 2008 5:22 AM

    I was trying to do it through creating a new validators.xml where I would redefine all struts built in validations and add de definition for my custom Validation (<validator name="checkUser" class="com.custom.CustomUserValidator"/>). Then I define the ActionClassName-action-validation.xml refering to my custom validator (checkUser). The com.custom.CustomUserValidator Class has to extend FieldValidatorSupport or ValidatorSupoort (depending on what kind of validation).
    Ok that's it, this is the theory, now the custom validator (checkUser) is executed before my action but I don't know how to do it so that if the validation fails i return to the same page showing the error message to the user without having to execute the target action. Does anyone know how to do this????

  • Struts client side validation....

    Hello all,
    I am using struts client and server validation but only the server validation works. I tired looking around the forum but wouldnt find any similar problem.
    I am getting value from the previous action class and i am able to successfully retrieve and display the value. I inserted the value in a object and pass over to my jsp. When i try inserting the validation, the server side works fine but i get nth on the client side. I viewed the source code of my jsp and the JAVASCRIPT is successfully inserted but no pop up when i leave the fill blank. Please advise mi..
    1)update.jsp will retrieve data from a object and display them in text box
    struts config file**
    <form-bean name="UpdateMarks" type="fypms.form.UpdateMarksForm" />
    <action name="UpdateMarks"
    path="/updateMarks"
    type="fypms.action.UpdateStudentMarks"
    scope="request"
    validate="true"
    input="/pages/UpdateStudentMarks.jsp" >
    <forward name="successfulUpdate" path="/pages/successfulUpdate.jsp" />
    <forward name="wrongHelloId" path="/pages/wrongHelloWorld.jsp" />
    </action>
    <message-resources parameter="MessageResources"/>
    <plug-in className="org.apache.struts.validator.ValidatorPlugIn">
    <set-property
    property="pathnames"
    value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml"/>
    </plug-in>
    validation.xml**
    <!-- javascript validation for Update Presentation marks page -->
    <form name="UpdateMarks">
    <field property="first_Present"
    depends="creditCard">
    <arg key="prompt.firstPresent" />
    </field>
    <field property="final_Present"
    depends="creditCard">
    <arg key="prompt.finalPresent" />
    </field>
    </form>
    updatemarksform.java**
    private String adminNo[];
         private String first_Present[];
         private String final_Present[];
         private String batchNumber;
         //private String batchNumber;
         public ActionErrors validate( ActionMapping mapping, HttpServletRequest request)
              ActionErrors errors = new ActionErrors();
              List testing = new ArrayList();
              System.out.println("out");
              for(int x=0; x < first_Present.length;x++)
                   System.out.println("firsT" + first_Present[x].length());
                   if (first_Present[x].length()<1)
                        System.out.println("a");
                        //userId not entered
                        errors.add("marks.firstPresentation", new ActionMessage("marks.firstPresentation"));
                   if (final_Present[x].length()<1)
                        //password not entered
                        errors.add("marks.finalPresentation", new ActionMessage("marks.finalPresentation"));
              request.setAttribute("StudentList", testing);
              return errors;
    update.jsp**
    <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
    <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
    <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
    <%@ page import="fypms.model.*" %>
    <link href="/FYPMS/css/style.css" rel="stylesheet" type="text/css">
    <!--Can contains: JSP -->
    <html:html locale="true">
    <html:form action="/updateMarks" method="post" onsubmit="return validateUpdateMarks(this);">
    <html:errors/>
         <table>
    <tr>
    <td>Name</td>
    <td>Admin Number</td>
    <td>First Presentation</td>
    <td>Final Presentation</td>
    </tr>
    <logic:iterate id="myCollectionElement" name="StudentList">
    <tr>
    <td> <bean:write name="myCollectionElement" property="name"/><html:hidden name="hiddenBatch" property="batchNumber"/></td>
    <td> <bean:write name="myCollectionElement" property="adminNo"/><html:hidden name="myCollectionElement" property="adminNo"/></td>
    <td> <html:text name="myCollectionElement" property="first_Present" /></td>
    <td> <html:text name="myCollectionElement" property="final_Present" /> </td>
    </tr>
    </logic:iterate>
    >
    <tr><td colspan="4"><html:submit value="enter"/></td></tr>
         </table>
    <!-- Begin Validator Javascript Function-->
    <html:javascript formName="UpdateMarks" staticJavascript="true" />
    <!-- End of Validator Javascript Function-->
    </html:form>
    </html:html>
    thank in advance

    # -- validation text(display text) for login page --
    valid.title=Simple Validation Test Form
    prompt.username=Username
    prompt.password=Password
    prompt.phone=Phone Number
    prompt.email=E-Mail Address
    prompt.url=URL (Website Address)
    login.userid = Username is required
    login.password = Password is required
    #-- validation text(display text) for Update presentation marks page --
    prompt.firstPresent=first_Present
    prompt.finalPresent=final_Present
    marks.firstPresentation=First Presentation marks is required
    marks.finalPresentation=Final Presentation marks is required
    thx for ur help ^^
    Message was edited by:
    fatmond

  • How to make client side validations using NWDS

    Hi Frndz..
                   Am creating UIs using NWDS ,i made tthe validations @ servr side n i have 2 made this validations @ clinet side ,but am not aware how it is????
    can anyone help me in this regard.
    THANKS & REGARDS
    Rajesh Kumar

    chk it
    /people/martin.kellermann2/blog/2006/12/17/client-side-input-validation-with-htmlb--the-basics
    http://help.sap.com/saphelp_nw04/helpdata/en/43/067941a51a1a09e10000000a155106/frameset.htm
    /people/kirupanand.venkatapathi2/blog/2005/12/18/client-side-validation-in-dynpage
    http://help.sap.com/saphelp_nw04s/helpdata/en/8e/e3a942ad920c31e10000000a1550b0/frameset.htm
    /thread/86123 [original link is broken]
    https://media.sdn.sap.com/html/submitted_docs/dotnet/Programming%20with%20PDK%20for%20.NET/SAP%20NetWeaver%20.NET%20Controls/Event%20Handling/Client%20Side%20Event%20Handling.htm

  • Validating data in client side

    Hi,
    I'm developing a web application using Struts framework.
    and my questions is, does the validate method int the ActionForm replaces the using javascript validation?
    If I can do all the validations in this validate method, so does that mean that i'm not going to use JS at all?

    Client side validation is usually a subset of the validation done on the server side (ie, server side duplicates the client side validation, and then some).
    I usually only do some basic client side validation such as:
    a textfield is null, but shouldn't be
    a textfield should be in this format but isn't: mm/dd/yyyy
    a textfield should be a number but contains a letter.
    If these conditions occur, dont submit the form, pop up a warning dialog box instead.

  • Client Side Validation Problems

    Hi,
    When I use .Net validation controls on my aspx pages, the validation always executes server-side, even on IE clients, regardless of the EnableClientScript property on the validators.
    If i hit the remote server directly, the validators work correctly - ie Client-side for IE and server side for all others.
    So I assume that the remote server is unable to correctly identify the client browser as it's gatewayed via the portal. Does anyone know a way around this please?
    Cheers,
    Simon

    Hi Jonathan,
    Thanks for your reply.
    I'm a .Net developer who's new to Plumtree development, so my appologies if i'm missing something obvious.
    We're using the Broadcast Listener pattern, Portal Server v 5.0.3, Web Controls 2.1 and .Net Framework 1_1_4322_2032. We've generated the client script to support this version of .Net and installed in onto the ImageServer.
    We have a menu portlet, which broadcasts a 'linkSelected' event on click of a menu item. Our main portlet is the listener and has an event handler that invokes a PTGetHTTPRequest call to one of a number of page for processing (depending on the menu item selected etc). This 3rd page contains all of the form fields, the validators and the validation summary.
    When this aspx page has finished processing, there is an event handler in the 2nd page which scrapes the content of Response.ResponseText into a container <DIV> element on page 2 - ie dynamically building the html content with client script.
    I've built a routine that can scrape this dynamically generated content of the <body> of the Listener portlet at this stage and when I examine this output, the validation js file and the inline __doPostback functions are all present.
    I've done some debugging of the WebUIValidation.js file and although each individual validator is firing ok, it appears that the problem is manifesting itself in the ValidationSummaryOnSubmit_1_1_4322_2032()function. This function is called correctly, but it can't evaluate the Page_ValidationSummaries object.
    This Page_ValidationSummaries object is defined and set within the inline script as follows :
    var Page_ValidationSummaries;
    function PTSetValidationSummaries_490()
    { [/b]
    [b] var valsInput = document.getElementById('PT_VALIDATORS_SUM_490');
    if(valsInput)
    Page_ValidationSummaries = eval(valsInput.value);
    else Page_ValidationSummaries = new Array();
    and the PT_VALIDATORS_SUM_490 element is defined as :
    <INPUT id=PT_VALIDATORS_SUM_490 type=hidden value="new Array(document.all['vsAll'])">
    and the vsAll element is defined as :
    <DIV id=vsAll style="DISPLAY: none; COLOR: red" showmessagebox="True"></DIV>
    If I debug the WebUIValidation.js file, I can successfully evaluate document.getElementById('PT_VALIDATORS_SUM_490'), so I believe that the error occurs when the PTSetValidationSummaries_490()function executes (or perhaps PTSetValidators_490isn't actually calling it??).
    I can't really debug this any further as I've now traced the error back to the inline script that's appended at runtime by the Plumtree environment.
    Would it be possible for me to email this source code to you for inspection and comment please?
    Cheers,
    Simon

  • Af:query client side validation

    Hello,
    I have an application with 2 ViewObjects (based on SQL), each with its own ViewCriteria. I have 2 pages, each containing 1 of the ViewCriteria as af:query with results table. Each ViewCriteria has a number of fields, all f which are selectively required.
    Now, when I go to page A, leave all fields empty and hit 'search', my fields get marked immediately as 'you need to enter at least one of the criteria'. No server request, just pure client validation, as you'd expect. Now we go to page B, doing exactly the same (empty fields, search). I see a lot of activity now, a server request, a query executed, and then a stacktrace saying 'at least 1 attribute is required'. In the front end, I also get a popup saying I have to enter at least 1 value.
    Does anyone have any idea why the validation for both af:query components is different? Both ViewObject look the same to me, with same properties and attributes set.
    Thanks in advance,
    Stijn.

    Thanks for the reply, Vinod.
    The problem still persists, though. We're working with version 11.1.3 (where the issue should be fixed), and it doesn't happen every time. 8 out of 10 af:query-components we use go to the server before validating the input, resulting in a popup. The other 2 do client-side validation and immediately tell you to fill in the blanks (which is the behaviour we want)...

Maybe you are looking for

  • Save for web error in PS CC 14.2.1

    Whenever I try to save for web in PS I get an error message.  I've tried deleting the preference file as suggested in older posts, but it did not work.  I'm running Windows 8.1. Any help would be greatly appreciated!

  • Power Mac G4 and 15" Studio Display variation on an old theme

    I am trying to recondition a PM G4 tower and 15" display for resale. A number of years ago I corrupted the system attempting an upgrade, and the display has never worked ever since (power button works, but screen is black). Somewhere along the line,

  • Is there any standard variable to calculate previous and current month

    hi, Is there any standar variable to calculate previous month and current month which will calcualte from system date (sy-date). I found standard SAP Delivered variable - 0CMONTH to calculate current month. But i want both current month and previous

  • Sharepoint 2013 Servers Architecture

    Hi Our current architecture of SharePoint 2013 Farm is 1. WFE server (ip - 10.10.10.10) 2. A server which is Application server and Database server (ip - 10.10.10.11) 3.  Application server (Central Admin) (ip - 10.10.10.12) Load on the site has incr

  • Web guest authentication on ISE 1.1.1

    Can somebody help me about activation of web authentication on only one location (for exemple one catalyst) concerning a vlan guest wifi and wired Thanks