getParameter

getParameter

public java.lang.String getParameter(java.lang.String name)

Returns the value of a request parameter as a String, or null if the parameter does not exist. Request parameters are extra information sent with the request. For HTTP servlets, parameters are contained in the query string or posted form data.

将请求参数(a request parameter)的值作为 String 返回,如果参数不存在,则返回 null。

请求参数是随请求一起发送的额外信息。对于 HTTP servlet,参数包含在查询字符串或发布的表单数据中。

You should only use this method when you are sure the parameter has only one value. If the parameter might have more than one value, use getParameterValues(java.lang.String).

仅当确定参数只有一个值时,才应使用此方法。如果参数可能有多个值,请使用 getParameterValues(java.lang.String)。

用于读取提交的表单中的值

只能传name,不能传id

html里可以有重名name

If you use this method with a multivalued parameter, the value returned is equal to the first value in the array returned by getParameterValues.

如果将此方法用于多值参数,则返回的值等于 getParameterValues 返回的数组中的第一个值。

If the parameter data was sent in the request body, such as occurs with an HTTP POST request, then reading the body directly via getInputStream() or getReader() can interfere with the execution of this method.

如果参数数据是在请求体中发送的,例如在HTTP POST请求中,那么直接通过getInputStream()或getReader()读取请求体可能会干扰此方法的执行。

Parameters:

name - a String specifying the name of the parameter

Returns:

String representing the single value of the parameter

See Also:

getParameterValues(java.lang.String)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值