How can I bind props:textarea value to its content in JSP?

I am working on a JSP file that has the following node:

<tr id="artifactVersionXmlRow">
<th><label for="${bean.artifactVersionXml}">Artifact Version XML Path:</label></th>
<div class="completionIconWrapper">
<props:textProperty name="${bean.artifactVersionXml}" className="longField" />
<bs:vcsTree fieldId="${bean.artifactVersionXml}" />
<span class="error" id="error_${bean.artifactVersionXml}"></span>
<span class="smallNote">Specify path to the artifact version XML</span>

My task is to enable storing multiple XML file names instead of just one. So I considered using props:textarea instead of props:textProperty,

There are two problems with that:

  1. props:textarea has a required property called value and whatever I put in that property always overwrites whatever value is entered in the compiled page. How can I bind this property to the saved content?
  2. bs:vcsTree is great for props:textProperty because it overwrites the selected content, which is just what is needed in the case of a single XML file name. However, when selecting multiple files, bs:vcsTree deletes all the file names that have been selected so far, which can be pretty annoying. How can this be fixed? Are props:textarea and bs:vcsTree the best approach here or is there a more suitable solution?




Unfortunately it is not that clear, but textArea is a bit low level custom tag. If you want multi line value, then consider using multilineProperty tag instead.

For instance, this is how it is being used for Ant "Build file content" field:

<c:set var="onclick">
if (this.checked) {
try {'build-file', true);
} catch(e) {}
<props:radioButtonProperty name="use-custom-build-file" value="true" id="custom2" onclick="${onclick}"/>
<label for="custom2">Build file content:</label>
<props:multilineProperty expanded="${['use-custom-build-file'] == true}" name="build-file" rows="10" cols="58" linkTitle="Enter the build file content" onkeydown="$('custom2').checked = true;" className="longField"/>

You probably don't need this complex logic, but example just shows how you can work with this field from JS.


Thanks, Pavel, multilineProperty did the job.


Please sign in to leave a comment.