eran gi

Greenhorn
+ Follow
since Aug 14, 2011
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
1
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by eran gi

From the limited experience I have with teaching people how to program, I've found that the language itself is not the first obstacle. The first thing future programmers have to obtain is the programming state of mind, which is basically how to decompose a problem into parts that can be represented by features of a computer program. Using variables, loops, functions and so on is not a skill we were born with...

My question is, then - does the book aim at providing this programming intuition? When writing such a book, do you test-drive it on absolute beginners, who have never read or written any kind of code?
12 years ago
I'm using form authentication in a toy project of mine. This works fine - you try to access a protected page, the login form is shown, you log-in and move on. There's a little variation I'm thinking of, and was wondering if it's possible: I want a little login form to be placed at the top of the home page, so you can login directly. Just user and password fields, and a submit button. But logging in directly is not possible with form authentication, AFAIK. The only workaround I could think of is have the submit button run some JS instead of posting the form: have some hidden iframe access a protected resource, let the JS place the user and password in the right fields, submit and when done, reload the top page. Does this make any sense? Is there a better way?

BTW, this is possibly a bad usability choice, but I'm still interested in the technical solution. The project is educational...
12 years ago
JSP
I'm new to JSP. In a toy project of mine, I'd like to use useBeans to present data of, say, a user. Given the user has an ID, I'd like the bean to be initialized with the given ID, and have the rest of the properties loaded from the DB. In regular Java code, I'd have a User class with a constructor that gets the ID, and loads the rest of the stuff. However, beans can't do that. I was able to come up with two ways to do such initialization:

1. Have a special setter, say "setInitialize", and then set the "initialize" attribute. This is, IMO, kind of abusive, as "initialize" isn't really an attribute of the bean...
2. Use a scriptlet to explicitly call a "loadUser" method of the bean before getters are called. Possible, but dirties the page with Java code.

Most code examples I could find first set all fields using a form, and then use that data. Is it really that uncommon to initialize the bean somehow, and then just use the getters in EL? How should I better do such initialization?
12 years ago
JSP