
i want to assign a java property to a js variable:
action class: collegename have a property in action class which having its getter/setter method.
JSP code:
<%@ taglib prefix="s" uri="/struts-tags"%>
<% response.setContentType("application/javascript"); %>
var collegename = '
Java Script code: alert("collegename"+collegename) it show on IE: 'collegename' is undefined it show on IE: 'collegename' is undefined
i have also tried this method: Action class: HttpServletRequest request; request =ServletActionContext.getRequest(); request.setAttribute("collegename ", collegename );
JSP code: <%@ taglib prefix="s" uri="/struts-tags"%> <% response.setContentType("application/javascript"); %> var collegename= '<%=request.getAttribute("collegename")%>';
Java Script code: alert("collegename"+collegename) it show on IE: 'collegename' is undefined
please suggest.

Please visit the following link:
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.