Friday, 15 March 2013

Javascript function not accepting JSP created String -



Javascript function not accepting JSP created String -

i'm using jsps create dynamic web pages...

at origin of 1 of forms, have javascript needs run initialize page given attributes.

i'm creating java string in jsp <% %> blocks want pass initializepage javascript function.

here's code:

<script> $(document).ready(function(){ <%string algorithmxmlpath = request.getcontextpath() + "/" + pepw.path_algorithm_xmls; string initparms = "'" + algorithmxmlpath + "'," + " '" + utilities.getstring(reqbean.getmachinetype()) + "'," + " '" + utilities.getstring(reqbean.getmodel()) + "'," + " '" + utilities.getstring(reqbean.getreasoncode()) + "'";%> initializepage(<%=initparms%>); }); </script>

this results in source code of:

initializepage('/pepasswords/data/algorithmxmls/', '', '', '');

when run this, error in ff error console "unterminated string literal" , points end of initializepage call... when click link in error console, points line });

not sure i'm doing wrong here...

looks 1 of variables had hidden new line "\n" beingness passed jsp call...

i replaced

utilities.getstring(reqbean.getreasoncode())

with

utilities.getstring(reqbean.getreasoncode()).replace("\n", "").trim()

javascript string jsp

No comments:

Post a Comment