The principle of adding commodity is the same as adding commodity category, but it is more complex than adding commodity category, because there are many attributes of commodity, and there are many fields in the corresponding database. There is also an option to add commodity to upload pictures. This small piece of content will be explained separately in the next blog, because it involves a knowledge.Dot recognition is Struts 2 to achieve file upload function. No more nonsense. Now we begin to improve the code for adding commodity parts.
1. Add merchandise
1.1 UI Implementation of Adding Commodities
Firstly, the code of adding commodity part to query.jsp is completed.
Next, let’s look at the implementation of save.jsp:
Then you can use a custom method to validate the image:
1.2 Background Implementation of Adding Commodities
2.1 UI Implementation of Updating Commodities
First, look at the code for updating the merchandise section in query.jsp:
Next, take a look at update.jsp: