You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Tian Chi <ch...@yahoo.com> on 2005/08/23 07:44:21 UTC
'required' is undefined when using struts javascript validation
Hi,
I'm a newbie at using strus and have been trying to get client-side validation to work using Struts, but I 'm receiving a javascript error while trying to use the
'required ' validation rule. The error in IE and FireFox both say:
Error: 'required ' is undefined
When I look at the generated javascript, it seems the object 'required' is not defined in the following generated function. Can anyone give me some guidance how to resolve this? I'd really appreciate it. Hope to hear from you soon.
function validateRequired(form) {
var isValid = true;
var focusField = null;
var i = 0;
var fields = new Array();
oRequired = new required();
for (x in oRequired) {
var field = form[oRequired[x][0]];
... <blah > <blah >
Thanks in advance,
-Paul
---------------------------------
Start your day with Yahoo! - make it your home page
Re: Struts Hibernate error
Posted by Emmanouil Batsis <Em...@eurodyn.com>.
Luiz Godoy wrote:
>------------
>java.lang.RuntimeException: Exception building SessionFactory: null
>
Search the hibernate forums, could be anything from your
hibernate.cfg.xml location to your JDK version. In any case, it has
nothing to do with struts.
hth,
Manos
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
RE: Struts Hibernate error
Posted by Marco Mistroni <mm...@waersystems.com>.
hELLO,
how r you initializing your SessionFactory?
Specifically, how are you integrating Hibernate inside Struts?
Are you using a struts plugin for hibernate?
If you check www.hibernate.org, there are FAQ for how to properly use
A SessionFactory
Proper way was using a ServletFilter if I remember correctly...
If you want to avoid headaches, try to use Spring for managing
Hibernate session
HTH
marco
-----Original Message-----
From: Luiz Godoy [mailto:octaviodegodoy@yahoo.com]
Sent: 23 August 2005 14:48
To: Struts Users Mailing List
Subject: Re: Struts Hibernate error
Here is it, i´m trying to test an action, but the error seem to come
from Hibernate.
testLoadPage(test.com.bm.pcs.corporativo.actions.TestFamiliaDNCAction)
servletunit.struts.ExceptionDuringTestError: An uncaught exception was
thrown during actionExecute()
at
servletunit.struts.MockStrutsTestCase.actionPerform(MockStrutsTestCase.j
ava:305)
at
test.com.bm.pcs.corporativo.actions.TestFamiliaDNCAction.testLoadPage(Te
stFamiliaDNCAction.java:46)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTe
stRunner.java:436)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRun
ner.java:311)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRu
nner.java:192)
------------
Root Cause:
------------
javax.servlet.ServletException: Exception building SessionFactory: null
at
org.apache.struts.action.RequestProcessor.processException(RequestProces
sor.java:523)
at
org.apache.struts.action.RequestProcessor.processActionPerform(RequestPr
ocessor.java:421)
at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:
224)
at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
at
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
at
servletunit.struts.MockStrutsTestCase.actionPerform(MockStrutsTestCase.j
ava:290)
at
test.com.bm.pcs.corporativo.actions.TestFamiliaDNCAction.testLoadPage(Te
stFamiliaDNCAction.java:46)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTe
stRunner.java:436)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRun
ner.java:311)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRu
nner.java:192)
------------
Root Cause:
------------
java.lang.RuntimeException: Exception building SessionFactory: null
at
com.bm.infra.persistence.hibernate.SessionManager.currentSession(Session
Manager.java:34)
at
com.bm.infra.persistence.hibernate.HibernatePersistenceManager.find(Hibe
rnatePersistenceManager.java:185)
at
com.bm.infra.persistence.hibernate.HibernatePersistenceManager.find(Hibe
rnatePersistenceManager.java:175)
at com.ccne.dao.FamiliaDNCDAO.findByCodigo(FamiliaDNCDAO.java:41)
at
com.ccne.bs.CadastroFamiliaDNC.findByCodigo(CadastroFamiliaDNC.java:34)
at
com.bm.pcs.corporativo.actions.FamiliaDNCAction.excluir(FamiliaDNCAction
.java:118)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at
org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.j
ava:274)
at
org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:194
)
at com.bm.infra.web.action.BasicAction.execute(BasicAction.java:142)
at
org.apache.struts.action.RequestProcessor.processActionPerform(RequestPr
ocessor.java:419)
at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:
224)
at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
at
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
at
servletunit.struts.MockStrutsTestCase.actionPerform(MockStrutsTestCase.j
ava:290)
at
test.com.bm.pcs.corporativo.actions.TestFamiliaDNCAction.testLoadPage(Te
stFamiliaDNCAction.java:46) <--- all i have here is the actionPerform();
on line 46
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTe
stRunner.java:436)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRun
ner.java:311)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRu
nner.java:192)
Emmanouil Batsis <Em...@eurodyn.com> wrote:
Luiz Godoy wrote:
>I´m having this error using eclipse, with struts and hibernate, any
clue ?
>
Not without the stacktrace.
Manos
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Luiz Octavio Godoy
Desenvolvimento de Sistemas
---------------------------------
Do you Yahoo!?
Read only the mail you want - Yahoo! Mail SpamGuard.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Struts Hibernate error
Posted by Luiz Godoy <oc...@yahoo.com>.
Here is it, i´m trying to test an action, but the error seem to come from Hibernate.
testLoadPage(test.com.bm.pcs.corporativo.actions.TestFamiliaDNCAction)
servletunit.struts.ExceptionDuringTestError: An uncaught exception was thrown during actionExecute()
at servletunit.struts.MockStrutsTestCase.actionPerform(MockStrutsTestCase.java:305)
at test.com.bm.pcs.corporativo.actions.TestFamiliaDNCAction.testLoadPage(TestFamiliaDNCAction.java:46)
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:585)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:436)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:311)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
------------
Root Cause:
------------
javax.servlet.ServletException: Exception building SessionFactory: null
at org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:523)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
at servletunit.struts.MockStrutsTestCase.actionPerform(MockStrutsTestCase.java:290)
at test.com.bm.pcs.corporativo.actions.TestFamiliaDNCAction.testLoadPage(TestFamiliaDNCAction.java:46)
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:585)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:436)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:311)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
------------
Root Cause:
------------
java.lang.RuntimeException: Exception building SessionFactory: null
at com.bm.infra.persistence.hibernate.SessionManager.currentSession(SessionManager.java:34)
at com.bm.infra.persistence.hibernate.HibernatePersistenceManager.find(HibernatePersistenceManager.java:185)
at com.bm.infra.persistence.hibernate.HibernatePersistenceManager.find(HibernatePersistenceManager.java:175)
at com.ccne.dao.FamiliaDNCDAO.findByCodigo(FamiliaDNCDAO.java:41)
at com.ccne.bs.CadastroFamiliaDNC.findByCodigo(CadastroFamiliaDNC.java:34)
at com.bm.pcs.corporativo.actions.FamiliaDNCAction.excluir(FamiliaDNCAction.java:118)
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:585)
at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:274)
at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:194)
at com.bm.infra.web.action.BasicAction.execute(BasicAction.java:142)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
at servletunit.struts.MockStrutsTestCase.actionPerform(MockStrutsTestCase.java:290)
at test.com.bm.pcs.corporativo.actions.TestFamiliaDNCAction.testLoadPage(TestFamiliaDNCAction.java:46) <--- all i have here is the actionPerform(); on line 46
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:585)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:436)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:311)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Emmanouil Batsis <Em...@eurodyn.com> wrote:
Luiz Godoy wrote:
>I´m having this error using eclipse, with struts and hibernate, any clue ?
>
Not without the stacktrace.
Manos
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Luiz Octavio Godoy
Desenvolvimento de Sistemas
---------------------------------
Do you Yahoo!?
Read only the mail you want - Yahoo! Mail SpamGuard.
Re: Struts Hibernate error
Posted by Emmanouil Batsis <Em...@eurodyn.com>.
Luiz Godoy wrote:
>I´m having this error using eclipse, with struts and hibernate, any clue ?
>
Not without the stacktrace.
Manos
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Struts Hibernate error
Posted by Luiz Godoy <oc...@yahoo.com>.
I´m having this error using eclipse, with struts and hibernate, any clue ?
INFO: using CGLIB reflection optimizer
23/08/2005 10:12:25 org.hibernate.cfg.Environment <clinit>
INFO: using JDK 1.4 java.sql.Timestamp handling
23/08/2005 10:12:25 org.apache.struts.action.RequestProcessor processException
WARNING: Unhandled Exception thrown: class java.lang.RuntimeException
Thanks
Luiz Octavio Godoy
Desenvolvimento de Sistemas
---------------------------------
Start your day with Yahoo! - make it your home page
RE: 'required' is undefined when using struts javascript validation
Posted by Mariano Petrakovsky <mp...@tecnonexo.com>.
The problem si the function name generated by struts.
I'm fix this problem, modifying the validator_rules.xml (I'm attach this)...
Sure exist a more correct to resolve this problem... but... time is money.
The function name generated by struts is "<formName>_required (form)" for
required validator for instance. But the javascript in validator_rules.xml
search for a "required(form)" function. I modify the javascript in
validator_rules.xml for it search the correct function name.
Saludos :)...
--
Mariano G. Petrakovsky
Programmer · Software Factory
AXG Tecnonexo - www.tecnonexo.com
Development facilities:Av. Maipú 1252 8º (C1006ACT) · Buenos Aires ·
Argentina.
Tel.: (54-11) 4878-0005 - Fax: (54-11) 4878-0065.
Headquarters: 1604 Spring Hill Road, Suite 160 Vienna · VA 22182 · USA.
Tel.: (202) 986-7541 - Fax: (202) 787-3891.
· · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · ·
· · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · ·
· · · ·
-----Mensaje original-----
De: Tian Chi [mailto:chi_tian@yahoo.com]
Enviado el: Martes, 23 de Agosto de 2005 02:44
Para: user@struts.apache.org
Asunto: 'required' is undefined when using struts javascript validation
Hi,
I'm a newbie at using strus and have been trying to get client-side
validation to work using Struts, but I 'm receiving a javascript error while
trying to use the
'required ' validation rule. The error in IE and FireFox both say:
Error: 'required ' is undefined
When I look at the generated javascript, it seems the object 'required' is
not defined in the following generated function. Can anyone give me some
guidance how to resolve this? I'd really appreciate it. Hope to hear from
you soon.
function validateRequired(form) {
var isValid = true;
var focusField = null;
var i = 0;
var fields = new Array();
oRequired = new required();
for (x in oRequired) {
var field = form[oRequired[x][0]];
... <blah > <blah >
Thanks in advance,
-Paul
---------------------------------
Start your day with Yahoo! - make it your home page