This week's book giveaway is in the Mac OS forum. We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line! See this thread for details.
Our programs use JSP pages with direct access to the database to grab information from tables to fill listboxes. Whenever we have add and update pages for the same object (like add client, update client - though we aren't object based) our supervisor wants us to have add and update pages that call and add_update page.
i.e. addclient.jsp calls add_update.jsp to display the form (passing empty strings and 0 values to add_update.jsp to fill the form)
i.e. updateclient.jsp calls add_update.jsp to display the form (updateclient.jsp grabs values from Object passed from class file and sets variables to values grabbed from the database and passes these to add_update.jsp to fill the form)
This is the only project that uses javabeans in our workplace so.
displayvisitmonth.jsp calls visitbean and if its empty (meaning I'm adding a visit rather than updating one [which would have been uploaded to the visitbean]) then it grabs the current month and puts it in my variable intMonth.
My problems are setting the days range. I have a select statement that tests the values and for Month values 1, 3, 5, 7, 8, 10 and 12 it creates a listbox that displays the range 1-31. If intMonth equals 4, 6, 9 or 11 then the range of the listbox is 1-30. I have a special case to test February to account for leap years.
My problem is when I update. If the user changes the month I need to update the day listbox. I know this is an onChange event; when the user changes the month value then the day should update.
I want to grab the selectedIndex of my month listbox and use it for the day listbox but my attempts have failed. Can I pass it as a <jsp aram> when I call displayvisitday.jsp or can I grab it in displayvisitmonth.jsp. I've tried both but my code is wrong and I get errors. request.getParameter didn't work like it does when I go to a next page. I am having trouble figuring out how to put the selectedIndex in the value of the <jsp aram> tag.
Any ideas? I have a tempvisitbean I use but I've had no luck setting this on the page with a click event.
If you want to modify the day dropdown as the result of a client-side event (like changing the month dropdown value) then JSP will not help you. Remember that JSP's job is to format the HTML page to send to the client -- once that has been accomplished, its job is done.
Many times when I ask my supervisor how to do something he has requested that I am unfamiliar with he'll just refer me to an older project. In this way we repeat poor, sloppy coding but he just wants it done as fast as we can do it. Basically if it works he is happy. Consistency, effeciency, readability, all these factors are irrelevant to him. But we as students, myself having the most seniority in particular, find it hard to follow old code because each student does things in a different way. So we ourselves, as students, are trying to be consistent with each other so that we and future generations of students will be able to do our job with less aggrivation and less downtime due to trying to figure out how someone did something in old code that is not properly commented.