Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 20 additions & 18 deletions PROJO/src/java/aqpg/RegisterUserDao.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,25 @@
*/
public class RegisterUserDao {

public static int Insertion(LoginBean bean) throws SQLException{
ResultSet rs;
boolean records=false;
int status=0;
try{
Connection con=ConnectionProvider.getCon();

PreparedStatement ps=con.prepareStatement("insert into user_2 values(?,?,?)");

ps.setString(1, bean.getLoginName());
ps.setString(2, bean.getPass());
ps.setString(3, bean.getType());
public static boolean addNewUser(LoginBean bean) throws SQLException{
private ResultSet rs;
private boolean records = false;
private boolean isInsertionSuccess = false;
private static final Logger LOGGER = Logger.getLogger(RegisterUserDao.class.getName());
try {
Connection con=ConnectionProvider.getCon();

ps.execute();
}
catch(Exception e){}
status=1;
return status;
PreparedStatement ps=con.prepareStatement("insert into user_2 values(?,?,?)");
ps.setString(1, bean.getLoginName());
ps.setString(2, bean.getPass());
ps.setString(3, bean.getType());

ps.execute();
}
catch(Exception e){
LOGGER.log(Level.SEVERE, "Exception occur", ex);
}
isInsertionSuccess = true;
return isInsertionSuccess;
}
}
}
16 changes: 7 additions & 9 deletions PROJO/web/ProcessAddUser.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,18 @@
<title>Add User</title>
</head>
<body>
<jsp:useBean id="obj" class="aqpg.LoginBean"/>
<jsp:setProperty property="*" name="obj"/>
<jsp:useBean id="userObject" class="aqpg.LoginBean"/>
<jsp:setProperty property="*" name="userObject"/>
<%
int status=RegisterUserDao.Insertion(obj);
if(status==1){
out.println("Congratulations!!!");
boolean isSuccess = RegisterUserDao.addNewUser(userObject);
if ( isSuccess ) {
%>
<jsp:include page="AddUser.jsp"></jsp:include>
<jsp:include page="AddUser.jsp"></jsp:include>
<%
}
else{
out.println("Sorry !!!!");
else {
%>
<jsp:include page="AddUser.jsp"></jsp:include>
<jsp:include page="AddUser.jsp"></jsp:include>
<%
}
%>
Expand Down