First create a new project and add a package under the src folder: such as: cn.tianaoweb.com;
## Then add a package to the package Class: For example,
package com; public class test { public String sd(){ return "sd"; } }
is introduced at the beginning of the default homepage index.jsp (of course you can also create a new jsp file yourself).
<%@ page import="cn.tianaoweb.com.*"%>
Add the corresponding java code piece in
:<% String str; test te=new test();%> <%=te.sd()%>
The above is the detailed content of How to reference java functions in jsp. For more information, please follow other related articles on the PHP Chinese website!