Matt RaibleMatt Raible is a Java Champion and Developer Advocate at Okta. developer.okta.com

The JHipster Mini-Book The JHipster Mini-Book is a guide to getting started with hip technologies today: Angular, Bootstrap, and Spring Boot. All of these frameworks are wrapped up in an easy-to-use project called JHipster.

This book shows you how to build an app with JHipster, and guides you through the plethora of tools, techniques and options you can use. Furthermore, it explains the UI and API building blocks so you understand the underpinnings of your great application.

For book updates, follow @jhipster-book on Twitter.

10+ YEARS


Over 10 years ago, I wrote my first blog post. Since then, I've authored books, had kids, traveled the world, found Trish and blogged about it all.

Struts Update: 1.1 beta 3 to 1.1 RC1

While upgrading Hibernate last night and this morning, I also upgraded Struts. Now I'm having some issues there, so I'd better document those too. First of all, the following line doesn't seem to be rendering any client-side JavaScript anymore:

<html:javascript formName="resumeForm"
      dynamicJavascript="true" staticJavascript="false"/>

Update 1: Nevermind, it seems my Internet connection went dow while starting Tomcat. Since the Digester couldn't validate the Struts' XML configuration files with their respective DTDs, it stopped them from loading.

Update 2: This turned out to be a legitimate issue. Adding cdata="false" to the above tag enabled the browser to see the JavaScript by removing the "<![CDATA[" after <script type="text/javascript">

Revisiting the Hibernate upgrade, I needed to add dom4j.jar to WEB-INF/lib to solve java.lang.NoClassDefFoundError: org/dom4j/Node.

Now I'm getting:

java.lang.NoClassDefFoundError
	at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:571)

What the @#$*%#? hibernate2.jar is in WEB-INF/lib??

Update 3: I had to add cglib.jar to WEB-INF/lib as well. Now back to an issue I'm having with the Validator where client-side validation is working when I click "cancel" (as in, it's disable), but server-side is kicks in. Argghhhh!

Update 4: I found an issue (via the struts-user list) about using the Validator with LookupDispatchAction. It basically doesn't allow you to control validation on a method level, so I've hacked the following workaround.

I changed <html:cancel> to be <html:button> and added onclick="cancel()", where cancel() is the following JavaScript method:

<script type="text/javascript">
function cancel() {
    location.href = '<html:rewrite forward="cancelUser"/>';
}
</script>

The "cancelUser" forward points to "/editUser.do?action=Cancel", which is an action-mapping that doesn't have validation (validation="false") and this hits the "cancel" method on UserAction and routes appropriately.

Phew - I'm beat. I never realized being an upgrade-happy-keyboard-monkey could be so much work!

Posted in Java at Feb 24 2003, 11:10:46 AM MST 4 Comments
Comments:

I think if 2 fields have a relation it's quite easy add them into a bean (i.e. Login) that contains both and then make a usual validator (both JavaScript and Java) checking interrelation??? Example: We have 2 dates having Date1 > Date2 So WtoDates.Date1 WtoDates.Date2 No we can use an empty property (i.e. WtoDates.test) just to call the validator Opinions???

Posted by Dimi on January 16, 2004 at 05:57 AM MST #

Where is new validator package supporting validwhen. Thanks.

Posted by javaok on June 28, 2004 at 11:39 PM MDT #

help me!I meet error,please. StandardContext[/hr]action: null java.lang.ClassNotFoundException: org.apache.struts.validator.ValidatorPlugin at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1366) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1213) at org.apache.struts.util.RequestUtils.applicationClass(RequestUtils.java:119) at org.apache.struts.util.RequestUtils.applicationInstance(RequestUtils.java:145) at org.apache.struts.action.ActionServlet.initModulePlugIns(ActionServlet.java:816) at org.apache.struts.action.ActionServlet.init(ActionServlet.java:332) at javax.servlet.GenericServlet.init(GenericServlet.java:256) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1044) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:887) at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3948) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4271) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1125) at org.apache.catalina.core.StandardHost.start(StandardHost.java:816) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1125) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:518) at org.apache.catalina.core.StandardService.start(StandardService.java:519) at org.apache.catalina.core.StandardServer.start(StandardServer.java:2343) at org.apache.catalina.startup.Catalina.start(Catalina.java:581) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:297) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:398) StandardContext[/hr]Marking servlet action as unavailable StandardContext[/hr]Servlet /hr threw load() exception please tell me how to overcome it! addtion <!-- edited with XMLSPY v5 rel. 2 U (http://www.xmlspy.com) by rth77 (rth77) --> <!DOCENGINE form-validation PUBLIC "-//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.0//EN" "http://jakarta.apache.org/commons/dtds/validator_1_0.dtd"> <form-validation> <formset> <form name="/search"> <field property="sfzbh" depends="required,minlength,maxlength"> <arg0 key="label.IDcard"/> <arg1 name="minlength " key="${var:minlength}" resource="false"/> <arg2 name="maxlength " key="${var:maxlength}" resource="false"/> <var> <var-name>minlength</var-name> <var-value>15</var-value> </var> <var> <var-name>maxlength</var-name> <var-value>19</var-value> </var> </field> </form> <form name="/insert"> <field property="mz" depends="required"> <arg0 key="label.mz"/> </field> <field property="phone" depends="required,minlength"> <arg0 key="label.phone"/> <arg1 name="minlength " key="${var:minlength}" resource="false"/> <var> <var-name>minlength</var-name> <var-value>8</var-value> </var> </field> <field property="jtdz" depends="required"> <arg0 key="label.jtdz"/> </field> <field property="jg" depends="required"> <arg0 key="label.jg"/> </field> <field property="sfzbh" depends="required,minlength,maxlength"> <arg0 key="label.IDcard"/> <arg1 name="minlength " key="${var:minlength}" resource="false"/> <arg2 name="maxlength " key="${var:maxlength}" resource="false"/> <var> <var-name>minlength</var-name> <var-value>15</var-value> </var> <var> <var-name>maxlength</var-name> <var-value>19</var-value> </var> </field> <field property="sg" depends="required"> <arg0 key="label.sg"/> </field> <field property="tz" depends="required"> <arg0 key="label.tz"/> </field> <field property="htbh" depends="required"> <arg0 key="label.htbh"/> </field> <field property="sxrq" depends="required"> <arg0 key="label.sxrq"/> </field> <field property="tbrq" depends="required"> <arg0 key="label.tbrq"/> </field> <field property="bxbh" depends="required"> <arg0 key="label.bxbh"/> </field> <field property="zpbh" depends="required"> <arg0 key="label.zpbh"/> </field> <field property="ygbm" depends="required"> <arg0 key="label.ygbm"/> </field> <field property="bm" depends="required"> <arg0 key="label.bm"/> </field> <field property="xm" depends="required"> <arg0 key="label.xm"/> </field> <field property="sex" depends="required"> <arg0 key="label.sex"/> </field> <field property="csrq" depends="required"> <arg0 key="label.csrq"/> </field> </form> <form name="/delete"> <field property="sfzbh" depends="required,minlength,maxlength"> <arg0 key="label.IDcard"/> <arg1 name="minlength " key="${var:minlength}" resource="false"/> <arg2 name="maxlength " key="${var:maxlength}" resource="false"/> <var> <var-name>minlength</var-name> <var-value>15</var-value> </var> and struts_config.xml <!DOCENGINE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd"> <struts-config> <form-beans> <form-bean name="LogonForm" type="hr.forms.LogonForm" /> <form-bean name="searchForm" type="org.apache.struts.validator.DynaValidatorActionForm"> <form-property name="sfzbh" type="java.lang.String" /> </form-bean> <form-bean name="insertForm" type="org.apache.struts.validator.DynaValidatorActionForm"> <form-property name="mz" type="java.lang.String" /> <form-property name="phone" type="java.lang.String" /> <form-property name="jtdz" type="java.lang.String" /> <form-property name="jg" type="java.lang.String" /> <form-property name="sfzbh" type="java.lang.String" /> <form-property name="zjxy" type="java.lang.String" /> <form-property name="zzmm" type="java.lang.String" /> <form-property name="sg" type="java.lang.String" /> <form-property name="tz" type="java.lang.String" /> <form-property name="xx" type="java.lang.String" /> <form-property name="htbh" type="java.lang.String" /> <form-property name="sxrq" type="java.lang.String" /> <form-property name="zzrq" type="java.lang.String" /> <form-property name="tbrq" type="java.lang.String" /> <form-property name="bxbh" type="java.lang.String" /> <form-property name="zpbh" type="java.lang.String" /> <form-property name="ygbm" type="java.lang.String" /> <form-property name="bm" type="java.lang.String" /> <form-property name="xm" type="java.lang.String" /> <form-property name="sex" type="java.lang.String" /> <form-property name="csrq" type="java.lang.String" /> </form-bean> <form-bean name="UpdateForm" type="org.apache.struts.validator.DynaValidatorActionForm"> <form-property name="mz" type="java.lang.String" /> <form-property name="phone" type="java.lang.String" /> <form-property name="jtdz" type="java.lang.String" /> <form-property name="jg" type="java.lang.String" /> <form-property name="sfzbh" type="java.lang.String" /> <form-property name="zjxy" type="java.lang.String" /> <form-property name="zzmm" type="java.lang.String" /> <form-property name="sg" type="java.lang.String" /> <form-property name="tz" type="java.lang.String" /> <form-property name="xx" type="java.lang.String" /> <form-property name="htbh" type="java.lang.String" /> <form-property name="sxrq" type="java.lang.String" /> <form-property name="zzrq" type="java.lang.String" /> <form-property name="tbrq" type="java.lang.String" /> <form-property name="bxbh" type="java.lang.String" /> <form-property name="zpbh" type="java.lang.String" /> <form-property name="ygbm" type="java.lang.String" /> <form-property name="bm" type="java.lang.String" /> <form-property name="xm" type="java.lang.String" /> <form-property name="sex" type="java.lang.String" /> <form-property name="csrq" type="java.lang.String" /> </form-bean> <form-bean name="deleteForm" type="org.apache.struts.validator.DynaValidatorActionForm"> <form-property name="sfzbh" type="java.lang.String" /> </form-bean> </form-beans> <global-forwards> <forward name="logoff" path="/logoff.do" />

Posted by zqczqczqc110 on March 31, 2005 at 10:53 PM MST #

[Trackback] mhgcu@trstrjs.net

Posted by Discount Cruise and Vacation on September 07, 2005 at 07:42 PM MDT #

Post a Comment:
  • HTML Syntax: Allowed