The complete struts applicaton in Chapter 16
I got the struts application of chapter 16 of Beginnig JSP 2.0 working by typing in all the code myself since there is nowhere I can download it. I am using Tomcat 5.0.9/j2sk1.4.2. Please pay attention to:
1. There seems to be an error/typo in booknewslist.jsp (p734), (in the <c:forEach> loop, the line <html:linkpage="/book/update.do?....">).
"/book/update.do" is not a valid path and is not defined in struts congiguration file either. sounds like should be "/book/edit.do...".
2. The struts-legacy.jar came with struts-1.1 is no good. Its GenericConnection does not support prepareStatement(String sql, int autoGeneratedKeys), and you will run into error with BookDAO and BookNewsDAO. You need to download the struts-legacy source, put the following lines in the GenericConnection.java (the version for jdk1.4):
public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys)
if (closed) throw new SQLException(SQLEXCEPTION_CLOSED);
return (conn.prepareStatement(sql, autoGeneratedKeys));
and then compile GenericConnection.java and GenericDataSource.java, make your own struts-legacy.jar using jar and put it into WEB-INF/lib of the publish application.
3. make sure you have booknewslist.jsp in the content folder (see page748, content folder instead of contents, booknewslist.jsp is missing there).
As a JSP newcomer, I really like this sample application, the authors did a great job. I got the application working perfectly and did not see any other problems.