aspose file tools*
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
Author

Http 500 Error, String name already defined in _jspService

daljeet seni
Greenhorn

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:
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

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.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Http 500 Error, String name already defined in _jspService