hi
i have a problem in running javascript code between jsp page..
lets below is my jsp body .

<body>
   <script language="javascript" >
	alert("hi");
   </script>
   <h1>hello</hello>
   <% System.out.println("hello"); %>
</body>

in the above code there is no problem in running javascipt .. it gives hi alert easily but.. for below

<body>
   <script language="javascript" >
	alert("hi");
   </script>
   <h1>hello</hello>
   <% System.out.println("hello"); %>
[B]   <jsp:forward page="page1.jsp" />[/B]
</body>

but if above i include any jsp forward page tag or sendRedirect function then this javascript does'nt run..
please help me
i m stuck with this problem..

thnx in advance

Recommended Answers

Do not use forward action. As we know the action forward sends the dynamic content of html of the page1.jsp to web-browser.

Use include action.

<body>
   <script language="javascript" >
	alert("hi");
   </script>
   <h1>hello</hello>
   <% System.out.println("hello"); %>
   <jsp:include page="page1.jsp" />
</body>
Jump to Post

All 2 Replies

Do not use forward action. As we know the action forward sends the dynamic content of html of the page1.jsp to web-browser.

Use include action.

<body>
   <script language="javascript" >
	alert("hi");
   </script>
   <h1>hello</hello>
   <% System.out.println("hello"); %>
   <jsp:include page="page1.jsp" />
</body>

very much thnx

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.