Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Adding a New User's Information

 
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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]
 
No more fooling around. Read this tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic