Home > Java > javaTutorial > body text

How to reference java functions in jsp

(*-*)浩
Release: 2019-05-24 14:35:44
Original
4244 people have browsed it

First create a new project and add a package under the src folder: such as: cn.tianaoweb.com;

How to reference java functions in jsp

## Then add a package to the package Class: For example,

package com;
public class test {
    public String sd(){
        return "sd";
    }
}
Copy after login

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.*"%>
Copy after login

Add the corresponding java code piece in :

<%
  String str;
  test te=new test();%> 
<%=te.sd()%>
Copy after login
In this way, the Java function is successfully referenced. Go to the JSP page.

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!

Related labels:
jsp
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template