Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Looking for ideas/discussion on "Best Approach"  RSS feed

 
O. Ziggy
Ranch Hand
Posts: 430
Android Debian VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Looking for ideas/discussion on "Best Approach"

I have to create a form using JSP/Servlets with the following form fields

Customer Details
---------------------
Customer ID
Name
Street
City
Country

Product Details
-------------------
Product ID
Product Name
Manufacturer
Product Code
Country of Production //Where the product was manufactured

Product Certificate Details
----------------------------
Certificate ID
Issue Date
Country of Issue

The purpose of the form is so that the user can enter the customer details, product details and certificate details and submit the form for the data to be saved on to an database. That is ok if it was that simple

The idea is to make the form as easy as possible to complete so the following functionality will be available on the form.

A search icon will be available next to Customer ID which when clicked will display a pop up window with a list of all the customer ids available. The user can then select a customerid from the pop up window and the application will populate the customer details on the parent window based on the ID.

A similar type of popup/lookup window will be available for Productid, product code in product details and certificate id in certificate details.

There will also be a lookup window for all the country elements in the form. I.e Country under customer details, Country of production and country of issue.

Now the bit that i am interested in is what is the best way of implementing this using jsp,servlets and struts. I am mainly interested in knowing how you would implement the following functionality

1 - The database stores nearly 23,000 product codes. If the user selects the search icon to load all the product codes so that they can select one, how would you manage these? Presumabely it wont make sense to display 23,000 product codes for the user to select 1 from the list. I think the best way to do this is to paginate the list on the popup window. Is there anything in JSP to simplify this?

The other question is where/how would you store the product codes on the client? or would you store them at all?

2. The other thing that i would like some advice on is what is the best way to implement the lookup window for Country, Country of Production and Country of issue. Im thinking as all these 3 elements are retrieving the same data i should have a generic component that can be used for all 3. How can you make the generic component to determine which form field of the 3 is to be populated if they have different names?

3. And finally when the popup window loads, is there any other way other than Javascript to populate a form element on a parent window based on a clicked hyperlink on a child window?

4. And finally finally, is it better to display the pop window in a "new window" via a new jsp request or a hidden css DIV layer?

Thanks

ps. I've asked this question somewhere else but i thought i ask here as well.
[ November 07, 2008: Message edited by: O. Ziggy ]
 
Steve Luke
Bartender
Posts: 4181
22
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1 - I think the best way to do this is to paginate the list on the popup window. Is there anything in JSP to simplify this?


Pagination would be best here. JSP doesn't have built in pagination but there are tags that help you out. If you search google for JSP paging you should get some samples. Also, read this part of the JSP FAQ.

2. How can you make the generic component to determine which form field of the 3 is to be populated if they have different names?


I think it is the correct idea to make a single generic component for this. The best way to tell this generic component the name of the field it is supposed to populate would be to provide the name as a request parameter.

So if you are trying to fill a field named customerCountry then the URL you request for the Country lister would be:
http://www.my.com/po/CountryList.jsp?fieldName=customerCountry
The JSP would read the request parameter and fill it into the javascript needed to talk back with the parent page.

3. And finally when the popup window loads, is there any other way other than Javascript to populate a form element on a parent window based on a clicked hyperlink on a child window?


No, you will need to use JavaScript. There are different ways of using javascript but the simplest would be to just talk directly from one window to the other using window.opener.

4. And finally finally, is it better to display the pop window in a "new window" via a new jsp request or a hidden css DIV layer?


I like the DIV layer a lot of the time, because it makes a snazzy look, gets around the popup blockers, and it is easier to use JS to talk inside the same document then it is across multiple documents. But it is kind of hard to implement dynamically (ie, if the content you want to display is a different JSP/web page then you have to use AJAX-like techniques). On the other hand if the content can be generated statically (relative to the client browser) you can use JSP Tag Files to make the contents and it works well.

The popups are easy to generate, their contents can easily be made dynamic (content from the server updated when the popup is made, as opposed to when the starting page is made) so they can react to previous selections in the form quite easily. On the other hand, the user has more control over the popup, they can block them or have them open up in a tab instead of a window.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!