package test;
import java.io.*;public class SimpleBean {
private String name;
private String number;
public SimpleBean(){} public String getName() {
return name;
} public void setName(String name) {
this.name = name;
} public String getNumber() {
return number;
} public void setNumber(String number) {
this.number = number;
}
}
<%@ page language="java" import="test.*" pageEncoding="GBK"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'index.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<body>
<jsp:useBean id= "BeanTest" scope= "application" class= "test.SimpleBean"></jsp:useBean>
<jsp:setProperty name= "BeanTest" property= "name" value= "Joe" />
<jsp:setProperty name= "BeanTest" property= "number" value= "123" />
你好,<jsp:getProperty name= "BeanTest" property= "name"/>
<br/>
您的编号是:<jsp:getProperty property="BeanTest" name="number"/>
</body>
</html>运行网页后出现org.apache.jasper.JasperException: Attempted a bean operation on a null object.
请问如何解决?
解决方案 »
- doFilter 问题 路过走过千万别错过啦!~~
- 错误原因,源码附上
- 类似于MANTIS那样的缺陷跟踪系统基于JSP的是不是只有BUGZILLA
- Jive Forums Enterprise v3.2.2
- 救命~~~IE后退时页面输入数据缓存丢失???
- 请教一个jive配置的问题
- 【一个简单问题】关于记录url所传的值的问题
- 关于向已存在的excel文件中添加和修改内容
- 请问如何从ORACLE数据库中取出jpg图像并显示出来?
- SSH from表单提交 struts的<result name="success">/index.jsp</result>错误如下,求大神指教!
- ajax,session失效
- Spring配置文件问题 ssh框架我加入了AOP日志后,启动出现异常
确定你的simplebean.class在你的tomcat\webapps\yourweb\WEB-INF\classes\test目录下
您的编号是:<jsp:getProperty property="number" name="BeanTest" />