reset password
Author Message
lmann2
Posts: 156
Posted 21:32 Feb 16, 2015 |

We were asked to create a "add" link next to the question we were going to add.  It doesn't seem like this was meant to be a form element.  Is that what you intended?

If so, it seems like we'd only need a get method in the controller or is it better to try to do binding for the next half?

Also, if we have a model attribute that is a list of objects how do we access the field of the individual fields in the jsp?  For example, I have a list of books and I use a for each loop in the jsp to to access each individual book.  I want to display book.description (and my model is called allBooks) in <form:input path="description"/>, but doing this will return a error message because description is bound to allBooks.description, but I want allBooks.book.description.  I had a similar problem with the HW, is this just not possible in Spring forms? 

 

Last edited by lmann2 at 22:07 Feb 16, 2015.
cysun
Posts: 2935
Posted 23:21 Feb 16, 2015 |

1. Yes.

2. I can't tell you what's better or not for the 2nd half.

3. If you have to use Spring form tag for that, you can probably do something like this:

<form:form modelAttribute="allBooks">
    <c:forEach items="${allBooks.books}" varStatus="status">
        <form:input path="books[${status.index}].description" />
    </c:forEach>
</form>
lmann2
Posts: 156
Posted 15:44 Feb 17, 2015 |

We use sessionStatus session -> session.complete only when we have model maps that we want to remove from the session scope, correct? 

cysun
Posts: 2935
Posted 16:00 Feb 17, 2015 |
lmann2 wrote:

We use sessionStatus session -> session.complete only when we have model maps that we want to remove from the session scope, correct? 

Yes.

lmann2
Posts: 156
Posted 16:06 Feb 17, 2015 |

I'm getting this message from spring security when I get make a get request to my jsp that was otherwise functioned fine before:

2015-02-17 16:42:39,868 ERROR ExceptionResolver: Exception caused by cysun
java.lang.IllegalArgumentException: Failed to evaluate expression 'returnObject.isInstructor(principal) or returnObject.isEnrolled(principal) or principal.faculty'

I think this is probably key, but I don't understand why it's null:

Method call: Attempted to call method isInstructor(csns.model.core.User) on null context object

The rest of the log message is attached

Attachments:
Last edited by lmann2 at 16:58 Feb 17, 2015.