Revision: 405
http://svn.sourceforge.net/stripes/?rev=405&view=rev
Author: tfenne
Date: 2006-09-02 10:38:44 -0700 (Sat, 02 Sep 2006)
Log Message:
-----------
Merge of changes for r402:404. Contains fixes for STS-255 and STS-263.
Modified Paths:
--------------
branches/1.4.x/stripes/src/net/sourceforge/stripes/tag/InputTagSupport.java
branches/1.4.x/stripes/src/net/sourceforge/stripes/validation/ScopedLocalizableError.java
Modified:
branches/1.4.x/stripes/src/net/sourceforge/stripes/tag/InputTagSupport.java
===================================================================
--- branches/1.4.x/stripes/src/net/sourceforge/stripes/tag/InputTagSupport.java
2006-09-02 17:36:23 UTC (rev 404)
+++ branches/1.4.x/stripes/src/net/sourceforge/stripes/tag/InputTagSupport.java
2006-09-02 17:38:44 UTC (rev 405)
@@ -45,6 +45,7 @@
private String formatType;
private String formatPattern;
private boolean focus;
+ private boolean syntheticId;
/** A list of the errors related to this input tag instance */
protected List<ValidationError> fieldErrors;
@@ -381,6 +382,7 @@
this.focus = focus;
if ( getId() == null ) {
+ this.syntheticId = true;
setId(String.valueOf( new Random().nextInt() ));
}
}
@@ -391,7 +393,16 @@
JspWriter out = getPageContext().getOut();
out.write("<script type=\"text/javascript\">var
z=document.getElementById('");
out.write(getId());
- out.write("'); try{z.focus(); z.select();} catch(e) {}</script>");
+ out.write("'); try{z.focus();");
+ if ("text".equals(getAttributes().get("type")) ||
"password".equals(getAttributes().get("type"))) {
+ out.write("z.select();");
+ }
+ out.write("} catch(e) {}</script>");
+
+ // Clean up tag state involved with focus
+ this.focus = false;
+ if (this.syntheticId) getAttributes().remove("id");
+ this.syntheticId = false;
}
catch (IOException ioe) {
throw new StripesJspException("Could not write javascript focus
code to jsp writer.", ioe);
Modified:
branches/1.4.x/stripes/src/net/sourceforge/stripes/validation/ScopedLocalizableError.java
===================================================================
---
branches/1.4.x/stripes/src/net/sourceforge/stripes/validation/ScopedLocalizableError.java
2006-09-02 17:36:23 UTC (rev 404)
+++
branches/1.4.x/stripes/src/net/sourceforge/stripes/validation/ScopedLocalizableError.java
2006-09-02 17:38:44 UTC (rev 405)
@@ -33,8 +33,10 @@
* <ul>
* <li>/cats/KittenDetail.action.age.outOfRange</li>
* <li>/cats/KittenDetail.action.age.errorMessage</li>
+ * <li>age.outOfRange</li>
* <li>age.errorMessage</li>
* <li>/cats/KittenDetail.action.outOfRange</li>
+ * <li>/cats/KittenDetail.action.errorMessage</li>
* <li>converter.integer.outOfRange</li>
* </ul>
*
@@ -73,32 +75,48 @@
*/
@Override
protected String getMessageTemplate(Locale locale) {
- String name1=null, name2=null, name3=null, name4=null, name5=null;
+ String name1=null, name2=null, name3=null, name4=null, name5=null,
name6=null, name7=null;
name1 = getActionPath() + "." + getFieldName() + "." + key;
+
+ // 1. /cats/KittenDetail.action.age.outOfRange
String template = LocalizationUtility.getErrorMessage(locale, name1);
if (template == null) {
+ // 2. /cats/KittenDetail.action.age.errorMessage
name2 = getActionPath() + "." + getFieldName() + "." +
DEFAULT_NAME;
template = LocalizationUtility.getErrorMessage(locale, name2);
}
if (template == null) {
- name3 = getFieldName() + "." + DEFAULT_NAME;
+ // 3. age.outOfRange
+ name3 = getFieldName() + "." + key;
template = LocalizationUtility.getErrorMessage(locale, name3);
}
if (template == null) {
- name4 = getActionPath() + "." + key;
+ // 4. age.errorMessage
+ name4 = getFieldName() + "." + DEFAULT_NAME;
template = LocalizationUtility.getErrorMessage(locale, name4);
}
if (template == null) {
- name5 = defaultScope + "." + key;
+ // 5. /cats/KittenDetail.action.outOfRange
+ name5 = getActionPath() + "." + key;
template = LocalizationUtility.getErrorMessage(locale, name5);
}
+ if (template == null) {
+ // 6. /cats/KittenDetail.action.errorMessage
+ name6 = getActionPath() + "." + DEFAULT_NAME;
+ template = LocalizationUtility.getErrorMessage(locale, name6);
+ }
+ if (template == null) {
+ // 7. converter.integer.outOfRange
+ name7 = defaultScope + "." + key;
+ template = LocalizationUtility.getErrorMessage(locale, name7);
+ }
if (template == null) {
throw new MissingResourceException(
"Could not find an error message with any of the following
keys: " +
"'" + name1 + "', '" + name2 + "', '" + name3 + "', '" +
- name4 + "', '" + name5 + "'.", null, null
+ name4 + "', '" + name5 + "', '" + name6 + "', '" + name7 +
"'.", null, null
);
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development