3

Hi i have a JSP file , while trying to add code i got the 64k limit error. so i decided to add the code to another jsp file and include it inside the first one.

so i have

first.jsp

.....
<jsp:include page="second.jsp"/>
....
<%= foo(); %>

second.jsp ....

<%!
public String foo()
{
 return "test";
}
>%

i try using this and i get this error message: "The method foo is undefined for the type first_jsp"

any idea what is the problem and how i can solve this ?

yossi
  • 12,945
  • 28
  • 84
  • 110

2 Answers2

2

This is the wrong way to do it.

First, if you want some method, create a Java class, and import it using <%@ page import="your.package.YourClass*" %>

Second, don't use scriptlets in the JSP page at all. Use JSTL. Possibly JSTL functions. See here

Community
  • 1
  • 1
Bozho
  • 588,226
  • 146
  • 1,060
  • 1,140
0

Stop using scriptlets. Use JSTL tags to access your data and write your Java code in servlets/regular java classes.

Bal
  • 2,027
  • 4
  • 25
  • 51