Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Adding a New User's Information

 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys!

I would like to add a new obligatory information when a new user register himself.

In Brazil, for example, almost every citizen has an ID number named CPF. With this number is possible to check if that number is from that user, just visiting a government page!
There you can try the following CPF number: 44444444444, discovering that its number owned to MARIA FERRO PERON, for example! ;)

So, I tried to do some changes, like you can see on the below step-by-step:

1. Add a new column to the database:
ALTER TABLE jforum_users ADD user_cpf VARCHAR(11);

2. Edit the file \WEB-INF\config\languages\pt_BR.properties


3. Edit the file \config\database\generic\generic_queries.sql


4. Edit the file \src\net\jforum\view\forum\UserAction.java


5. Edit the file \src\net\jforum\entities\User.java


6. Edit the file \src\net\jforum\dao\generic\GenericUserDao.java


7. Edit the file \templates\default\user_new.htm


8. Deploy the JForum application with Ant

Finally, the screen created in a new register (/user/insert.page) has the field CPF: * correctly added!

And now, with all these changes, the CPF's value is recorded at user_cpf on jforum_users table!

This post was edited sometimes... but could be instructive for future references!

Enjoy it!!!
[originally posted on jforum.net by leandro_salvador]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe the following explanation can help other JForum's newbies in the future:

1. user_new.htm calls pt_BR.properties via
getMessage("User.fillCpf") and
getMessage("User.cpf")

2. user_new.htm calls UserAction.java via
???

3. UserAction.java calls User.java via
u.setCpf(cpf);

4. User.java calls GenericUserDao.java via
setCpf(String cpf) { this.cpf = cpf; }

5. GenericUserDao.java calls generic_queries.sql via
p.setString(6, user.getCpf());

6. generic_queries.sql calls the database via
UserModel.addNew = INSERT INTO jforum_users (username, user_password,
user_email, user_regdate, user_actkey, user_cpf) VALUES (?, ?, ?, ?, ?, ?)

If anybody whose knows this flow better, please, will be a pleasure be corrected and really understand what JForum does in fact! :P

[ ]'s
[originally posted on jforum.net by leandro_salvador]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic