[英]Parameters cannot be resolved in servlets
I am tryin to get the credentials from jsp page-index.jsp In my servlet-LoginServletwhen under package dao i use 我正在尝试从jsp page-index.jsp获取凭据,在我的servlet-LoginServlet中,当我使用dao软件包时
String userName = request.getParameter(usrnm_gtalk);
String password = request.getParameter(password_gtalk);
it says usrnm_gtalk
and password_gtalk
cannot be resolved. 它说
usrnm_gtalk
和password_gtalk
无法解析。
in my jsp 在我的jsp中
<form name="LoginForm" method="post" action="/dao/LoginServlet>
<input type="text" name="usrnm_gtalk"/>
<input type="password" name="password_gtalk" />
web.xml web.xml
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<servlet>
<description></description>
<display-name>LoginServlet</display-name>
<servlet-name>LoginServlet</servlet-name>
<servlet-class>dao.LoginServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>LoginServlet</servlet-name>
<url-pattern>/Login</url-pattern>
</servlet-mapping>
i have the servlet-api jar in the lib as well as build path 我在库以及构建路径中都有servlet-api jar
can anyone point out wat is the problem Thanks 谁能指出水是问题的原因谢谢
You need to represent them as strings, with doublequotes, not as non-existing variables (as the compiler is trying to tell you). 您需要将它们表示为带双引号的字符串,而不是不存在的变量(编译器试图告诉您)。
String userName = request.getParameter("usrnm_gtalk");
String password = request.getParameter("password_gtalk");
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.