Issue splitting comma delimited String, creates a new line?
<p>I'm trying to pass both the value and key from an option box as a comma delimited String to a Java class, which will then parse the String into two different Strings.  Below, I demonstrate a Java iterator combining the value and key into one string:</p>

<pre><code>while(i.hasNext())
{
    Entry&lt;String,String&gt; currentData = i.next();
    String value=currentData.getValue() + "," + currentData.getKey();
    String key=currentData.getKey();
    out.println("&lt;option value=\"");
    out.println(value);
    out.println("\"&gt;");
    out.println(key);
    out.println("&lt;/option&gt;");
    System.out.println(value + " is the value!");
}
</code></pre>

<p>This works well, as it outputs the key-value pairs in the following format:</p>

<pre><code>valuehere,KeyHere
</code></pre>

<p>Then, I parse the String on the server side using a Java class:</p>

<pre><code>String[] tempContainer = request.getParameter("container").split(",");
String containerValue = tempContainer[0];
String containerKey = tempContainer[1];
</code></pre>

<p>When I print containerKey, it prints as expected:</p>

<pre><code>containerKeyHere
</code></pre>

<p>However, when I print containerValue, it prints a new line before actually printing the value.  So, when I try to pass this variable into a function, the function fails because of the new line.  Am I using the split() function incorrectly?  Or is there a better way to handle this parsing?</p>

<p>Thanks!</p>
