<kbd id="9plqc"><label id="9plqc"></label></kbd>

        <th id="9plqc"></th>
        1. <center id="9plqc"><video id="9plqc"></video></center>
          <sub id="9plqc"><form id="9plqc"><pre id="9plqc"></pre></form></sub>
          <nav id="9plqc"><form id="9plqc"><legend id="9plqc"></legend></form></nav>
          Hibernate è???¤????è?3?????????éa?èˉ?é???±? 您所在的位置:網(wǎng)站首頁(yè) 屬雞和屬牛生個(gè)什么寶寶合適女孩 Hibernate è???¤????è?3?????????éa?èˉ?é???±?

          Hibernate è???¤????è?3?????????éa?èˉ?é???±?

          2023-07-21 18:33| 來(lái)源: 網(wǎng)絡(luò)整理| 查看: 265

          ?3¨é????o?°??éaèˉ

          developerWorks ???£éé?1 ?°?-¤é?μ????o?μ?-é?????é

          ?°?-¤é?μ????o?μ?-é?????é

          ??·????£??

          ??± Tomcat ?o?¨

          ??è?? IBM ???o J2EE ?o?¨????¨ WAS CE ?°??? V1.1

          ?o§??: ??-?o§

          Ted Bergeron ([email protected]), ?????§?oo, Triview, Inc.

          2006 ?1′ 10 ? 10 ?¥

          ?°?????¨ Web ?o?¨?¨?o??-?°??ˉè??¤??±?????-???o?°??éaèˉé???éè|?????ˉè???·??′é???è??????¥è3?o???¤????oo?é????12è????¥è???a?-¥éa¤ aa è??ˉè????ˉ?è′????¤§éé?é¢??o§?????ˉé???°???? Java ?13?°??-???¥?o?3¨é??éaèˉ?????????¤?o??¨?????-??Ted Bergeron ?°??¨?????|??????¨ Hibernate Annotations ? Validator ??????¨ Web ?o?¨?¨?o??-è???????o?1???′?¤éaèˉé?è??

          ?????????§?·¥?·?????ˉ??¥??-£???è?3????oo????????é?±?????oo??¨??????????è??è??§?·¥?·???¤??°±?ˉ??¥?¨èa?·±??o?¨?¨?o??-???§????¨è??§?·¥?·??è?o???¥èˉ′??è??§?·¥?·?¨????oo?è±è′1?¤§é??é′?¥??????¨?3?1??°±?ˉ??¥????-è·????????1?????¢è??§?·¥?·??????o???ˉ??¥?°????oo??ˉ???′é??è?o?±???????°?Hibernate Annotations ? Validator ??????°±?ˉ???§è???·??·¥?·?

          ???§?1?éè|?oè§£????1

          ?¨éèˉ?????1????oèˉ¥?ˉ1 Java ?13?°??? 5???°¤???ˉ?3¨é???JSP 2.0??????o?????-???o?o???o???-????????1??¨ TLD ??-???1?o???o???°???????é??ˉ JSP 2.0 ??°?1?§??? Hibernate ? Spring ?????????a?o????oè§£?èˉ·?3¨??3?????????¨ Hibernate ?¥???°??1?§???1?ˉ??¥?¨èa?·±??o?¨?¨?o??-????¨ Hibernate Validator?

          Java SE 5 ??o Java èˉ-è¨????o???¤éè|??¢??o?è?????è??????¢??o?è??ˉè?é????| ?3¨é è???·????·¨?¤§?????¨ ?3¨é???????°±???o?·??o????a???????o§???°????????o Java ?±?????¨?Hibernate ?¨?·??·¥??? *.hbm.xml ?????·2?????¤?1′?o???è????¨ XDoclet ?¥èa?¨???°è???a?????????|???·¥???o?o XML ??????é£?°±??é???ˉ1?ˉ??a?éè|???1?±?§é??′?°è???¤??a???????±????1? XML ???°???£???????¨ HibernateDoclet ?ˉ??¥???è???aè??¨??èˉ·????? 1 ???o????-???????ˉè?éè|???????è?¤èa?·±? HibernateDoclet ????ˉ?è|????¨? Hibernate ?????doclet ????ˉ?¨è?è????1?ˉ???ˉ?¨???????o??è¢?????°?o Javadoc é£?????3¨é??-?o?Hibernate Annotations???|?? 2 ??¤o??éè????????a???????????°?±???1?3???·????è?è????ˉ?¨?§?¥?ˉ1è??o?1??è?è??1è??

          ??? 1. ????¨ HibernateDoclet ? Hibernate ???°??£?? /** * @hibernate.property column="NAME" length="60" not-null="true" */ public String getName() { return this.name; } /** * @hibernate.many-to-one column="AGENT_ID" not-null="true" cascade="none" * outer-join="false" lazy="true" */ public Agent getAgent() { return agent; } /** * @hibernate.set lazy="true" inverse="true" cascade="all" table="DEPARTMENT" * @hibernate.collection-one-to-many class="com.triview.model.Department" * @hibernate.collection-key column="DEPARTMENT_ID" not-null="true" */ public List getDepartment() { return department; } ??? 2. ????¨ Hibernate Annotations ? Hibernate ???°??£?? @NotNull @Column(name = "name") @Length(min = 1, max = NAME_LENGTH) // NAME_LENGTH is a constant declared elsewhere public String getName() { return name; } @NotNull @ManyToOne(cascade = {CascadeType.MERGE }, fetch = FetchType.LAZY) @JoinColumn(name = "agent_id") public Agent getAgent() { return agent; } @OneToMany(mappedBy = "customer", fetch = FetchType.LAZY) public List getDepartment() { return department; }

          ?|?????¨ HibernateDoclet??é£?1?′?°?? XML ?????è?è????è??è·éèˉˉ?????¨ ?3¨é???¨??èˉ???°±?ˉ??¥?£?μ?o???¤éèˉˉ???è?|??¨??è???????¨?o???¥?? IDE??é£?1?¨??è????°±?ˉ??¥?£?μ?oé¨?éèˉˉ??¨???¤′???o?o?¨?¨?o?????ˉ??¥???¨ hbm2ddl ?·¥?·??oèa?·±??°???o?? hbm.xml ??????-?? DDL????oéè|?????ˉ aa ?ˉ?|name ?±?§???¤§é??o|??é???ˉ 60 ??a?-??|???è DDL ?oèˉ¥?·???é??o?o|? aa é?è¢??? HibernateDoclet é?1?·????° DDL ??-???????¨?3¨é?????????ˉ??¥??¥?±??????1??èa?¨?? DDL?

          ?°????è???¤?§??£?????°?1??é??ˉ??¥????¨????è??3¨é??????′??o????????¨?3¨é???ˉ??¥?¨???o???é?¥???é??o|??????????èˉ??a?ˉ?é?o|?′??????1?????éè|?? XML ?????????-??¤§??????ˉ?ˉ??¥è??é????o??¨????ˉ?????|è?è????é??o?3¨é?é??o|?é¤?o??? 2 ???o??3¨é?1?¤??è??ˉ??¥??????oéaèˉ??o|???????é¨??o|??|????

          @Max(value = 100) @Min(value = 0) @Past @Future @Email

          ?¨é???????????è??o?3¨é????èμ·?± DDL ???£?¥?o|??????????@Future ?1????ˉ????aé???????????è??ˉ??¥??1??éè|???o?????o|??3¨é?

          éaèˉ??o?¨?¨?o?±

          ???éaèˉ??£???ˉ????a?|?oo??è???è??¨?é????????¤????oo?é????????¨?1????±è?è????§éaèˉ????è?ˉ??¥è????o??é′?????ˉ?è????é′?ˉ?|è??¤??¥è?¥?¨è???a?°?1??????¥é¨??è????èμ·???oé·?′é????????¢è?¨??|??¨???o?¨?¨?o?±??-???o?1???′?¤éaèˉ?éè|???é′?ˉ??¥??¤§?°??°??é£?1?oè?o??|?1?°±??è????ˉ?|è|?¨?¤??a?±?????-è?è????§éaèˉ??è???????a?o?¨?¨?o????è???¨?·????¨????a?¨?·???ˉ???????¨???·?¥???o????a???·??¨è???a?o?¨?¨?o??-????è?è?éaèˉ???????|????

          è§???? éè? JavaScript è?è?éaèˉ?ˉ??¥é????????¨??¤è?è??o¤?o??è???·?ˉ??¥????′?¥???¨?·??éa??¨?·?ˉ??¥?|?¨ JavaScript?????-¤è???a?±????éaèˉ??¥?è|??????ˉ?′?1????ˉé???ˉ1?éè|??è?è?????éaèˉ?ˉ??é???? ?§???¨?? éaèˉ??é???¨????¨??ˉ?é?è???-è?è??¤??è???a?±?????-???£???ˉ??¥??¥é????a?1???¨é??1???¤?éaèˉ????|???¨?·????°?¨?·?????§???¨?ˉ??¥?¨è?è??¤??1??£?¥?????¨?·??ˉ?|?·2???-?¨? ????? ???ˉ1?¤??????é?è?éaèˉé???é??é????°????±??-????|?????|?????a????¨???ˉ1è±??èμ·?¥?????°±?oèˉ¥????¨????¨???¤?????ˉ1è???a????¨???????ˉè?è????è?¤? DAO?? ?¨?°???°è??è???a?±????????oèˉ¥?·2???ˉ????o??°?????|?-¤???§è?????????é?£?¥??è??????éè|??é?é??o?1??????1é??¨?1???è?′?éμ??a?1?????????????| e-mail ?°???°±?oèˉ¥???????a??? e-mail ?°????1?ˉé????????¨?-¤?¤?è·éèˉˉ???ˉ?o§??ˉ??¥é??? SQLException éèˉˉè|?¥?? DBMS?? è??ˉé????ˉ??¥????¥éaèˉ??°?1??3???????-£?¨???o??o?¨?¨?o?ˉ?°???o??????¢?·?o???°?¥è??ˉè????·?????????¢?·?o??|??o?¨?¨?o????o bug???¤§é¨??o?¨?¨?oé??ˉè???? bug????é£?1?????°???1?ˉè???è¢??é???°???o??¨è??§??μ??-???|?èμ°è????°±?ˉ??¥???°?????°?????1???éè|??è??o?°???ˉ?|?ˉ??¥??é¤????¥??|????é¤? ?¨???? è??ˉè?è?éaèˉ?????a??3?°?1??????éè|è??é??¤é¨??????1??éè|?oè§£??1?§?°??????|???????é?è??ˉè???è|?±?¨?·è3?°???????aè?3?????ˉ??è??ˉ??¥?ˉ????a?μèˉ?·???1?ˉ??¥?ˉ????a e-mail ?°????ˉ??¥????¨?¨???±?éaèˉ?¥??????¨?·????????oè??§????ˉ?

          è?è?éaèˉ????§????1?3?ˉ?ˉ1????éaèˉ????¨ Commons Validator???1??¨?§???¨??-??????????oéaèˉé?è??Commons Validator ?ˉ??¥?? JavaScript ?¥?ˉ1è§????-?éaèˉè?è??¤?????ˉ Commons Validator ?1?èa?·±???oé·?????aè??¤?????éaèˉé?é¢???1????°éaèˉ?????ˉé????-?°?o XML ??????-?Commons Validator è¢?è??è???¨?¥?? Struts ??èμ·????¨??è???2????????§?????1?3?¨?o?¨?¨?o?±é′é?¨éaèˉ??£°??

          ?¨è§????§éaèˉ?-?¥????é???¨éèˉˉ????????°?¤?è??oéèˉˉ?ˉè?è????¤?????§èˉ?¥??è??è?????è?è|éè???????a??¥???¨?·?é¢?¥é2?-¢?o?°éèˉˉ?é?¨é¢?è?è???1?3è?è?éaèˉ?ˉ??¥??¤§?°?¢??o?¨?·?ˉ1?o?o?¨?¨?o??è§£????1???ˉ??Commons Validator ?1??2???ˉ1?-¤????ˉ???è????? HTML ????è?????????? maxlength ?±?§?¥??éaèˉ?1é???è?¨?????1?????????a????·??%???¥è?¨?¤oè|è??¥????ˉ????é?????è??o????ˉé?è¢????????° HTML ???£??-?o??|??3??????1 name ?±?§?¥?ˉ? 75 ??a?-??|??è???ˉ 60 ??a?-??|??é£?1éè|?1?¨?¤?°?°?1?¢???¨???¤?o?¨?¨?o??-??é???é?éè|??

          ?′?° DDL ?¥?¢?¤§?°???o??é??o|??éè? HibernateDoclet? hbm.xml ? Hibernate Annotations??? ?′?° Commons Validator XML ?????°??¤§???¢???° 75? ?′?°????è???a???3? HTML è?¨?????¥????1 maxlength ?±?§?

          ?′?¥???1?3?ˉ????¨ Hibernate Validator?éaèˉ????1é?è¢?éè??3¨é ?·????°?o?¨???±??-?????è???ˉ1?????éaèˉ?¤???ˉ???|?é???????¨??? Hibernate??è???a Validator ?°±?ˉ??¥?¨ DAO ? DBMS ?±?1???éaèˉ??¨??é¢???o???·????£????-???°????¨ reflection ? JSP 2.0 ???-??????¤?§è?????a?-¥éa¤????è?????¨?3¨é ??oè§???±?¨?????£???è??ˉ??¥??é¤?¨è§????-????¨????????????é?è??

          ?¨??? 3 ??-??dateOfBirth è¢??3¨é??o NotNull ?è?????¥?? Hibernate ? DDL ????£???ˉ1è???a??·????o????aé??o?o|?????¥?????aè|?±?¥???é???ˉ?1??¥???£?¥?o|??e-mail ?°??1?ˉé??o?????é???1é e-mail ?°????????è?????????aé??o?o|??????ˉ???????1éè??§???????£?¥?o|??

          ??? 3. éè? Hibernate Annotations è?è????°????è?3??1?? /** * A Simplified object that stores contact information. * * @author Ted Bergeron * @version $Id: Contact.java,v 1.1 2006/04/24 03:39:34 ted Exp $ */ @MappedSuperclass @Embeddable public class Contact implements Serializable { public static final int MAX_FIRST_NAME = 30; public static final int MAX_MIDDLE_NAME = 1; public static final int MAX_LAST_NAME = 30; private String fname; private String mi; private String lname; private Date dateOfBirth; private String emailAddress; private Address address; public Contact() { this.address = new Address(); } @Valid @Embedded public Address getAddress() { return address; } public void setAddress(Address a) { if (a == null) { address = new Address(); } else { address = a; } } @NotNull @Length(min = 1, max = MAX_FIRST_NAME) @Column(name = "fname") public String getFirstname() { return fname; } public void setFirstname(String fname) { this.fname = fname; } @Length(min = 1, max = MAX_MIDDLE_NAME) @Column(name = "mi") public String getMi() { return mi; } public void setMi(String mi) { this.mi = mi; } @NotNull @Length(min = 1, max = MAX_LAST_NAME) @Column(name = "lname") public String getLastname() { return lname; } public void setLastname(String lname) { this.lname = lname; } @NotNull @Past @Column(name = "dob") public Date getDateOfBirth() { return dateOfBirth; } public void setDateOfBirth(Date dateOfBirth) { this.dateOfBirth = dateOfBirth; } @NotNull @Email @Column(name = "email") public String getEmailAddress() { return emailAddress; } public void setEmailAddress(String emailAddress) { this.emailAddress = emailAddress; } ??·???o?¨?¨?o ?¨ ??è?? ??è???¨?ˉ??¥??è??????a??·???o?¨?¨?o?????±?¤o?o?????-é?¨?è??è????3???£????±?oè??ˉ????a?ˉ??¥?·¥????o?¨?¨?o?????-¤??£???ˉ?????-è?¨è?o?????1?′??o?¤?????|????? 9 ?°±èé?o???-????? text.tag??è???a??·???o?¨?¨?o?·????-?????????¨?????£??????¥?????????a?±????????-?????????¨???£?????¨?oé???éè??£?¥??? HTML ??′?????±?oè??ˉ????a?ˉ??¥?·¥????o?¨?¨?o????????o????a?¨è??§?±????o?¨?¨?o??-é??ˉ??¥???°?????è??????a Ant ???o?????Spring ? Hibernate XML ?°è£??£??????¥? log4j é????è???è??oé????ˉ????????é?1?????ˉ?¨????°?????????????è???a??·???o?¨?¨?o??o??£???ˉé?????¨??

          ?|?éè|??Hibernate DAO ???°?1?ˉ??¥????¨ Validation Annotations??é???ˉ?¨ hibernate.cfg.xml ??????-????o?o Hibernate ?o????éaèˉè§?????′?¤????ˉèˉ·?è Hibernate Validator ????£???ˉ??¥?¨ ?èèμ? ??è??-???°???3?é??¥????|???°????è?è·ˉ???¨?ˉ??¥?a?è·?????§???¨??-? InvalidStateException ????????1???a?ˉé? InvalidValue ?°???

          ?ˉ1?§???¨?·???éaèˉ

          è|?§è?éaèˉ??éè|???o????a Hibernate ? ClassValidator ?????è???a?±?è?è?????????£??·?ˉè?????é??????-¤??¥??a?ˉ1???è?è?éaèˉ??ˉ??a?±??¥è?è??????????§?1?3?ˉ???o????a???¨?·¥?·?±????ˉ1?ˉ??a?¨???ˉ1è±??-?¨????a ClassValidator ???????|??? 4 ??¤o??

          ??? 4. ?¤?éaèˉ????¨?·¥?·?±? /** * Handles validations based on the Hibernate Annotations Validator framework. * @author Ted Bergeron * @version $Id: AnnotationValidator.java,v 1.5 2006/01/20 17:34:09 ted Exp $ */ public class AnnotationValidator { private static Log log = LogFactory.getLog(AnnotationValidator.class); // It is considered a good practice to execute these lines once and // cache the validator instances. public static final ClassValidator CUSTOMER_VALIDATOR = new ClassValidator(Customer.class); public static final ClassValidator CREDIT_CARD_VALIDATOR = new ClassValidator(CreditCard.class); private static ClassValidator 1.0 form formtags text /WEB-INF/tags/form/text.tag determine if field is required from Annotations required com.triview.web.Utilities Boolean required(java.lang.Object,java.lang.String)

          ??? 7 èéèa Utilities ?±???????-????o???-?????????¨??????°??¨????-????????èˉ′è????é?????¨ Java ??£????????£??é?è¢????°?o????a TLD ?ˉ??¥???°????°??-??è???·???-??????°±?ˉ??¥????¨??????o??è??o???°é??ˉ?¨ Utilities ?±???-è?è??????????-¤??????éè|????·??è¥??????1è??o?±?? TLD ?????Utilities ??-????°????¥????-???????èo????èè|????¨è??o???°?????????·?oèˉ¥?ˉ????¨è???a???-?????? JSP é?μé¢???

          ?¨??? 7 ??-?????o?o?¨ TLD ??-???¨????°??|?¤????aè?¨?¤o?????±?§?ˉ?|?ˉ Date ??1?3??¨è???a?±???-è|????°?ˉè??¤???£???????ˉ???é?o?ˉ?1?????????o?????£??????è?éè|?3¨? findGetterMethod() é¤?o?°è?¨è????èˉ-è¨??Expression Language??EL???1?3è?¨?¤o??customer.contact??è???¢? Java è?¨?¤o??customer.getContact()???1?¤??è??§è??o?o??????????

          ??? 7. Utilities èé public static Boolean required(Object object, String propertyPath) { Method getMethod = findGetterMethod(object, propertyPath); if (getMethod == null) { return null; } else { return getMethod.isAnnotationPresent(NotNull.class); } } public static Boolean isDate(Object object, String propertyPath) { return java.util.Date.class.equals(getReturnType(object, propertyPath)); } public static Class getReturnType(Object object, String propertyPath) { Method getMethod = findGetterMethod(object, propertyPath); if (getMethod == null) { return null; } else { return getMethod.getReturnType(); } }

          ?-¤?¤?ˉ??¥???¥?°??°?¨è?è???????¨ Validation annotations ?ˉ?¤?1??1???ˉ??¥????°???¨?ˉ1è±?? getter ?1?3???1??£?¥è???a?1?3?ˉ?|????3???????3¨é ?

          ??? 8 ??-???o? JSP ???-è?è??o?????è???·?°±?ˉ??¥?é?¥????3?é¨??o??-¤?¤??è?é?????aè?¨??????????aé???????¤??aè??¥????è??o?é??ˉéè??¨ form.tld ??????-?£°?????-?????è?è???°?????-?????è¢?è??è???????¨?oè???o?????è???·?°±?ˉ??¥??1??éè|?è?????????? JSP ?ˉ??¥????1?′?¤????ˉ?éé?1??3é???±?§?ˉ propertyPath????????¨ EL ??|?·?°è???a????°??o?¨???±?±?§???°±??ˉ????¨ Spring MVC ? bind ???-?????·?

          ??? 8. ????a???è?¨????? JSP é?μé¢ Help

          text.tag ????????′?o??£???¤a?¤§?o?????¥????¨è????????-¤??? 9 ???o?o????-?3é??é¨???

          ??? 9. ???-????? text.tag èé calendar Calendar.setup( { inputField : "${status.expression}", // ID of the input field ifFormat : "%m/%d/%Y", // the date format button : "${status.expression}_button" // ID of the button } );

          error${status.errorMessage}

          ????é?????°±?ˉ??¥??o propertyPath ?ˉ???éè|??±?§?size? maxlength ? required é??ˉ??¥????¥?objectPath var è¢?è???????o?¨ propertyPath ??-???¨??±?§????ˉ1è±?????-¤???|? propertyPath ?ˉ customer.contact.fax.number?? é£?1 objectPath ?°±?oèˉ¥è¢?è???????o customer.contact.fax??????°?¨?°±????¨ Spring ? bind ???-??????°?o????±?§??ˉ1è±????è????°?ˉ1è±??éè???????ˉ1????±?§?????????¨??¥???¥???£?¥è???a???-???¨?·?ˉ?|?·2???????/?¥1????ˉ?|????±?§?ˉ??é?????è??è?¨?????oo?è|????3¨é??-è??????ˉé???éè|???????o?????/?¥1??????è???§???¨??o?éè|??è???????o?????è?¨?·?ˉè??1????????oè???a????????|?è?¨?????oo??2????o required ???????é£?1?°±?ˉ??¥è°?¨è???aè?¨? TLD ? required ???°?è???a???°è°?¨?o?¨ TLD ??????-???°??1?3?è???a?1?3????°?£?¥ @NotNull ?3¨é???|?????°???a?±?§?·?è???a?3¨é???°±?° labelClass ?éè???????o??é?????ˉ??¥?±?????°??????-£???? maxlength ??¥?è???a??ˉ?|?ˉ????a Date?

          ?¥???¥????¨ Spring ?¥?????° propertyPath ????è???ˉ??é¢????·?a?????°???è???a?±?§??ˉ1è±????è??è???¨?? label ? input HTML ???-???????¨ status.expression ? status.value? input ???-??1?ˉ??¥????¨????a?¤§?° maxlength ??¥?é????±??¥????|??é¢?·2????????±?§?ˉ????a Date???°?¨?°±?ˉ??¥?·??? JavaScript ?¥??o????ˉ??¥?¨ ?èèμ? ??è???°????a???¥???¥???????é??¥????3¨???1??éè|é??¥?±?§?è??¥ ID ???? ID ????-??ˉ?¤?1??????è???a JavaScript ?¥?éè|????a??? ID ?¥?1éè??¥?????????ˉ _button?

          ?????ˉ??¥?° ?°è£?°????a span ???-???-??è???·?è??è?¨?????oo??¨é?μé¢??-?·????????????????|?¨?¥?ˉ??±???????????????? 8 ???o?o????a??o????¨???·??·???????????????????é¨??ˉ?£?¥ Spring ?ˉ?|??oè???a?±?§?¥?????¤o?o????aéèˉˉ???1??????aéèˉˉ??????èμ·???¤o?

          ????¨ CSS???°±?ˉ??¥?ˉ1??é????è?è?????è£é¥° aa ???|??è?????????¥?o¢è2???¤o??¨???è?1?????¤o????a??·???è????¨????aè?ˉ????¥è£é¥°????¨??? 10 ??-???°??é????????-?è??????é?è2??è???é¢???¤o????a?o¢è2???·???¨ Firefox ??¥????????????1??μè§?¨??-?????|??ˉ?¨ IE ??-?è????¨?·|è?1????????a?°??-?è?ˉ?????

          ??? 10. ?ˉ1??é???è?è?è£é¥°? CSS ??£?? label.required { color: black; background-image: url( /images/icons/flag_red.png ); background-position: left; background-repeat: no-repeat; } label.required:after { content: '*'; } label.optional { color: black; }

          ?¥?è??¥?èa?¨???¨?3è?1????????a JavaScript ?¥???????ˉ1???????è??????-£???? maxlength ?±?§?ˉ??¥é2?-¢?¨?·è??¥?¤a?¤??????èμ·?éèˉˉ??ˉ??¥???± text ???-??¥??oè??¥??±?è???????????°???±????ˉ??¥????1 text ???-?????¨ HTML??è???ˉ XHTML???|????è???·????ˉ??¥???¤aè′1??°è·???·??-£???èˉ-?1? HTML è?¨???è????é?-|?1??o?o???????????¥èˉ???°±?ˉ??¥???¨?o?o?????? Web ????????1?

          ?°???????-???????? HTML ?????ˉ??¥?????é2?-¢???oéèˉˉ??o§??????ˉ?¨è§???±?1??2?????????£???¥??-£è?è?éèˉˉ?£?¥??±?o?ˉ??¥????¨?±??±?§???°?¨?°±?ˉ??¥?·??????o???? JavaScript ?¥???°è??§?è??o???|??? 11 ??¤o?è?é? JavaScript ?1?ˉ??¥?ˉé?¨????¨?????è?¨???-é??ˉ??¥é?¨?

          ??? 11. ???? JavaScript éaèˉ?¨?o function checkRequired(form) { var requiredLabels = document.getElementsByClassName("required", form); for (i = 0; i < requiredLabels.length; i++) { var labelText = requiredLabels[i].firstChild.nodeValue; // Get the label's text var labelFor = requiredLabels[i].getAttribute("for"); // Grab the for attribute var inputTag = document.getElementById(labelFor); // Get the input tag if (inputTag.value == null || inputTag.value == "") { alert("Please make sure all required fields have been entered."); return false; // Abort Submit } } return true; }

          è???a JavaScript ?ˉéè???oè?¨??£°??·??? onsubmit="return checkRequired(this);" è¢?è°?¨??è???aè??????°è·??·??éè|??±??è?¨???-?????′???±?o??????1??ˉ?ˉ?¨???-???è?°??-????¨è???a?±??????-¤??£????éè? for ?±?§?¥?¥????è???a???-?è??¥?¨??èμ·?è??¥???|??????è??¥???o??o???°±????????????è-|????ˉ??è?¨???o¤?°±???????ˉ??¥????°?ˉ1è???aè??è?è???????????????¤??a?±????1????o?°è?è?éaèˉ?

          ?ˉ1?o?o?o JavaScript ??????éaèˉé??¥èˉ′????¥??ˉ????¨???o???°??è???ˉèaè??????¨??? 8 ??-?¨?ˉè??·2???3¨??°??é¢???£????

          οnclick="new Effect.SlideDown('creditCardHelp')"

          è???a???°?ˉ Script.aculo.us ?o???é¨???è???a?o????o???¤é??o§?????|??-£?¨????¨ Script.aculo.us???°±éè|?ˉ1????o????1????¨ Prototype ?o? JavaScript éaèˉ?o?????a???-?ˉ?± Andrew Tetlaw ?¨ Prototype ?o???????o????èˉ·?? ?èèμ? ??è??-?é??¥????????????èμ?oè¢??·????°è??¥???±???

          ?ˉ??¥????°????1 text.tag ?é?è??¨ input ???-???-??¥????a?±???° class="required" ?·????°è??¥???-?? label ???-???-??????±? CSS è§?????????′???? 10 ??-???o???? JavaScript éaèˉ?¨?o??|?è|?··?????¨??????-???£??????? JavaScript ??£??????¥?????¨?????±??????¨????¨?±????′¢??′?????????±?????1??£?¥???-??±???



          【本文地址】

          公司簡(jiǎn)介

          聯(lián)系我們

          今日新聞

          推薦新聞

          專題文章
            CopyRight 2018-2019 實(shí)驗(yàn)室設(shè)備網(wǎng) 版權(quán)所有
            黄色免费网站在线看,韩国精品在线观看,韩国美女一区二区,99国产热 安国市| 右玉县| 葫芦岛市| 商城县| 太湖县| 神池县| 永年县| 贡嘎县| 玉环县| 九寨沟县| 沽源县| 嘉禾县| 那曲县| 公主岭市| 珠海市| 城口县| 安顺市| 大关县| 榕江县| 新蔡县| 东至县| 沙湾县| 呼图壁县| 塔城市| 黑水县| 公安县| 金坛市| 泊头市| 江津市| 霍林郭勒市| 沂南县| 曲周县| 平潭县| 陕西省| 阜平县| 庆元县| 红原县| 皋兰县| 调兵山市| 扶沟县| 桐城市| http://444 http://444 http://444 http://444 http://444 http://444