这里面包含了一百多个JAVA源文件

源代码在线查看: e1047. running java code in a jsp page.txt

软件大小: 551 K
上传用户: maple_78
关键词: JAVA
下载地址: 免注册下载 普通下载 VIP

相关代码

				Java code fragments in a JSP page is called a scriptlet. This example demonstrates how to include scriptlets in a JSP page. Use the out variable to add text to the generated output: 
				    				        double rand = Math.random();
				        if (rand < .1) {
				            out.println("you win!");
				        } else {
				            out.println("try again");
				        }
				    %>
				
				This example defines a method that can be used in a scriptlet in the page: 
				    				        String getMsg() {
				            double rand = Math.random();
				            if (rand < .1) {
				                return "you win!";
				            } else {
				                return "try again";
				            }
				        }
				    %>
				    				        // Use the method
				        out.println(getMsg());
				    %>
				
				There are a number of implicit objects available to scriptlets - application, config, exception, out, pageContext, request, response, and session. These implicit objects are described in the JSP 1.2 Specification available at http://java.sun.com. 			

相关资源