You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Venkat Maddipati <Ve...@hyperion.com> on 2004/12/15 20:37:14 UTC

Validation using multiple resource bundles

Validation of data in form fields worked fine when I had only default
resource bundle. But, when I started using multiple resource bundles,
the validation failed. I tried to specify the value for bundle attribute
for the 'arg' elements(s), and 'msg' elements but didn't work.

Following is my environment:
Struts 1.2.4
Tomcat 4.1.30
Commons Validator 1.1.3
Using "http://jakarta.apache.org/commons/dtds/validator_1_1_3.dtd" in
validation.xml

As per the above DTD, we can specify the value for bundle attribute.

When searching on the internet for this problems, on some sites, I found
that Validation package doesn't support multiple resource bundles, but
only supports default resource bundles. Is that true? Or this was true
only with old versions of struts/validators.

Here is an example of my field element in validation.xml file:

 <form name="createUserForm">
            <field
                property="userId"
                depends="required,minlength,mask">
                <arg position="0" bundle="security" key="label.userId"/>
		    <arg position="1" name="minlength"
key="${var:minlength}" resource="false" />
		    <var>
		        <var-name>minlength</var-name>
		        <var-value>5</var-value>
		    </var>
		    <msg name="mask" key="userId.maskmsg"
bundle="security" />
	          <var>
	              <var-name>mask</var-name>
	              <var-value>^[0-9a-zA-Z]*$</var-value>
	          </var>
            </field>
 </form>


Any help is greatly appreciated.

TIA
Venkat


************************************************************************

If you have received this e-mail in error, please delete it and notify the sender as soon as possible. The contents of this e-mail may be confidential and the unauthorized use, copying, or dissemination of it and any attachments to it, is prohibited. 

Internet communications are not secure and Hyperion does not, therefore, accept legal responsibility for the contents of this message nor for any damage caused by viruses.  The views expressed here do not necessarily represent those of Hyperion.

For more information about Hyperion, please visit our Web site at www.hyperion.com



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Handling Transcation Errors

Posted by Peter Neu <pe...@gmx.net>.
Hello everybody,

I was wondering what is the best way to cope with transaction errors in a
Struts application. I use JDBC to connect to the database. When I try to do
an insert-transaction it looks like the code below the message (sample 
form the Sun Tutorial).

My question is: what should I do when an update query fails
and the client has to submit the query again?

I'm using a Servlet Container (Tomcat 5.0.27) and no EJB's.

Best Regards,

Peter


public void ship (String productId, String orderId, int 
quantity) {

   try {
      con.setAutoCommit(false);
      updateOrderItem(productId, orderId);
      updateInventory(productId, quantity);
      con.commit();
   } catch (Exception ex) {
       try {
          con.rollback();
          throw new  Exception("Transaction failed: " +
             ex.getMessage());
       } catch (SQLException sqx) {
           throw new  Exception("Rollback failed: " +
              sqx.getMessage());
       }
   }
} 



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Validation using multiple resource bundles

Posted by aris <ar...@agilemovement.it>.
Hi Venkat,
I give you these two links that Niall Pemberton gave me one month ago. I
think that you can find useful information to solve your problem.
aris

http://issues.apache.org/bugzilla/show_bug.cgi?id=21760
http://article.gmane.org/gmane.comp.jakarta.struts.user/96384




From: "Venkat Maddipati" <Ve...@hyperion.com>


>Validation of data in form fields worked fine when I had only default
>resource bundle. But, when I started using multiple resource bundles,
>the validation failed. I tried to specify the value for bundle attribute
>for the 'arg' elements(s), and 'msg' elements but didn't work.
[...]

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org