0

My JSP snippet is as follows:

<form:select path="rules[${counter.index}].assignedTo.assignedToName">
    <form:options items="${assignmentRulesForm.assignedToList}"
                  itemLabel="assignedToName"
                  itemValue="assignedToName"/>
</form:select>

The assignedTo property refers to this object:

public class AssignmentDTO {
    private String assignedToName;
    // No other members

assignedToList then is a List<AssignmentDTO>

Really, what I want to happen is for the drop-down to contain all entries in the assignedToList, but to select the value associated with rule[i].assignedto.assignedToName

Presently, what I am seeing is that it does not perform the selection part, and the first item in the drop-down is displayed.

Any help is appreciated.

Thanks

2 Answers 2

2

This should work for you, the path is not the name but the assignedTo:

<form:select path="rules[${counter.index}].assignedTo">
    <form:options items="${assignmentRulesForm.assignedToList}"
                  itemLabel="assignedToName"
                  itemValue="assignedToName"/>
</form:select>

If you have implemented a .equals for your assignedTo, it should just work.

Sign up to request clarification or add additional context in comments.

Comments

0
<html>
    <head>
        <script>
            function show() {
                var op= window.document.getElementById('select');
                var selItem= op.options[op.selectedIndex].value;
                if(selItem=="Others") {
                    document.getElementById('text').style.visibility = 'visible';
                }
                else {
                    document.getElementById('text').style.visibility = 'hidden';
                }
            }
        </script>
    </head>
    <select id="select" onchange="show();">
        <option value="A">A</option>
        <option value="B">B</option>
        <option value="C">C</option>
        <option value="D">D</option>
        <option value="E">E</option>
        <option value="Others">Others</option>
    </select>
    <br>
    <input type="text" id="text" style="visibility:hidden">
</html>

1 Comment

Not sure what you are suggesting here?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.