jQuery in Action, 3rd edition
The moose likes JSP and the fly likes Http 500 Error, String name already defined in _jspService Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Java » JSP
Bookmark "Http 500 Error, String name already defined in _jspService" Watch "Http 500 Error, String name already defined in _jspService" New topic

Http 500 Error, String name already defined in _jspService

daljeet seni

Joined: Aug 12, 2010
Posts: 1
HI there,
i am trying to make a simple bank application in jsp, but i am getting a strange Http 500 error,
The code:


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:

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???
Lester Burnham

Joined: Oct 14, 2008
Posts: 1337
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.
I agree. Here's the link: http://aspose.com/file-tools
subject: Http 500 Error, String name already defined in _jspService
It's not a secret anymore!