如果引用或轉貼,麻煩註明出處與本網誌連結,否則視為侵權。

2005年11月29日

OpenCMS與Struts結合是很容易的

From http://www.opencms-forum.de/viewtopic.php?t=684&sid=34de0ed0c1e9f5b624b218e38d8b0d7d

內容如下:
To use struts in unison with OpenCms is very simple.

Everything is the same EXCEPT!

* Your jsps are in OpenCms
* In your struts-config.xml, when your doing a forward include the OpenCms servlet and the full path to the file within the VFS. So all
your forwards to jsp's would begin with /OpenCms/directories-in-vfs/the-file-in-vfs.jsp. Remember that OpenCms is "JUST" a servlet. So your really doing a forward to the opencms servlet with parameters (sorta). The paramaters being the path to the file in the vfs.

Setup your web.xml with both the OpenCms servlet and the struts servlet. Put in all the tag libraries that you need from both. And
that's it, you'll have all the advantages of managing your pages in OpenCms and all the mvc capabilites of struts.

The struts-OpenCms sourceforge project was attempting to put actions, actionforms, and all the configs files and jars in the VFS. IMHO I
don't think that's a good idea.

The approach I mentioned, just puts the JSPs in the VFS so it requires NO code changes to OpenCms or Struts.

沒有留言:

張貼留言

歡迎提供意見, 謝謝 (註 : 留言經過版主審核通過才會發布)