Passing parameter without use of HTML forms in JSP

后端 未结 3 1119
粉色の甜心
粉色の甜心 2020-12-30 11:06

I have done some research, and majority of the examples I have found use forms (obviously for user input) to collect data which is then passed to another JSP page through th

3条回答
  •  太阳男子
    2020-12-30 11:34

    You usually pass data between servlet/JSP or JSP pages in scoped attributes (in request, session or application). E.g. request.setAttribute("key", data) can set "key" attribute in one JSP, and request.getAttribute("key") gets you this data in other JSP (if multiple JSPs are processing same request).

    It is possible to create fake parameters by wrapping your request, and overriding getParameter and similar method, if that is what you really need.

    Update: my answer is talking about passing data between several parties which all process same request. This may or may not be what you want, as your question isn't clear.

提交回复
热议问题