当前位置: 代码迷 >> Java Web开发 >> 请问:org.apache.jasper.JasperException: Cannot find any information on property 'userPhone' in a bean of type 'Bean.Sender'
  详细解决方案

请问:org.apache.jasper.JasperException: Cannot find any information on property 'userPhone' in a bean of type 'Bean.Sender'

热度:6969   发布时间:2013-02-25 21:20:08
请教:org.apache.jasper.JasperException: Cannot find any information on property 'userPhone' in a bean of type 'Bean.Sender'
在编译的时候爆出这样的错误:
org.apache.jasper.JasperException: Cannot find any information on property 'userPhone' in a bean of type 'Bean.Sender'
jsp代码:
<%-- 
  Document : sender
  Created on : 2008-3-17, 14:01:17
  Author : Administrator
--%>

<%@page contentType="text/html;charset=gb2312" pageEncoding="UTF-8"%>
<%@page import="java.util.*"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
  "http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
  <meta http-equiv="Content-Type" content="text/html;charset=gb2312">
  <title>JSP Page</title>
  </head>
  <body>
   
  <form method="POST" action="">
  绑定用户ID:<input type="text" name="userPhone" value="" /><br>
  绑定命令:<input type="text" name="command" value="" /><br>
  <input type="radio" name="command" value="single" />单次定位
  <input type="radio" name="command" value="consequance" />连续定位
  <input type="radio" name="command" value="cease" />停止连续定位
  <input type="radio" name="command" value="shutLED" />关闭定位器LED<br>
  <input type="reset" value="重置" name="reset" />
  <input type="submit" value="提交" name="submit" /><br>
  </form>  
  <%
  String commands=request.getParameter("command");
  //String userPhone=request.getParameter("userPhone");
  String msgPrefix[]={"GG","GM","GS","GL"};
  String feedback="";
   
  if(commands.equals("single"))
  feedback=new String(msgPrefix[0]);
  if(commands.equals("consequance"))
  feedback=new String(msgPrefix[1]);
  if(commands.equals("cease"))
  feedback=new String(msgPrefix[2]);
  if(commands.equals("shutLED"))
  feedback=new String(msgPrefix[3]);
  %>
  <jsp:useBean id="sender" class="Bean.Sender" scope="page"/>  
  <jsp:setProperty name="sender" property="userPhone" param="userPhone"/>
  <jsp:setProperty name="sender" property="sendData" param="<%=feedback%>"/>
  <jsp:getProperty name="sender" property="userPhone"/>
  <jsp:getProperty name="sender" property="sendData"/>  
  <%
  //sender.sendCommands();
  %>
  <h2>first try,Hello World!</h2>  
  </body>
</html>
javabean代码:
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Bean;
import java.net.*;
import java.io.*;
/**
 *
 * @author Administrator
 */
  相关解决方案