當前位置:
首頁 >
前端技术
> javascript
>内容正文
javascript
JSP传值
當從點擊JSP頁面中的鏈接時,會執行相關操作,把后臺所需要的參數傳遞過去。
在后臺action中通過getter/setter 方法得到值:
private String username; private String password;public String getUsername() {return username;}public void setUsername(String username) {this.username = username;}public String getPassword() {return password;}public void setPassword(String password) {this.password = password;}———-我是不合格的分隔線 ————
在后臺接受參數的方式就會發生改變,不再是通過getter/setter方法,而是通過Request對象來獲取參數,如下代碼所示:
//獲得request對象 HttpServletRequest request = ServletActionContext.getRequest();String username = request.getParameter("username"); String password = request.getParameter("password");以上就是關于jsp傳值的一些方法。如有遺漏,敬請期待更新。。。。。。。。。。
創作挑戰賽新人創作獎勵來咯,堅持創作打卡瓜分現金大獎總結
- 上一篇: js定时器的写法
- 下一篇: tomcat内存溢出,修改设置