wood burning stoves 2.0*
The moose likes Struts and the fly likes validation issues Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "validation issues " Watch "validation issues " New topic
Author

validation issues

nandan johri
Ranch Hand

Joined: Jan 12, 2006
Posts: 75
i am trying to implement validation of certain action classes in my app.there are no errors or exceptions but there is no screen popping up .i am trying to validate for the condition that if the fields are empty.
but on clicking the submit i am not getting the pop up of ie , instead i am getting error message getting displayed on the screen with the same font.
i am using websphere.
i think there is some javascripting issue.
websphere is skipping validation-rules.xml

one of forms of the validation.xml is
<form name="AddressForm">
<field property="name"
depends="required">
<arg key = "AddressForm.name"/>
</field>
<field property="address"
depends="required">
<arg key = "AddressForm.name"/>
</field>
</form>

and the jsp is


<BODY>

<html:form action="/submitaddress"
method="post"
onsubmit="return validateAddressForm(this);">
<div align="left">

<p>
<html:errors/>
</p>

<table>
<tr>
<td align="center" colspan="2">
Please enter the following details
</tr>
<tr>
<td align="right">
name
</td>
<td align="left">
<html:text property="name" size="30" maxlength="30"/>
</td>
</tr>
</table>

<html:submit/>

<!-- Begin Validator Javascript Function-->
<html:javascript formName="AddressForm" />
<!-- End Validator Javascript Function-->

</html:form>

</BODY>
</html:html>
[ December 14, 2006: Message edited by: nandan johri ]
nandan johri
Ranch Hand

Joined: Jan 12, 2006
Posts: 75
this is my console :



[12/14/06 21:03:51:774 IST] 3eba32d5 ManagerAdmin I TRAS0017I: The startup trace state is *=all=disabled.
[12/14/06 21:03:52:825 IST] 3eba32d5 AdminInitiali A ADMN0015I: AdminService initialized
[12/14/06 21:03:54:097 IST] 3eba32d5 Configuration A SECJ0215I: Successfully set JAAS login provider configuration class to com.ibm.ws.security.auth.login.Configuration.
[12/14/06 21:03:54:167 IST] 3eba32d5 SecurityDM I SECJ0231I: The Security component's FFDC Diagnostic Module com.ibm.ws.security.core.SecurityDM registered successfully: true.
[12/14/06 21:03:54:558 IST] 3eba32d5 SecurityCompo I SECJ0309I: Java 2 Security is disabled.
[12/14/06 21:03:54:558 IST] 3eba32d5 SecurityCompo I SECJ0212I: WCCM JAAS configuration information successfully pushed to login provider class.
[12/14/06 21:03:54:578 IST] 3eba32d5 SecurityCompo I SECJ0240I: Security service initialization completed successfully
[12/14/06 21:03:54:578 IST] 3eba32d5 JMSRegistrati A MSGS0602I: WebSphere Embedded Messaging Client only has been installed
[12/14/06 21:04:01:177 IST] 3eba32d5 CacheServiceI I DYNA0048I: WebSphere Dynamic Cache initialized successfully.
[12/14/06 21:04:03:060 IST] 3eba32d5 JMXSoapAdapte A ADMC0013I: SOAP connector available at port 8880
[12/14/06 21:04:03:070 IST] 3eba32d5 SecurityCompo I SECJ0243I: Security service started successfully
[12/14/06 21:04:03:070 IST] 3eba32d5 SecurityCompo I SECJ0210I: Security enabled false
[12/14/06 21:04:04:122 IST] 3eba32d5 ApplicationMg A WSVR0200I: Starting application: IBMUTC
[12/14/06 21:04:04:342 IST] 3eba32d5 WebContainer A SRVE0161I: IBM WebSphere Application Server - Web Container. Copyright IBM Corp. 1998-2002
[12/14/06 21:04:04:382 IST] 3eba32d5 WebContainer A SRVE0162I: Servlet Specification Level: 2.3
[12/14/06 21:04:04:382 IST] 3eba32d5 WebContainer A SRVE0163I: Supported JSP Specification Level: 1.2
[12/14/06 21:04:04:642 IST] 3eba32d5 WebContainer A SRVE0169I: Loading Web Module: IBM Universal Test Client.
[12/14/06 21:04:04:933 IST] 3eba32d5 WebGroup I SRVE0180I: [IBM Universal Test Client] [/UTC] [Servlet.LOG]: JSP 1.2 Processor: init
[12/14/06 21:04:05:033 IST] 3eba32d5 WebGroup I SRVE0180I: [IBM Universal Test Client] [/UTC] [Servlet.LOG]: SimpleFileServlet: init
[12/14/06 21:04:05:133 IST] 3eba32d5 ApplicationMg A WSVR0221I: Application started: IBMUTC
[12/14/06 21:04:05:143 IST] 3eba32d5 ApplicationMg A WSVR0200I: Starting application: StrutsEAR
[12/14/06 21:04:05:213 IST] 3eba32d5 WebContainer A SRVE0169I: Loading Web Module: StrutsSampleWeb.
[12/14/06 21:04:05:824 IST] 3eba32d5 WebGroup I SRVE0180I: [StrutsSampleWeb] [/StrutsSampleWeb] [Servlet.LOG]: JSP 1.2 Processor: init
[12/14/06 21:04:06:725 IST] 3eba32d5 WebGroup I SRVE0180I: [StrutsSampleWeb] [/StrutsSampleWeb] [Servlet.LOG]: SimpleFileServlet: init
[12/14/06 21:04:06:745 IST] 3eba32d5 WebGroup I SRVE0180I: [StrutsSampleWeb] [/StrutsSampleWeb] [Servlet.LOG]: InvokerServlet: init
[12/14/06 21:04:06:825 IST] 3eba32d5 WebGroup I SRVE0180I: [StrutsSampleWeb] [/StrutsSampleWeb] [Servlet.LOG]: action: init
[12/14/06 21:04:06:856 IST] 3eba32d5 PropertyMessa I org.apache.struts.util.PropertyMessageResources Initializing, config='org.apache.struts.util.LocalStrings', returnNull=true
[12/14/06 21:04:06:856 IST] 3eba32d5 PropertyMessa I org.apache.struts.util.PropertyMessageResources Initializing, config='org.apache.struts.action.ActionResources', returnNull=true
[12/14/06 21:04:07:256 IST] 3eba32d5 PropertyMessa I org.apache.struts.util.PropertyMessageResources Initializing, config='com.ibm.strutssampleweb.resources.ApplicationResources', returnNull=true
[12/14/06 21:04:07:286 IST] 3eba32d5 ValidatorPlug I org.apache.struts.validator.ValidatorPlugIn Loading validation rules file from '/WEB-INF/validator-rules.xml'
[12/14/06 21:04:07:286 IST] 3eba32d5 ValidatorPlug E org.apache.struts.validator.ValidatorPlugIn Skipping validation rules file from '/WEB-INF/validator-rules.xml'. No stream could be opened.
[12/14/06 21:04:07:286 IST] 3eba32d5 ValidatorPlug I org.apache.struts.validator.ValidatorPlugIn Loading validation rules file from '/WEB-INF/validation.xml'
[12/14/06 21:04:07:356 IST] 3eba32d5 ApplicationMg A WSVR0221I: Application started: StrutsEAR
[12/14/06 21:04:07:456 IST] 3eba32d5 HttpTransport A SRVE0171I: Transport http is listening on port 9,080.
[12/14/06 21:04:08:908 IST] 3eba32d5 HttpTransport A SRVE0171I: Transport https is listening on port 9,443.
[12/14/06 21:04:08:959 IST] 3eba32d5 RMIConnectorC A ADMC0026I: RMI Connector available at port 2809
[12/14/06 21:04:09:059 IST] 3eba32d5 WsServer A WSVR0001I: Server server1 open for e-business
[12/14/06 21:04:59:471 IST] 5196f2d7 WebGroup I SRVE0180I: [StrutsSampleWeb] [/StrutsSampleWeb] [Servlet.LOG]: /submitbook.jsp: init
[12/14/06 21:04:59:491 IST] 5196f2d7 PropertyMessa I org.apache.struts.util.PropertyMessageResources Initializing, config='org.apache.struts.taglib.html.LocalStrings', returnNull=true
[12/14/06 21:04:59:551 IST] 5196f2d7 PropertyMessa I org.apache.struts.util.PropertyMessageResources Initializing, config='org.apache.struts.util.LocalStrings', returnNull=true
[12/14/06 21:04:59:551 IST] 5196f2d7 PropertyMessa I org.apache.struts.util.PropertyMessageResources Initializing, config='org.apache.struts.taglib.html.LocalStrings', returnNull=true
[12/14/06 21:04:59:571 IST] 5196f2d7 PropertyMessa I org.apache.struts.util.PropertyMessageResources Initializing, config='org.apache.struts.taglib.html.LocalStrings', returnNull=true
[12/14/06 21:04:59:571 IST] 5196f2d7 PropertyMessa I org.apache.struts.util.PropertyMessageResources Initializing, config='org.apache.struts.taglib.html.LocalStrings', returnNull=true
[12/14/06 21:04:59:591 IST] 5196f2d7 PropertyMessa I org.apache.struts.util.PropertyMessageResources Initializing, config='org.apache.struts.taglib.html.LocalStrings', returnNull=true
[12/14/06 21:04:59:601 IST] 5196f2d7 PropertyMessa I org.apache.struts.util.PropertyMessageResources Initializing, config='org.apache.struts.taglib.html.LocalStrings', returnNull=true
[12/14/06 21:04:59:601 IST] 5196f2d7 PropertyMessa I org.apache.struts.util.PropertyMessageResources Initializing, config='org.apache.struts.taglib.html.LocalStrings', returnNull=true
[12/14/06 21:04:59:611 IST] 5196f2d7 PropertyMessa I org.apache.struts.util.PropertyMessageResources Initializing, config='org.apache.struts.taglib.html.LocalStrings', returnNull=true
[12/14/06 21:04:59:611 IST] 5196f2d7 PropertyMessa I org.apache.struts.util.PropertyMessageResources Initializing, config='org.apache.struts.taglib.html.LocalStrings', returnNull=true
[12/14/06 21:05:06:061 IST] 5196f2d7 WebGroup I SRVE0180I: [StrutsSampleWeb] [/StrutsSampleWeb] [Servlet.LOG]: /submitaddress.jsp: init
[12/14/06 21:05:06:061 IST] 5196f2d7 PropertyMessa I org.apache.struts.util.PropertyMessageResources Initializing, config='org.apache.struts.taglib.html.LocalStrings', returnNull=true
[12/14/06 21:05:06:071 IST] 5196f2d7 PropertyMessa I org.apache.struts.util.PropertyMessageResources Initializing, config='org.apache.struts.taglib.html.LocalStrings', returnNull=true
[12/14/06 21:05:07:242 IST] 5196f2d7 SystemOut O inside validate before comparision
[12/14/06 21:05:07:242 IST] 5196f2d7 SystemOut O inside validate after comparision
Santosh Ramachandrula
Ranch Hand

Joined: Apr 04, 2004
Posts: 252
Can you please post your struts-config.xml also?


Thanks,
Santosh
nandan johri
Ranch Hand

Joined: Jan 12, 2006
Posts: 75
Here it is :

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE 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>

<!-- Data Sources -->
<data-sources>
</data-sources>

<!-- Form Beans -->
<form-beans>
<form-bean name="submitForm" type="com.ibm.sample.struts.SubmitForm">
</form-bean>
<form-bean name="bookForm" type="com.ibm.sample.struts.book.BookForm">
</form-bean>
<form-bean name="addressForm" type="com.ibm.sample.struts.address.AddressForm">
</form-bean>


</form-beans>

<!-- Global Exceptions -->
<global-exceptions>
</global-exceptions>

<!-- Global Forwards -->
<global-forwards>
</global-forwards>

<!-- Action Mappings -->
<action-mappings>

<action name="submitForm"
path="/submit"
scope="session"
type="com.ibm.sample.struts.SubmitAction">
<forward name="success" path="./confirm.jsp">
</forward>
</action>

<action name="bookForm"
path="/submitbook"
scope="session"
type="com.ibm.sample.struts.book.BookAction">
<forward name="success" path="./confirm.jsp">
</forward>
</action>

<action path="/Welcome" forward="/Welcome.jsp"/>



<action name="addressForm"
path="/submitaddress"
scope="request"
validate="true"
type="com.ibm.sample.struts.address.AddressAction"
input="/submitaddress.jsp">
<forward name="success" path="./confirm.jsp"/>
</action>
</action-mappings>

<!-- Message Resources -->
<message-resources parameter="com.ibm.strutssampleweb.resources.ApplicationResources"/>

<!-- Validator plugin -->
<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
<set-property property="pathnames"
value="/WEB-INF/validator-rules.xml,
/WEB-INF/validation.xml"/>
</plug-in>


</struts-config>
Santosh Ramachandrula
Ranch Hand

Joined: Apr 04, 2004
Posts: 252
Do you see anything in logs/server console log?

Can you please add the configuration null="true" as indicated below to make sure that the application is picking up the resources file.

Load the application again and check if you are seeing any weird messages in your browser.


[ December 15, 2006: Message edited by: Santosh Ramachandrula ]
nandan johri
Ranch Hand

Joined: Jan 12, 2006
Posts: 75
I did add the configuration null="true" but the problem is not
that application is not picking up the resources file.It is picking up and even displaying the empty values correctly but it is not displaying it in a new pop up window .It is simply displaying it as text above the entry boxes in the same jsp.
I think it is a javascript error .. just dont know how to correct it??
Brent Sterling
Ranch Hand

Joined: Feb 08, 2006
Posts: 948
I have never used client-side validation, but what you have in place looks exactly like I would expect. It sounds like the server side validation is working for you. You don't happen to have JavaScript disabled in your browser do you?

A tip that I will pass along is to test in FireFox with the FireBug plug-in installed. This tool is really helpful for debugging JavaScript issues.

- Brent
 
jQuery in Action, 2nd edition
 
subject: validation issues
 
Similar Threads
Struts validation not working
Validation failure
Geting Blank Java Script Alert in client side validation using validator framework
Validator framework
validator...