Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Http 500 Error, String name already defined in _jspService

 
daljeet seni
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI there,
i am trying to make a simple bank application in jsp, but i am getting a strange Http 500 error,
The code:
Registeration.html

adduser.jsp

The problem:
Earlier whenever i used to assign any string name for name,password,account no.
I used to get string_name already defined in _jsp service method.
Now its not even compiling,here's the output screen of Netbeans:

init:
deps-module-jar:
deps-ear-jar:
deps-jar:
library-inclusion-in-archive:
library-inclusion-in-manifest:
compile:
compile-jsps:
Compiling 1 source file to E:\Documents and Settings\DalJeet\Bank1\build\generated\classes
E:\Documents and Settings\DalJeet\Bank1\build\generated\src\org\apache\jsp\adduser_jsp.java:60: username is already defined in _jspService(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
String username =request.getParameter("uname");
^
E:\Documents and Settings\DalJeet\Bank1\build\generated\src\org\apache\jsp\adduser_jsp.java:61: userpass is already defined in _jspService(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
String userpass =request.getParameter("pass");
^
E:\Documents and Settings\DalJeet\Bank1\build\generated\src\org\apache\jsp\adduser_jsp.java:62: account is already defined in _jspService(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
String account =request.getParameter("accn");
^
3 errors
E:\Documents and Settings\DalJeet\Bank1\nbproject\build-impl.xml:364: The following error occurred while executing this line:
E:\Documents and Settings\DalJeet\Bank1\nbproject\build-impl.xml:149: Compile failed; see the compiler error output for details.
BUILD FAILED (total time: 1 second)

I tried with many different string names, but all in vain.
Any solution???
Thanks.
 
Lester Burnham
Rancher
Posts: 1337
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
String account = null;
String userpass=null;
String username=null;
String username =request.getParameter("uname");
String userpass =request.getParameter("pass");
String account =request.getParameter("accn");

Here you're defining 3 fields twice, just like the error messages are stating - Java doesn't allow that. Remove the first 3 lines and it'll work.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic