You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "Andreas Andreou (JIRA)" <ta...@jakarta.apache.org> on 2006/05/10 11:33:05 UTC

[jira] Resolved: (TAPESTRY-829) FormLinkRenderer throws NPE with DirectlLinks

     [ http://issues.apache.org/jira/browse/TAPESTRY-829?page=all ]
     
Andreas Andreou resolved TAPESTRY-829:
--------------------------------------

    Resolution: Fixed

Thanks Ido !

> FormLinkRenderer throws NPE with DirectlLinks
> ---------------------------------------------
>
>          Key: TAPESTRY-829
>          URL: http://issues.apache.org/jira/browse/TAPESTRY-829
>      Project: Tapestry
>         Type: Bug

>   Components: Contrib
>     Versions: 4.0
>  Environment: tapestry 4.0 rc 3
>     Reporter: Ido M. Tamir
>     Assignee: Andreas Andreou
>      Fix For: 4.0.3

>
> From DirectLink it gets the following prameterNames: component container page service session sp
> but link.getParameterValues("container") returns null;
> my workaround is to wrap the loop in a test, then it works again.
> if( values != null ){ }
> In addition to this deprecated methods are used.
> 	private String generateFormFunction(String formName, ILink link, String anchor) 
> 	{ 
> 		String[] parameterNames = link.getParameterNames(); 
> 		 
> 		StringBuffer buf = new StringBuffer(); 
> 		buf.append("function prepare" + formName + "() {\n"); 
>  
> 		buf.append("  var html = \"\";\n"); 
> 		buf.append("  html += \"<div style='position: absolute'>\";\n"); 
> 		 
> 		String url = link.getURL(anchor, false); 
> 		buf.append("  html += \"<form name='" + formName + "' method='post' action='" + url + "'>\";\n"); 
>  
> 		for (int i = 0; i < parameterNames.length; i++) { 
> 			String parameter = parameterNames[i]; 
> 			String[] values = link.getParameterValues(parameter); 
> 			if( values != null ){ 
> 				for (int j = 0; j < values.length; j++) { 
> 					String value = values[j]; 
> 					buf.append("  html += \"<input type='hidden' name='" + parameter + "' value='" + value + "'/>\";\n"); 
> 				} 
> 			} 
> 		} 
> 		buf.append("  html += \"<\" + \"/form>\";\n"); 
> 		buf.append("  html += \"<\" + \"/div>\";\n"); 
> 		buf.append("  document.write(html);\n"); 
> 		buf.append("}\n"); 
> 		 
> 		buf.append("prepare" + formName + "();\n\n"); 
>  
> 		return buf.toString(); 
> 	}

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org