Search code examples
javascriptstruts-1struts1

java "bean:write " + javascript = "unterminated string literal


<%@ taglib uri="/tags/struts-bean" prefix="bean"%>

form.parentProcessNumberPresentation.value= "<"+ "<bean:write name="associatedProcessField" property="fieldInstruction"/>" + ">";

when I print the text with the "bean: write" it comes with "\ n", then breaks the string that will be assigned to the components in the form.

how could this filter "\ n" to skip it? I've tried:

form.parentProcessNumberPresentation.value= "<"+ "<bean:write name="associatedProcessField" property="fieldInstruction" filter="false"/>" + ">";

Solution

  • The problem was that "<bean:write name="associatedProcessField" property="fieldInstruction" filter="false"/>" returned one, but it was with "\n" so the string that would be attributed to the JavaScript variable does not was valid.