• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Advice needed for a project

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Okay frnds, I'm almost a beginner in coding. And I've taken up this new project. I need to know if my thought process on the project is correct or not.

Objective:
Create a Dynamic Web Project with JSP pages oon the front.

There is a Welcome page, which has AddEntry and ViewEntry options.

AddEntry asks you to enter a username. When you click submit, this entry is saved alongwith a random generated number in a hashmap. Now, I've still not decided whether to store it in a text file or use hibernate. Then there is a usual ThankYOu page which redirects to the first page.

The ViewEntry page asks you the userName and displays the username alongwith that random number which was generated. Then the same ThankYou page and stuff.

So, I've created the JSP pages and the struts.xml file.
Now I think I need to go create the POJO required, the validation file, and the mapping file and then integrate them somehow.

I'm ready to work on this, but I need to know how should I proceed in this situation.

Please don't give me any code. I want to write it myself.

Thank You.



 
Fame Devon
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Program Flow

Make a user class with attributes userName and gender.

Make the user enter that username and gender on the jsp. Retreive it to your class of user.

Randomly generate a number and put it alongwith the hashMap.

Convert that hashmap to a list

Store the hashMap in the database, or a text file. I prefer text file.

The jsp page will give you the username to be shown. Now retreive that username from the database alongwith the list associated with it.

Display the list on the jsp page.

The displayed will contain a username, gender and the randomly generated number.
 
Bartender
Posts: 10780
71
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Fame Devon wrote:...AddEntry asks you to enter a username. When you click submit, this entry is saved alongwith a random generated number in a hashmap. Now, I've still not decided whether to store it in a text file or use hibernate...


I'm not a great expert on webby stuff, so this is more of a piece of general advice:
You're still at the design stage, yet your description suggests that you're already thinking about implementation.
The giveaway is in phrases like "JSP", "HashMap", "random generated number" and "Hibernate". These are all decisions about how you're going to accomplish your task.

DON'T.

Worry first about what you're going to do, NOT how you're going to do it. It's quite difficult, because a lot of that "how" stuff is probably buzzing around in your head, but resist the urge to cast it in stone.

Describe, in detail, WHAT your app is is going to do. One of the products of a description like that might be a list of functions, eg:
addNewUser
which you can even turn into Java-style method stubs, eg:
public User addNewUser(String name, Date dateOfBirth, String passWord);
but don't worry about coding them - at least not yet. There'll be plenty of time for that later on.

The idea is to postpone decisions about implementation for as long a possible. Obviously, you'll have to do it eventually, but tying yourself into an implementation too early is a sure-fire way to code re-writes.

One of my favourite quotes from the second book I ever read about Object-Orientation:

Lucius Cary, 2nd Viscount Falkland, wrote:When it is not necessary to make a decision, it is necessary not to make a decision.


HIH

Winston
 
Fame Devon
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Wow.. That was like.. really motivating...

Thanks, I'll stick to that advice..
 
Winston Gutkowski
Bartender
Posts: 10780
71
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Fame Devon wrote:Thanks, I'll stick to that advice..


And then the next bit is how to get out of 'development paralysis' (ie, getting past the point where you really do have to decide HOW you're going to do something).

And if you come up with an answer for that, I'm all ears. Still haven't got it completely right after 35 years.

Winston
 
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Winston Gutkowski wrote:And then the next bit is how to get out of 'development paralysis' (ie, getting past the point where you really do have to decide HOW you're going to do something).


Oh, you mean that "crap your pants" moment when you figure out that the tool you were going to use won't work? Hahaha, hohoho, heheehee, what a beautiful day it was until that moment arrived.
 
When I was younger I felt like a man trapped inside a woman’s body. Then I was born. My twin is a tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic