How can I enable and disable a link based on some value match in a JSP page. So I have a column called person
having values in as A
, T
, L
etc. and based on each value
a link in JSP
page needs to get disabled and enabled
say-
I wanted to disable a settings link on my JSP page if the value from Servlet response is
A
or enable if the value from servlet isT
Servlet code-
public void handleRequest(HttpServletRequest req, HttpServletResponse resp) throws Exception {
HttpSession session = req.getSession(true);
String person= profile.getPerson(); // person = 'A' (assume)
req.setAttribute("pers", person); // 'A' is sent to JSP
this.getServletContext().getRequestDispatcher( "/myPage.jsp" ).forward( req, response );
}
ProfileVO.java--
@Entity
@Table(name = "profile")
public class ProfileVO implements Serializable {
private static final long serialVersionUID = 1L;
@NotNull
private String person;
private String email;
public String getPerson() {
return person;
}
public void setPerson(String person) {
this.person = person;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
@Override
public String toString() {
final StringBuilder sb = new StringBuilder();
sb.append("Profile")
.append(", email='").append(email).append('\'')
.append(", person='").append(person).append('\'')
.append('}');
return sb.toString();
}
HTML code--
<div id="header">
<p><a href="/test.jsp">Settings</a> | Terms & Conditions </p>
</div>
In HTML code, I needed to enable/disable the link on settings
based on the value I get from a servlet.
How should I do that using JQuery
?? or is there any other way I can check value in JSP or Jquery to disable or enable a settings link as soon as a person logs in?