Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!

jim yin

Ranch Hand
+ Follow
since Aug 15, 2002
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
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by jim yin

Originally posted by Junilu Lacar:
I was working on the wrong assumption. I thought the flow would be: select a company, retrieve & display list of departments for the selected company (implies that each company may have a different set of departments), select a department, retrieve & display list of employees for the company/department.
If each company has the same set of departments then that simplifies things a little. You still wouldn't need to have multiple actions/forms though and you can use a simplified variation of the code I gave.



Thanks, Junilu:
Could you help answer the above questions I raised?
I think they are the key for me to find a solution.
For example, how do I handle pre-population, retrive selected dept and employee list in the same action?
regards,
Jim
18 years ago
Junilu, thank you very much for your new idea.
As you guessed, I have tried using two action classes, or using javascript code to dynamically populate dependent lists, both are not successful.
I am almost desperate on this thing.
The tricky part for this problem: I need to pre-populate company and department lists, and create
a empty employee list before user select department and populate employee list. So, I need my action class to do this first. Once this is defined, I cannot do other things in this action class, right?
Now, in order to auto-submit a selected department like what you pointed in your code above, I need to define another action class, put employee results into session scope for employee list to use. But if I use another form for this, the pre-population part will be broken, I don't know how to pre-populate the following forms (I always associate actions with forms, am I right on this?):
<html:form>
[company-list]
</html:form>
<html:form>
[department-list]
[employee-list]
</html:form>
If I use your above design, I face the same problem: how can I pre-populate two lists and init third blank one if I use my only action class to detect department selections? This is like a blackbox to me.
Sorry, I did not mention I did not need to populate
department as a dependent list. Once company and department lists are prepopulated, they will not change. Only employee list will be dependent on department list.
I have several questions about your design:
- Why do I need to store old values? If I select a new department, new employees will be filled in the empolyee list. User will select a company, a department, and an employee once employee list is filled, then use three selections to do a saerch and display results on the bottom of the page. So, I only need current selections. I may miss something since I am totally unexperienced to Struts.
-Like I asked above, how can I handle pre-population, and dependent population in one action class. (If I use 2 html:form's (actions), I cannot think a way to pre-populate lists either).
-If action receives the selected department, it gets employee list from db, I am still not sure how it will dynamically fill employee list in jsp page.
If I do sth like this:
session("employees", employees)
Will jsp page look for the results in sesion scope and dynamically fill employee list? This sounds like need another actionMapping to do the job?
regards,
Jim
[ July 24, 2003: Message edited by: jim yin ]
18 years ago
Thanks, Junilu:
That was a wonderful explanation, it clears my missing links of the general flow. I did read a struts book, but I lost track of part of what you said once I put my book down.
Its certainly very relevant to my problem. I guess multiple forms are possible, the only problem now is how to make a selction something like a submit (that is, it will sends the selected parameter over to action class).
regards,
Jim
18 years ago
Thanks, David:
You must be DA expert, and I may get your book to understand it more.
Here is the problem, I changed my directory structure, now even I do commit, some folders there. This is not what I want. When I do a synchronize with repository, it tells me workspace is the same as remote repository. But when I load CVS repository, I still see some empty folders I do not want. How can I delete these empty folders?
Thanks,

Originally posted by David Gallardo:
It's a piece of cake! Just make your changes and commit. Eclipse and CVS will take care of the details.
For example, I created a new package in a project and moved some existing files from another package into it by dragging and dropping them. Eclipse did the necessary refactoring automatically. I also deleted an obsolete file.
When I committed the changes (on my desktop) and then updated the project on another machine (my laptop) the new structure and file deletion were reflected.
@D
[ July 22, 2003: Message edited by: David Gallardo ]
[ July 22, 2003: Message edited by: David Gallardo ]

Hi,
I am using Eclipse, I checked in my project days ago. Now I find its directory structure is not right, I want to delete and change some of them. How can I do it?
Thanks,
Hi, JiaPei:
Thanks for your info. I am not very familiar with JavaScript, and I believe my problem is a bit different from it. Actually, I have not reached this point. Lets work together on this, and I believe we will be able to do it with kind help from Junilu and other experts.
what I currently want to do is: find a way to send the results back to my jsp page. For example, if I have the following 2 lists:
[company list]
[department list]
[empoyee list]
If employee list is a dependent list of department list. Suppose we have JavaScript function-populate-to do the job for us, my first problems are:
-If I use this script function, do I stll have to
use action class to send empolyee list back?
-how to pass relevant employee list to my Jsp page
based on the selected item?
I am thinking about send the selected item to an action class to process and get results, but it seems the select action will not make action form to pass the selected department to action class, we need a submit and have to send all 3 items back (Am I understanding correctly?). So, this method may be wrong.
But if I create another action class for department selection, I will need another html:form, multiple forms are not allowed?
I just cannot think of a nice way to handle this.
Jim
18 years ago
Hi, Junilu:
More questions. I am now trying to populate a dependent list based on the selected item from the first list. If I only pre-populate the company and department lists, and do not prepopulate employee list.
When I select an department item, the employee list should be populated. My actionForm includes company, dept, and emp variables, and getters/setters. I can use actionForm to send the selected dept to action class(will this work?), then get results from database. But how can I pass the results back to jsp page?
Should I create another action class and action form for this task?

regards,
Jim
[ July 22, 2003: Message edited by: jim yin ]
18 years ago

Originally posted by Junilu Lacar:
You should be able to have any number of drop-down lists on a single form. What is the error you are getting? Please post the relevant portions of your JSP and ActionForm so we can check for any mistakes.


Thanks, Junilu:
I found my mistake for this error: a typo for my
bean method (Yikes). Thanks for your kind help.
regards,
Jim
18 years ago
Hi, Junilu:
I still need your enlightment.
I can make one drop-down list work, but when I add
other two drop-down lists, I wa told the actionForm
cannot be created.
Here is what I did: for example, I define company, department, employee in my only actionForm, set up getters and setters. I created CompanyBean, DepartmentBean, and EmployeeBean for each drop-down list. In my action class, I get three collections and put them into session context
What did I do wrong? Is one actionForm ok for 3 dropdown lists? Or I need 3 action forms to do the job? Is it possible for one action class to pass 3 action forms?
regards,
Jim
18 years ago
Hi,
I am doing my first struts app, and I am very confused about everything: I have 3 drop-down lists, I have to populate them before user selections and submission. So, there are two things I have to do: pre-populate the lists, and handle user selections and submission. I try to do these things in one jsp, one actionForm and one Action class. But I have not been successful. I even cannot prepopulate the lists.
I am wondering if I need to define two pages, forms and actions to handle two things separately?
I am using collections to pre-populate lists, I use <html ptions> in my JSP page to get data. But how can I define my actionForms for these collections?
Its just driving me crazy!
regards,
18 years ago
I guess they might be updating their question bank. But one thing is certain: they will maintain the difficulty level for this test. The person I mentioned got 98% on his SCJP six months ago. You can see the difference between IMB certs and SUN certs.
He emphasized the above six areas and I jot down, but he did not want to talk about how is the percentage for each, and I did not want to ask more . He also said he got 90% on the new sample, and it is misleading. Anothing, he said most of questions are very practical, people with experience may answer better. I am a bit scared too, just do not want to waste my $150 and damage my confidence.
One person from my class just took it yesterday, and failed miserably with 51%. He told me there were 55 questions and passing score is 58%. He has prepared for 3 months. This is what he said: any sample test is even not near the real test, whiz is useless, very reading-intensive ( he did not have enough time to think over), about 70% scenario-based questions, guessed 80% of the questions, none from sample tests, cover every area such as WSDL, UDDI, SOAP, XSL-FO, DOM, SAX, XML Signature. And he got 0% on architecture.
I guess I need more time to crack the above six areas and read all the recommendations. Based on what he aid, I believe IBM loewered passing score to 58% but raised the difficulty level.
BTW, is there any resource on SOAP, WSDL, UDDI, and XML signature?
Maybe moderators can help you out.
Jayadev and Svetlana: Pls check ur mails.