Struts and validation question ?

hi,
i am using the struts framework for my application, i have a simple jsp logon page (username, password)
i have defined a validtion.xml file
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!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 Rules for the Struts Example Web Application
    $Id: validation.xml,v 1.8 2003/05/25 22:51:20 dgraham Exp $
-->
<form-validation>
    <!-- ========== Default Language Form Definitions ===================== -->
    <formset>
        <form name="logonForm">
            <field property="username"
                    depends="required, minlength,maxlength">
                <arg0   key="prompt.username"/>
                <arg1   key="${var:minlength}" name="minlength"
                   resource="false"/>
                <arg2   key="${var:maxlength}" name="maxlength"
                   resource="false"/>
                <var>
                    <var-name>maxlength</var-name>
                    <var-value>16</var-value>
                </var>
                <var>
                    <var-name>minlength</var-name>
                    <var-value>3</var-value>
                </var>
            </field>
            <field property="password"
                    depends="required, minlength,maxlength">
                <arg0   key="prompt.password"/>
                <arg1   key="${var:minlength}" name="minlength"
                   resource="false"/>
                <arg2   key="${var:maxlength}" name="maxlength"
                   resource="false"/>
                <var>
                    <var-name>maxlength</var-name>
                    <var-value>16</var-value>
                </var>
                <var>
                    <var-name>minlength</var-name>
                    <var-value>3</var-value>
                </var>
            </field>
        </form>
        <form name="registrationForm">
            <field property="fromAddress"
                    depends="required,email">
                <arg0   key="prompt.fromAddress"/>
            </field>
            <field property="fullName"
                    depends="required">
              <arg0     key="prompt.fullName"/>
            </field>
            <field property="replyToAddress"
                    depends="email">
                <arg0   key="prompt.replyToAddress"/>
            </field>
            <field property="username"
                    depends="required">
              <arg0     key="prompt.username"/>
            </field>
        </form>
    </formset>
</form-validation>i have also the validation-rules.xml file provided by the struts lib.
i would like to force the content of 'username' property to be alphabetic.
i guess i have to create my own element
<validator name="alphabeticString"...> inside the validation-rules.xml file, but i am newbie in javascript programming.
i have tree question.
1) why the validation code inside the validator element is written in javascript since it's not going to be executed at client side???
2)can i use java instead ? (to code teh validation ...)
3)has anyone got a code to solve this problem ?
thanks for your help

i would like to force the content of 'username' property to be alphabetic.
i guess i have to create my own element
<validator name="alphabeticString"...> inside the validation-rules.xml file,
but i am newbie in javascript programming.Not for something that simple... there's a validator rule called mask, which takes a regular expression as an argument, so if you want only a-z: "[a-zA-Z]*" should work.
1) why the validation code inside the validator element is written in javascript since it's not going to be executed at client side???It is validated on the client, or can be. You have to include the javascript with the html:javascript tag library tag and specify the form name. Then you need to put the onsubmit="return validateFormName();" attribute in the form tag. If JS isn't supported, it'll still default back to the server side validation.
2)can i use java instead ? (to code teh validation ...)Don't include the JS stuff.

Similar Messages

  • Jakarta struts and validation

    I have a working validatorform form that uses the struts validation framework (mostly handled through xml files).
    but i want it to instead of just saying "email is invalid"... i want it to also highlight the text infront of the field in red. any ideas as to the best way to implement this?
    My code can be seen at this experts exchange thread: http://www.experts-exchange.com/Web/Web_Languages/JSP/Q_21078788.html
    THANKS!

    The field label? If you have it in a tag (say, an inline DIV or SPAN), and it has an ID, you can get a reference using Javascript and modify the foreground color. That's some Javascript and CSS stuff.
    Tying this into Struts is a different issue... you'd have to do something to the Javascript that Struts uses to validate those values.

  • Need help. I am running a 27 in imac with 16 gigs of ram. Photoshop runs really fast, except when opening files. It takes 5-10 minutes to open even a small file of 1 meg. I cleaned and validated all the fonts and removed all questionable fonts. Reset pref

    Need help. I am running a 27 in imac with 16 gigs of ram. Photoshop runs really fast, except when opening files. It takes 5-10 minutes to open even a small file of 1 meg. I cleaned and validated all the fonts and removed all questionable fonts. Reset preferences and still have problem. Slow to open and in force quit "Photoshop not responding" At this point should I uninstall and start over.

    What are the performance Preferences?

  • HT2731 when i gave my card no and all question arise that card is not valid but is valid

    when i gave my card no and all question arise that card is not valid but is valid

    whats a answer

  • Can Struts and JSF coexist?

    I have a Struts based application and now I want to build an additional module on top of that using pure JSF. My question is, can Struts and JSF co-exist in the same application? If yes, what are the cons of that approach? What are the places I need to tweak in the configuration files so that they work together?
    thanks,

    Hi,
    Yes they can coexist. Actually that's the approach recommended by Craig McClanahan. I have developed a full enterprise application (80% completed) which uses JSF in front and Struts in the back using Struts-Faces integration library (developed by Apache).
    So far I haven't faced any major issues with this approach. However, I haven't try using Struts validator on JSF objects.
    Read the article below on how to integrate JSF w/ Struts.
    http://www.oracle.com/technology/pub/articles/masterj2ee/j2ee_wk8.html

  • Schedule changes and validity dates for prices in product catalog(SRM-MDM)

    Hello!
    I'm working on a project that is going to use SRM-MDM and the question is if it is possible to schedule changes(for example to add new prices that have a validity period, can you make the changes now that are going to be valid from 1st of februari?Or can I add products today that are only going to be available to buy from a particular date?).
    The other question is if it is possible to have a validity period for prices and when the date is valid,then the product is shown in the catalog.In the same way that when the date is not valid, the product is not shown in the catalog.Can this be made automactically?Can a logic be build to choose which products are going to be shown in the catalog?
    Do you have any suggestions for those issues?
    Thanks in advance!

    Dear Poster,
    As no response has been provided to the thread in some time I must assume the issue is resolved, if the question is still valid please create a new thread rephrasing the query and providing as much data as possible to promote response from the community.
    Best Regards,
    SDN SRM Moderation Team

  • Problems when using shared instances of struts and apache-commons?

    I found this worrisome statement on this page (http://struts.apache.org/1.3.8/userGuide/configuration.html) regarding sharing jar files across multiple applications:
    <i>When a class is loaded from a shared class loader, static variables used within that class become global as well. This can cause inter-webapp conflicts when the underlying code assumes that the statics are global only within a particular web applicaiton (which would be true if the class was loaded from the webapp class loader). There are many cases where the framework, and the Commons libraries it relies on, use static variables to maintain information that is presumed to be visible only within a single web application. <b>Sharing these JAR files can cause unwanted interactions, and probably cause incorrect behavior</b>.</i>
    For those of you currently using Struts and Apache Commons (and perhaps other open source libraries) have you run into any issues when sharing the jars amongst multiple applications?
    I would like to avoid having multiple applications loading their own copies of these libraries, for obvious reasons.  However, if there are issues with doing so, I may have to relax that position.

    To answer my own questions, while we didn't run into any issues with sharing Struts, it may be a good idea to incorporate the libraries directly into the web app if suspicious behaviour is observed by the application.
    Also, the taglib definitions could not be loaded from the referenced jar files - these had to be placed into the WEB-INF directory, which introduces a synchronization problem - you could conceivably have different versions of the tld's and the base libraries.

  • I need to reset security question but the email that was saved for changing the password and security question is blocked , what can i do

    i need to reset security question but the email that was saved for changing the password and security question is blocked , what can i do?
    i purchased my account but i cant use that because apple ask me about security question and i forgot the correct answer

    Alternatives for Help Resetting Security Questions and/or Rescue Mail
         1. If you have a valid rescue email address, then use this procedure:
             Rescue email address and how to reset Apple ID security questions.
         2. Fill out and submit this form. Select the topic, Account Security. You must
             have a Rescue Email to use this option.
         3. This is the only option if you do not already have a valid Rescue Email.
             These are telephone numbers for contacting Apple Support in your country.
             Apple ID- Contacting Apple for help with Apple ID account security. Select
             the appropriate country and call. Ask to speak to the Account Security Team.
    Note: If you have already forgotten your security questions, then you cannot
             set up a rescue email address in order to reset them. You must set up
             the rescue email address beforehand.
    Your Apple ID: Manage My Apple ID.
                             Apple ID- All about Apple ID security questions.

  • How are valid-from and valid-to dates set in TRPROD table in APO during CIF

    First question:
    How are the valid-from and valid-to dates set in the APO TRPROD table?
    For example, if I activate a transportaion lane model on March 1, 2008, will the valid-from and valid-to in TRPROD be 20080301 and 99991231?
    Or are these dates defined in the model itself? Or in APO config somewhere?
    Next question:
    Suppose I rerun the model on May 1 2008 to add some records that didn't get added in the March 1 run.  But suppose I want to back-date the valid-from of these records to March 1, rather than use May 1 as the valid-from.
    Can this be done?
    Or is the valid-from always the date of the CIF that creates the TRPROD records?
    Please advise. 
    Thanks

    Hi Srinivas -
    Thanks very much for replying so quickly, but your response didn't answer the questions.
    Let me try again.
    1)
    If I run a CIF on March 1 2008 based on a model that will generate APO TLane data, will the TRPROD valid-from and valid-to get automatically set to 20080301 and 99991231?
    2) 
    If the answer to this question is yes, then is it also true that if I run a new set of records in on May 1, 2008 (no duplications with the original set), then the valid-from and valid-to dates will be 20080501 and 99991231.
    3)
    But if (1) and (2) are both true (if you answer them both "yes", then suppose I want the May 1 record set to have valid-from dates of March 1 (for example, if the May 1 record set includes records that didn't get included in the March 1 set due to an error in selection criteria).  How do I get the valid-from to be March 1 when I run the CIF on May 1?
    On the other hand, if (1) and (2) are NOT true, then how DO the two dates get set during a CIF ????
    Thanks
    djh

  • Macbook pro starts up but i see picture of some files and a question mark

    So I was on my laptop today and it just outta nowhere froze , the song i was listening stopped and i couldn't change the page, i could move the trackpad but nothing else.
    so i clicked on the off button and turned it off.
    then i tried to turn it on again but while loading it just stayed blank and this picture of some files and a question mark on them appeared, i have no idea what's going on.
    I turned it off again and turned it back on and the little apple appeared and it was loading but then a sign appeared like one of prohibited (the one that's a circle and has a slash across it) and idk what to do! i'm so frustrated all my school files are there and idk why this happened in the first place.
    i turned it off and just put it to charge.
    lately i've been using it a lot and i had a few things on when it froze , so im just gonna leave it off for a while but what can i do?
    how do u solve this? has anyone had this happened to their macbook pro already? i bought it just last year idk why this is happening.

    The folder and question mark means it cannot find a valid OSX Boot Volume, you need to Boot from your original install DVD (hold c at start) and then run Disc Utility from the top menu bar and run both 'Repair Disc' and 'Repair Permissions'. If it still doesn't boot from the internal hard drive then you need to boot from that install DVD again and do an archive (re)install of the operating system. (Your User data will be saved that way)

  • ARQ: Are "Valid From" and "Valid To" dates are considered for risk analysis???

    Hi All,
    I have one question w.r.t. risk analysis of user while raising a request in ARQ.
    I have noticed that, when a user is assigned 2 conflicting roles in a request (with "Valid From" and "Valid To" fields being the same), ARQ shows risk violations properly.
    This is quite logical, because user is assigned conflicting roles within the same dates.
    In another scenario, if a user is assigned 2 conflicting roles in a request (with "Valid From" and "Valid To" fields being different)
    Example:
    Time Administration : Valid From=15.06.2014 and Valid To= 31.12.2014
    Payroll Administrator: Valid From=20.06.2014 and Valid To= 31.12.2014
    ARA still shows as violations (in ARQ)! Though the "Valid From" dates are different.
    Logically, user is not assigned these roles at the same time to cause a risk violations. However, system is showing violations.
    May I know if validity dates are considered while performing risk analysis in ARQ? If no, then what could be the justification?
    Please advise.
    Regards,
    Faisal

    Rafal,
    Thanks for your reply.
    Does it mean that all future dates will be considered while analysis?
    OR
    Does ARA consider these dates?
    Regards,
    Faisal

  • J2EE, JSTL and JSF questions

    I am trying to learn J2EE/JSTL/JSF and have quite a few general questions. Any help on any of these is appreciated.
    1) Is there a way, just by using J2EE/Java to "manipulate" an XML file. Not just parse and read it's data but actually add nodes to the file?
    2) I've been reading quite a bit on JSTL and JSF recently. Is JSF supposed to be an alternative to Struts and JSTL an alternative to scriptlet coding?
    3) I am also working on creating a message board but throwing around a couple of ways to implement it. Either (a) using a database to store posts and a JSP interface or (b) using an XML document to store postings. Which of these two seem best or is there a better option?
    4) Is there an easy way to call Php from a Java program? I need to invoke a php program when a user clicks on a link on a JSP page I have.

    1) The SDK provides JAXP (Java API for XML Processing) in javax.xml package.
    2) I wouldn't call it 'alternative'.
    3) Your choice. I'd to use a RDBMS. Less overhead, better suited, (much) more functions and better performance.
    4) If that program is available on the web, then just invoke a HTTP request. If not, I'd rather to rewrite it to Java.

  • Newbie Struts ActionForm creation question in JDeveloper

    Hey guys,
    I am playing around with Struts and the JDeveloper functionality for that framework. So I am getting the hang of the diagramatic way of viewing the entire Web application by graphically creating the struts-config.xml file. That is great.
    But now I have a question. Suppose I have a simple Login jsp page and I created it using the Struts html tag library. So I guess I am to have a corresponding ActionForm object for that page. How does one go about creating an ActionForm object corresponding to a particular JSP page diagramatically in struts-config.xml? I hope my question makes sense.

    Hmm, I guess you just specify what ActionForm you are wanting to take the parameter values from by just editing the properties of the Action object itself. I think I figured out the answer guys. Thanks anyway.

  • Struts2 Validation Question

    I'm just starting on Struts and following a tutorial from a book that does validation. It uses xml config but I'm trying to get it to work with annotations. Everything seems to be right, including, on an error, it redirects to the right page. The problem is that the validation errors don't appear above the fields that have the problems, like they are supposed to. In fact, they don't appear anywhere. Strangely, if I put in the tag <s:fielderror /> then the correct errors appear where the tag is, but my understanding is that I do NOT need that tag and they SHOULD automatically appear under the appropriate fields.
    Here's my JSP:
    <s:form action="register">
         <s:textfield name="user.username" label="Username"/>
         <s:password name="user.password" label="Password"/>
         <s:textfield name="user.portfolioName" label="Enter a name for your portfolio"/> 
        <s:submit/>
    </s:form>Here's my Register action:
    @Results({
        @Result(value="/security/RegistrationSuccess.jsp"),
        @Result(name="input",value="/security/Registration.jsp")
    public class RegisterAction extends ActionSupport
        private User user; //we can use a user object and have the framework automatically instantiate it
        public String execute()
            getPortfolioService().createAccount( user );
            return SUCCESS;
        public User getUser() {
            return user;
        public void setUser(User user) {
            this.user = user;
        public void validate(){
            /* Retrieve our simple portfolio service object. */
            PortfolioService ps = getPortfolioService();
            /* Check that fields are not empty */
            if ( user.getPassword().length() == 0 ){       
                addFieldError( "user.password", getText("password.required") );
            if ( user.getUsername().length() == 0 ){       
                addFieldError( "user.username", getText("username.required") );
            if ( user.getPortfolioName().length() == 0  ){         
                addFieldError( "user.portfolioName", getText( "portfolioName.required" ));
            /* Make sure user doesn't already have an account */
            if ( ps.userExists(user.getUsername() ) ){     
                addFieldError("user.username", getText( "user.exists"));
        public PortfolioService getPortfolioService( )  {
            return new PortfolioService();
    }Edited by: JFactor2004 on Jul 2, 2010 6:12 AM

    I take it back. I just restarted eclipse and tried it again and it works fine. There seems to be some problem with eclipse and tomcat where the old versions of files don't seem to be replaced by new versions of them. Anyone else using eclipse + tomcat and noticing this?

  • Struts and JSF

    I have an Action from Struts. This controls the data in the code behind bean.
    After I call submit, how do I go Back to the Struts actions? the JSF navagation does not allow navigating to a servlet.

    Hey Shay,
    We have quite a large application based entirely on Struts. There is a keen interest in migrating to JSF, but in an incremental fashion. I did a fair amount of googling and almost everything i came up with , was purely theory oriented, are there any resources online , which clearly give examples/tutorials for doing a step by step migration to JSF from Struts. Couple of other questions that i dont seem to find an answer to with regards to the Integration of struts and JSF
    1) I understand BC4J, struts and JSF can be integrated together, does the same hold for ADF ? there was a similar forum post back in 2005 , where they said this is yet to be done, do we have this integration with Jdev 10.1.3 ?
    2) If i were to use only the jsf UI component tags as a first step in my struts application , what is the equivalent for the page definition file of JSF in struts, as in how would i achieve the binding ?

Maybe you are looking for

  • Can I Run Apple TV through my XBOX 360?

    Can I Run Apple TV through my XBOX 360? I have an older TV about 10years old. But I like to get Apple TV I was wondering since i have my Xbox 360 running into my TV already would i be able to run Apple TV through it  Since my TV does not have HDMI on

  • Credit limit sharing main customer and sub customers

    Dear all Credit limit sharing main customer and sub customers. we have hierarchy to identified main cutomer and sub customers and different account groups. now in system we are using main customer payer for all sub customers also. in future we are go

  • Installing Windows Media

    I have just switched from a PC to my new iMac and love it! However, I can't seem to play small video clips, gif animations, wmv, etc. I tried downloading Windows Media Player from www.mactopia.com and when I open the application I receive a message "

  • GATP - Checking Multiple Storage Loations

    Hello, We have a requirement to check for stock at multiple storage locations within a plant. On order entry, they want to use our default Storage Location (SLOC001), which is the one we ship out of. If there is no stock available there, they want th

  • Can I create another client in SAP BI?

    Hi, I have a BI system installed on client 150. I want to create another client for sandbox. Is it possible in BI? In R/3 I know it is possible. Regards, Shailesh Naik