0

Flow is forwarded from two controllers to a JSP. From one controller a new Object of Class A is being passed whereas from the second controller a persisted object of class A which is obtained from the db is being passed.

In JSP I need to check if the object has values or new & perform operations respectively. Can anyone tell me how do I check?

I tried this

<c:if test="${empty A}"> Print </c:if>

but it's not working.

underdog
  • 4,447
  • 9
  • 44
  • 89
  • [Is the same question from you?](http://stackoverflow.com/q/20943797/1031945) – Aniket Kulkarni Jan 06 '14 at 09:06
  • I guess your persistent object should have a non-null ID, whereas your new one should have a null ID. You could also pass an additional isNew flag from the controller to the view. – JB Nizet Jan 06 '14 at 09:08

1 Answers1

1

You could pass another attribute to identify an action,

for example:

in controller

request.setAttribute("action", "edit");

in jsp

<c:if test=${action eq 'edit'}">
</c:if>
jmj
  • 237,923
  • 42
  • 401
  • 438