Permalink
Browse files

#2 Changes in bean variable & getter setter and respective changes in

xhtml pages.
  • Loading branch information...
1 parent cef2566 commit da328cb4fb8c427fc4b2a4a6a40e803221a87094 Mayuresh Rahate committed May 9, 2012
View
@@ -1,28 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
+ <classpathentry kind="con" path="com.google.appengine.eclipse.core.GAE_CONTAINER/appengine-java-sdk-1.6.5"/>
<classpathentry kind="src" path="src"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jre7">
- <attributes>
- <attribute name="owner.project.facets" value="java"/>
- </attributes>
- </classpathentry>
- <classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v7.0">
- <attributes>
- <attribute name="owner.project.facets" value="jst.web"/>
- </attributes>
- </classpathentry>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
- <classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/Javax_Faces">
- <attributes>
- <attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
- <attribute name="owner.project.facets" value="jst.jsf"/>
- </attributes>
- </classpathentry>
- <classpathentry exported="true" kind="con" path="org.eclipse.jdt.USER_LIBRARY/MySql">
- <attributes>
- <attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
- </attributes>
- </classpathentry>
- <classpathentry kind="output" path="build/classes"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="output" path="WebContent/WEB-INF/classes"/>
</classpath>
View
@@ -25,12 +25,28 @@
<arguments>
</arguments>
</buildCommand>
+ <buildCommand>
+ <name>com.google.gdt.eclipse.core.webAppProjectValidator</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>com.google.appengine.eclipse.core.enhancerbuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>com.google.appengine.eclipse.core.projectValidator</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
+ <nature>com.google.appengine.eclipse.core.gaeNature</nature>
</natures>
</projectDescription>
@@ -1,7 +1,11 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.6
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
- <runtime name="Apache Tomcat v7.0"/>
<fixed facet="jst.web"/>
<fixed facet="java"/>
<fixed facet="wst.jsdt.web"/>
@@ -9,7 +9,7 @@
<f:view>
<h3 style="border: thin;">
Welcome
- <h:outputText value="#{loginBean.username}"></h:outputText>
+ <h:outputText value="#{loginBean.userName}"></h:outputText>
</h3>
<h:panelGrid column="1">
<h:outputLink value="/mojarrajsfapp/loggedIn/addinfo.xhtml">Enter Student Information</h:outputLink>
@@ -12,16 +12,16 @@
<h:form>
<h:panelGrid columns="2">
<h:outputLabel value="Roll Number"></h:outputLabel>
- <h:inputText value="#{studentInfo.roll_No}" required="true"></h:inputText>
+ <h:inputText value="#{studentInfo.rollNo}" required="true"></h:inputText>
<h:outputLabel value="First Name"></h:outputLabel>
- <h:inputText value="#{studentInfo.fname}" required="true"></h:inputText>
+ <h:inputText value="#{studentInfo.firstName}" required="true"></h:inputText>
<h:outputLabel value="Last Name"></h:outputLabel>
- <h:inputText value="#{studentInfo.lname}" required="true"></h:inputText>
+ <h:inputText value="#{studentInfo.lastName}" required="true"></h:inputText>
<h:outputLabel value="Class"></h:outputLabel>
- <h:inputText value="#{studentInfo.sClass}" required="true"></h:inputText>
+ <h:inputText value="#{studentInfo.studentClass}" required="true"></h:inputText>
<h:outputLabel value="Division"></h:outputLabel>
<h:inputText value="#{studentInfo.division}" required="true"></h:inputText>
@@ -11,7 +11,7 @@
<table align="center" style="position: relative; top: 250px">
<tr>
<td><h:outputLabel>Enter User Name</h:outputLabel></td>
- <td><h:inputText id="username" value="#{loginBean.username}"></h:inputText></td>
+ <td><h:inputText id="username" value="#{loginBean.userName}"></h:inputText></td>
</tr>
<tr>
<td><h:outputLabel>Enter Password</h:outputLabel></td>
@@ -10,19 +10,19 @@
<h:form>
<h:panelGrid columns="2">
<h:outputLabel value="First Name"></h:outputLabel>
- <h:inputText value="#{signUp.fname}" required="true"></h:inputText>
+ <h:inputText value="#{signUp.firstName}" required="true"></h:inputText>
<h:outputLabel value="Last Name"></h:outputLabel>
- <h:inputText value="#{signUp.lname}" required="true"></h:inputText>
+ <h:inputText value="#{signUp.lastName}" required="true"></h:inputText>
<h:outputLabel value="User Name"></h:outputLabel>
<h:inputText value="#{signUp.userName}" required="true"></h:inputText>
<h:outputLabel value="Password"></h:outputLabel>
- <h:inputSecret value="#{signUp.pwd}" required="true"></h:inputSecret>
+ <h:inputSecret value="#{signUp.password}" required="true"></h:inputSecret>
<h:outputLabel value="Confirm Password"></h:outputLabel>
- <h:inputSecret value="#{signUp.confpwd}" required="true"></h:inputSecret>
+ <h:inputSecret value="#{signUp.conformPassword}" required="true"></h:inputSecret>
<h:outputLabel value="Address"></h:outputLabel>
<h:inputTextarea rows="4" cols="27" value="#{signUp.address}"></h:inputTextarea>
<h:outputLabel value="Email Address"></h:outputLabel>
- <h:inputText value="#{signUp.emailadd}" required="true"></h:inputText>
+ <h:inputText value="#{signUp.emailAdd}" required="true"></h:inputText>
<h:outputLabel value="I am "></h:outputLabel>
<h:selectOneMenu value="#{signUp.gender}">
<f:selectItem itemValue="Male"></f:selectItem>
@@ -1,47 +1,50 @@
package dbconnection;
-import java.sql.*;
-import java.util.*;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.ResourceBundle;
public class DataConnection {
private ResourceBundle rbundle = null;
- String databaseURL,databaseDriver,databaseUser,databasePwd;
- private boolean status = false;
+ String databaseURL, databaseDriver, databaseUser, databasePwd;
private Connection dataConn;
-
- public boolean connect() throws SQLException, ClassNotFoundException{
- try{
- rbundle = ResourceBundle.getBundle("dataconnection");
- } catch(Exception e){
+
+ public boolean connect() throws SQLException, ClassNotFoundException {
+ try {
+ rbundle = ResourceBundle.getBundle("dbconnection.dataconnection");
+ } catch (Exception e) {
System.out.println("Resource Bundle file not found.");
e.printStackTrace();
}
databaseURL = rbundle.getString("DBURL");
databaseDriver = rbundle.getString("DBDRIVER");
databaseUser = rbundle.getString("DBUSERNAME");
databasePwd = rbundle.getString("DBPASSWORD");
- System.out.println("JDBC Driver "+databaseDriver);
+ System.out.println("JDBC Driver " + databaseDriver);
Class.forName(databaseDriver);
- dataConn = DriverManager.getConnection(databaseURL,databaseUser,databasePwd);
- System.out.println("Data Connection object is "+dataConn);
- return true;
+ System.out.println("Getting data connection");
+ dataConn = DriverManager.getConnection(databaseURL, databaseUser, databasePwd);
+ System.out.println("Data Connection object is " + dataConn);
+ return true;
+ }
+
+ public void close() throws SQLException {
+ dataConn.close();
+ }
+
+ public ResultSet execSQL(String sql) throws SQLException {
+ Statement s = dataConn.createStatement();
+ ResultSet r = s.executeQuery(sql);
+ return (r == null) ? null : r;
+ }
+
+ public String execUpdate(String sql) throws SQLException {
+ Statement s = dataConn.createStatement();
+ int r = s.executeUpdate(sql);
+ return (r == 0) ? null : r + "rows updated Successfully";
}
- public void close() throws SQLException
- {
- dataConn.close();
- }
- public ResultSet execSQL(String sql) throws SQLException
- {
- Statement s = dataConn.createStatement();
- ResultSet r = s.executeQuery(sql);
- return (r == null) ? null : r;
- }
- public String execUpdate(String sql) throws SQLException
- {
- Statement s = dataConn.createStatement();
- int r = s.executeUpdate(sql);
- return (r == 0) ? null : r+"rows updated Successfully";
- }
-
-
+
}
@@ -1,4 +1,4 @@
-DBURL=jdbc:mysql://localhost:3307/student
+DBURL=jdbc:mysql://localhost:3306/student
DBDRIVER=com.mysql.jdbc.Driver
DBUSERNAME=root
DBPASSWORD=root
@@ -1,25 +1,31 @@
package faceletbean;
+import java.io.Serializable;
+
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
@ManagedBean(name = "loginBean")
@SessionScoped
-public class LoginBean {
+public class LoginBean implements Serializable {
/**
*
*/
- private static final long serialVersionUID = -8619434251652355587L;
- private String username;
+ private static final long serialVersionUID = -9097631887148949702L;
+ /**
+ *
+ */
+
+ private String userName;
private String password;
- public String getUsername() {
- return username;
+ public String getUserName() {
+ return userName;
}
- public void setUsername(String username) {
- this.username = username;
+ public void setUserName(String userName) {
+ this.userName = userName;
}
public String getPassword() {
@@ -37,9 +43,9 @@ public String signUp() {
}
public String authenticateUser() {
- System.out.println("User name is " + getUsername());
+ System.out.println("User name is " + getUserName());
System.out.println("Password is " + getPassword());
- if (username.equals("Mayuresh") && password.equals("mayuresh")) {
+ if (userName.equals("Mayuresh") && password.equals("mayuresh")) {
System.out.println("Login is succesful");
return "succesful";
} else {
@@ -13,29 +13,29 @@
*
*/
private static final long serialVersionUID = 4222374048972008357L;
- private String fname;
- private String lname;
+ private String firstName;
+ private String lastName;
private String userName;
- private String pwd;
- private String confpwd;
+ private String password;
+ private String conformPassword;
private String address;
private String emailAdd;
private String gender;
- public String getFname() {
- return fname;
+ public String getFirstName() {
+ return firstName;
}
- public void setFname(String fname) {
- this.fname = fname;
+ public void setFirstName(String firstName) {
+ this.firstName = firstName;
}
- public String getLname() {
- return lname;
+ public String getLastName() {
+ return lastName;
}
- public void setLname(String lname) {
- this.lname = lname;
+ public void setLastName(String lastName) {
+ this.lastName = lastName;
}
public String getUserName() {
@@ -46,20 +46,20 @@ public void setUserName(String userName) {
this.userName = userName;
}
- public String getPwd() {
- return pwd;
+ public String getPassword() {
+ return password;
}
- public void setPwd(String pwd) {
- this.pwd = pwd;
+ public void setPassword(String password) {
+ this.password = password;
}
- public String getConfpwd() {
- return confpwd;
+ public String getConformPassword() {
+ return conformPassword;
}
- public void setConfpwd(String confpwd) {
- this.confpwd = confpwd;
+ public void setConformPassword(String conformPassword) {
+ this.conformPassword = conformPassword;
}
public String getAddress() {
@@ -95,9 +95,10 @@ public String doBack() {
public String doRegister() {
System.out.println("Inside register method");
String status = null;
- if (!getFname().isEmpty() && !getLname().isEmpty() && !getUserName().isEmpty() && !getPwd().isEmpty()
- && !getConfpwd().isEmpty() && !getEmailAdd().isEmpty() && !getGender().isEmpty()) {
- if (getPwd().equals(getConfpwd())) {
+ if (!getFirstName().isEmpty() && !getLastName().isEmpty() && !getUserName().isEmpty()
+ && !getPassword().isEmpty() && !getConformPassword().isEmpty() && !getEmailAdd().isEmpty()
+ && !getGender().isEmpty()) {
+ if (getPassword().equals(getConformPassword())) {
status = "success";
;
}
Oops, something went wrong.

0 comments on commit da328cb

Please sign in to comment.