There are two ways available to use <portlet:namespace/> inside script tag / js file
1) Take hidden variable inside JSP and store value of portlet name space in it
2) Use script tag inside your JSP file and directly use <portlet:namespace/>
1) Take hidden variable inside JSP and store value of portlet name space in it
<input type="hidden" name="nameSpaceValue" id="nameSpaceValue" value='<portlet:namespace/>' />
Once it is declared like this inside .js file we can use portlet name space like this,
var nameSpaceVal = document.getElementById('nameSpaceValue').value;
document. + nameSpaceVal + fm.action = {some action}
2) Use script tag inside your JSP file and directly use <portlet:namespace/>
function getStudentDetail() {
document.<portlet:namespace/>fm.action='<%=getStudentDetails%>';
document.<portlet:namespace/>fm.submit();
}
For debugging purpose, you can check the value of the function(getStudentDetail()) and how the values are getting formed for the lines
document.<portlet:namespace/>fm.action='<%=getStudentDetails%>';
document.<portlet:namespace/>fm.submit();
Cheers!
Henal Saraiya
(Senior Consultant)
CIGNEX Datamatics
1) Take hidden variable inside JSP and store value of portlet name space in it
2) Use script tag inside your JSP file and directly use <portlet:namespace/>
1) Take hidden variable inside JSP and store value of portlet name space in it
<input type="hidden" name="nameSpaceValue" id="nameSpaceValue" value='<portlet:namespace/>' />
Once it is declared like this inside .js file we can use portlet name space like this,
var nameSpaceVal = document.getElementById('nameSpaceValue').value;
document. + nameSpaceVal + fm.action = {some action}
2) Use script tag inside your JSP file and directly use <portlet:namespace/>
function getStudentDetail() {
document.<portlet:namespace/>fm.action='<%=getStudentDetails%>';
document.<portlet:namespace/>fm.submit();
}
For debugging purpose, you can check the value of the function(getStudentDetail()) and how the values are getting formed for the lines
document.<portlet:namespace/>fm.action='<%=getStudentDetails%>';
document.<portlet:namespace/>fm.submit();
Cheers!
Henal Saraiya
(Senior Consultant)
CIGNEX Datamatics
No comments:
Post a Comment