About JSP design
Hi there,
I am actually developing a web site and using JSP servlet to do.... And I am struggling with some mechanism of adding stock... which the page for adding stock like...
Stock Name :...................
Stock Price :..................
Stock Supplier :
-
Supplier |
-
| Empty|
-
Add New Supplier
Add Stock
Now if staff want to have a stock that has name, price, and list of supplier... which the supplier can be more than 1... Note that the list of supplier is like a table that showing supplier details... If staff want to add supplier... he or she will press the Add Supplier button and will be redirected to query and choose the desired supplier... After staff add a few Supplier... He or she will press the Add Stock button....
So how I can make this kind of situation? I am really appreciate for your time! Thanks very much!
[920 byte] By [
-wizz-a] at [2007-11-26 16:31:22]

# 1
You can use a framework or a design pattern to do this or you can build your own solution. Desing a front end with JSP, then Java code in the middle layer, you can use JDBC to connect to the database.
# 2
Hi Appy77,Thanks for you reply! Yes at the moment I am developing using MVC design... But somehow I am confused in presentation layer... using JSTL... Can you give me some example to manage Presentation layer for my design? Thanks!
# 3
First you can build a prototype/ page layout with HTML, then you can start translating the dynamic portions into JSP code.
In order to use JSTL you must first set up your environment with proper JAR files and other dependencies. All details on dependencies are mentioned here:
http://jakarta.apache.org/taglibs/doc/standard-doc/intro.html
You can use <jsp:useBean tag to get the value of stockName and stockPrice provided that these properties are stored inside a JavaBean, inside the JavaBean write code to pull this data from the database. You can use JDBC with SQL statements or prepared statements to pull the data.
Then you can use a ><c:forEach JSTL tag to loop over the collection of suppliers and display data stored in each supplier object.
For Add New Supplier and Add New Stock you can use MVC actions to submit form data, that will probably take them to a new page which asks for details of Supplier and Stock information.
Once the form is submitted , read the form data with request.getParmeter("formFieldName") , and then store that information into the database but INSERT statements using JDBC.
Message was edited by:
appy77>