Search This Blog

Best way to use Spring MVC ModelAttribute field in JSTL/JSP page in c:if

        Let's say that you want to hide/show in GUI based on Spring MVC @ModelAttribute field, Kindly follow below mentioned steps :

Guess that you have one UserModel with field saveButton as string type for storing true/false.

UserModel.java

public class UserModel {
    private String saveButton = "true";
}

UserDetails.jsp
<c:if test="${userModel.saveButton == 'true'}">
	<input type="submit" class="btn btn-primary btn-sm" id="saveUserDetails" name="method" value="Save">
</c:if>

In this best way, we can achieve to hide/show button in spring mvc.

No comments:

Post a Comment

Are You A Thinker Or Maybe It's Overflowing?

Hi, everybody. I'm Rohit Patel and I'd like to ask you today, "Are you a thinker Or maybe it's overflowing? Do you live in ...

Popular Posts