Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jsp/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/322.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用JSP发送参数?_Jsp - Fatal编程技术网

如何使用JSP发送参数?

如何使用JSP发送参数?,jsp,Jsp,我有一个索引jsp。如何从索引页面向某个bean发送参数,以便第二个页面根据发送的参数生成一些数据 这是我的index.jsp: <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=

我有一个索引jsp。如何从索引页面向某个bean发送参数,以便第二个页面根据发送的参数生成一些数据


这是我的index.jsp:

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <h1>Hello World! qqqqq</h1>
        <form name="Input Name Form" action="response.jsp"/>
        <p> Enter your name:</p>
           <input type="text" name="name"/>  
           <input type="submit"   value="ok" />
    </form>

    </body>
</html>
玻璃鱼说: org.apache.jasper.jaspereException:PWC6054:在类型为“a.a”的bean中找不到有关属性“name”的任何信息

怎么了?为什么我的程序不工作???

它需要一个Java bean术语,即您应该提供以下方法:

public void setName(String s) { ... }

public String getName() { ... }

到目前为止你试过什么?这是一个非常“松散”的问题,需要一个更简洁的要求。嗯。。。。我只是想问一下,在scond页面中是否可以将一些参数传递给bean调用,问题是这表明您没有努力解决这个问题。有关如何提出一个好问题的提示,请参阅。稍微更改了问题
public class a {
    public a ()
    {}
    private String name;

    /**
     * @return the name
     */
    public String get() {
        return name;
    }

    /**
     * @param name the name to set
     */
    public void set(String name) {
        this.name = name;
    }
}
public void setName(String s) { ... }

public String getName() { ... }