简体   繁体   中英

How can I pass values from jsp to servlet using jstl

I want to pass the value of a variable that I retrieve from one servlets to another servlets. I don't want to use session. For example when I submit the form I want the value of nickname to pass to the second servlet.

This value Nickname

<li input type="hidden" name="nickname" value="${fn:escapeXml(obj.nickname)}">
  Nickname: <c:out value="${obj.nickname}"/>
</li>

I use this link Stack Example

in your form you can set a hidden input which you pass to your second servlet:

<input name="nickname" value="${obj.nickname}" type="hidden"/>

This code is wrong, you can't have the word " input " randomly as a list attribute.. You also cannot have the type , name or value attribute on a list tag..

<li input type="hidden" name="nickname" value="${fn:escapeXml(obj.nickname)}">
  Nickname: <c:out value="${obj.nickname}"/>
</li>

Check out the link here below, it shows the legal html tags you can use to send information with a form. You can only use these. So a list won't work.

https://www.w3schools.com/html/html_form_elements.asp

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM