我作为金匠的工作需要一个网站,因为我有“一些”编程经验,我想我会自己做,它只是一个显示我的工作图像和基本联系信息的网站。
我想做的基本上是这样的:
我将我的珠宝图像/渲染图放在这样的文件夹结构中
- public
- - images
- - - creations
- - - - JewelSet1
- - - - - Jewel1
- - - - - - img1
- - - - - - img2
- - - - - - img3
- - - - - Jewel2
- - - - JewelSet2
- - - - - Jewel3
- - javascripts
- - stylesheets
而public static Result index()
第一次调用该方法时,它应该在public/images/creations中搜索并将文件夹分类为我制作的三个对象,即:CreationSet、Image和Creation,它们基本上是:
package models;
import java.awt.image.BufferedImage;
import play.db.ebean.Model;
import play.data.validation.Constraints;
import javax.persistence.Entity;
import javax.persistence.Id;
@Entity
public class Image extends Model{
@Id
public String id;
@Constraints.Required
public BufferedImage img = null;
@Constraints.Required
public String desc;
}
@Entity
public class Creation extends Model {
@Id
public String id;
@Constraints.Required
public String name;
@Constraints.Required
public String desc;
public List<Image> images = new ArrayList<Image>();
public void addImage(int priority, Image img){
images.add(priority, img);
}
}
@Entity
public class CreationSet extends Model {
@Id
public String id;
@Constraints.Required
public String name;
@Constraints.Required
public String desc;
public List<Creation> creations = new ArrayList<Creation>();
public void addCreations(int priority, Creation creation){
creations.add(priority, creation);
}
}
然后通过CreationSet
s 的列表并在 html-templates 中生成正确的 HTML
这是正确的方法吗?或者我应该怎么做?