Home > Back-end >  Request. The getParameter () value is null
Request. The getParameter () value is null

Time:10-04

Request. The getParameter () is always null values?




<meta charset="UTF-8">
Resume & lt;/title> <br/></head> <br/><body> <br/><The form action="download. Do" method="post" enctype="multipart/form - data" & gt; <br/>Password: & lt; Input type="password" id="passwd"/& gt; <br/><Input type="submit" value="https://bbs.csdn.net/topics/upload" name="upload/& gt;" <br/></form> <br/></body> <br/></html> <br/><br/>String password=request. The getParameter (" passwd "); <br/>System. The out. Println (password); <br/><br/>Everybody a great god help see the request. The getParameter () is always null values? <br/>Thank you very much!!!!!!!!!!!<p class="article - content rp"> CodePudding user response: </p><Input type="password" id="passwd"/& gt; Name attribute name="passwd"<p class="article - content rp"> CodePudding user response: </p>Why do I get the name from inside the session attribute value, will get twice a null value of the second to get the name, <br/>String c_name=(String) session. The getAttribute (" Login_Name "); <br/><br/>System. The out. Println (session. The getAttribute (" Login_Name ")); <br/>Program output results as follows: <br/>Null <br/>kgt<p class="article - content rp"> CodePudding user response: </p>Name=passwd<p class="article - content rp"> CodePudding user response: </p>Didn't write the name attribute and name="passwd"<p class="article - content rp"> CodePudding user response: </p><img SRC="https://img.codepudding.com/202010/130561041515031.gif" Alt=""/>, the code is wrong, to name=" passwd "is wrong!<p class="article - content rp"> CodePudding user response: </p><fieldset> <legend> reference 5 floor preserve717 reply: <legend> <blockquote> <img SRC="https://img.codepudding.com/202010/130561041515031.gif" Alt=""/>, the code is wrong, to name=" passwd "is wrong! </blockquote> <fieldset> <br/>Impossible, name=password can surely<p class="article - content rp"> CodePudding user response: </p>That could be enctype="multipart/form - the data" the problem here<p class="article - content rp"> CodePudding user response: </p>Enctype="multipart/form - the data" <br/>The problem of the above properties <br/>Because the function of the upload to use this attribute <br/>This attribute to the inside of the form data is turned into a binary <br/>So you have a problem to get the password, <br/><br/>Or to separate the two form <br/>Upload or use other technical implementation<p class="article - content rp"> CodePudding user response: </p>The id attribute to the name attribute, try!<p class="article - content rp"> CodePudding user response: </p>Elder brothers to FORM FORM to submit your data is not very understanding, first of all, you in the POST request of way, the parameters is through the FORM submission, submit, rather than by ID when submitting the FORM parameter matching the NAME of this attribute <br/>Code so you should add the input tag NAME="passwd" put this property, can obtain the parameter value<p class="article - content rp"> CodePudding user response: </p><pre> <br/><! DOCTYPE html> <br/><html> <br/><head> <br/><meta charset="UTF-8"> <br/><title> Resume & lt;/title> <br/></head> <br/><body> <br/><The form action="download. Do" method="post" & gt; <br/>Password: & lt; Input type="password" name="passwd"/& gt; <br/><Input type="submit" value="https://bbs.csdn.net/topics/upload" name="upload/& gt;" <br/></form> <br/></body> <br/></html> <br/><br/>String password=request. The getParameter (" passwd "); <br/>System. The out. Println (password); <br/></pre><p class="article - content rp"> CodePudding user response: </p>7, 8 floor, have said is very right <br/><br/>Request. The getParameter (); The get and post are available, but shall not apply to the contentType for multipart/form - the data<p class="article - content rp"> CodePudding user response: </p>JSP transfer value is obviously name=passwd value, input tags do not have the name value, how could the servlet receives the request. The getParameter (" passwd ");<p class="article - content rp"> CodePudding user response: </p>Change the id to name </div> <div class="th_page th_page_color"></div> <div class="umCopyright"> <p>Page link:<a href="/Backend/50653.html" target="_blank" style="color:#999">https//www.codepudding.com/Backend/50653.html</a></p> </div> <div class="detail-arr"> <div class="detail-arr-left">Prev:<a href='/Backend/50652.html'>Ubuntu software downloads in eclipse store the following problems when it is started</a></div> <div class="detail-arr-right">Next:<a href='/Backend/50654.html'>Hhibernate configuration problem</a></div> </div> </div> </div> </div> </div> <div class="container th_top"> <div class="row"> <div class="col-md-12"> <div class="hot-tags neitags"> <ul> <li><i class="iconfont icon-x-tags"></i> Tags:  </li> <a href='/e/tags/?tagname=Java+SE' target='_blank'>Java SE</a> </ul> </div> </div> </div> </div> <div class="container th_top"> <div class="row"> <div class="col-md-12"> <div class="xiangguan"> <ul class="msg msghead"> <li class="tbname">Related</li> </ul> <ul> </ul> </div> </div> </div> </div> <div class="container th_top"> <div class="row"> <div class="col-md-12"> <div class="flinks"> <ul> <li><i class="iconfont icon-x-tags"></i> Links:  </li> <li class="liflinks"><a target="_blank" href="/" title="CodePudding">CodePudding</a></li> </ul> </div> </div> </div> </div> <div class="footer"> <p><span style="font-size:16px;color:#666;font-weight: bold">About Us:</span>  <a href="https://www.codepudding.com/contact.html">Contact Us</a>      <a href="https://www.codepudding.com/service.html">Terms of Service</a>      <a href="https://www.codepudding.com/privacy.html"> Privacy Policy</a></p> <p class="foot_info">Copyright © 2010-2023,Powered By <a href="/" target="_blank">CodePudding</a> </p> </div> <script type="text/javascript" src="/skin/code/tianhu.js"></script> </body></html>