2012年3月26日星期一

Beats Monster with FireIn OpenJWeb usingDWR technology to submit the page content example OpenJWe

In OpenJWeb usingDWR technology to submit the page content example OpenJWeb China QQ: 29803446 Email: baozhengw@163.com by DWR technique is introduced in this paper the Suggestions Submitted to the background .,Beats Monster with Fire
Specific steps :( 1) to create a DWR tools ,this tool will be responsible for incoming web opinion entity is stored in the database :package com.openjweb.portal.util ;import javax.servlet.
http.HttpServletRequest ;import org.apache.log4j.Logger ;import org.openjweb.core.service.IDBSupportService ;import org.openjweb.core.service.ServiceLocator ;import org.openjweb.core.util.CMSUtil ;import org.
openjweb.core.util.StringUtil ;import com.openjweb.portal.entity.PortalAdvise ;public class PortalAdviseUtil {private static final Logger logger = Logger. GetLogger ( PortalAdviseUtil . Class ) ;/ * * * submit site is suggested, without the consideration of the verification code .
* * @ param entity * @ param request * @ return * / public static String submitPortalAdvise ( PortalAdvise entity ,String dbService ,HttpServletRequest request ) {String sReturn = submit information success !;IDBSupportService service = ( IDBSupportService ) ServiceLocator .
GetBean ( dbService ) ;try ( service.getSerial ( ) {entity.setPkId . ToString ( ) ) ;entity.setRowId ( StringUtil . GetUUID ( ) ) ;entity.setCreateDt ( StringUtil . GetCurrentDateTime ( ) ) ;entity.
setUpdateDt ( entity.getCreateDt ( ) ) ;/ / get the site code ,Dr Dre Beats,according to the website code storage site observations .Entity.setSiteCode ( CMSUtil . GetWebsiteCode ( request ) ) ;service.
saveOrUpdate ( entity ) ;} catch ( Exception Ex ) {sReturn = information failed !;} return sReturn ;} } This code is the main use is receiving from the page incoming suggestions entity ( PortalAdvise entity ) ,called openjweb and DAO framework entity data saved to the database .
Reference number PortalAdvise is the value of entity via DWR calls incoming came in below ,we look at the DWR configuration file ,UGG UK,located in the WEB-INF / dwr.xml: < ;DOCTYPE DWR PUBLIC ,UGG Boots Clearance!- / / GetAhead Limited / / DTD Direct Web Remoting 1 / EN.
http: / / www.getahead.ltd.uk / DWR / dwr10.dtd > ;< ;dwr> ;< ;allow> ;&hellip ;< ;&mdash ;.!the existing site opinion entity class voice out here ,Men Nike Running Shoes,so that DWR through the object in the form of page data is mapped to the Java entity class parameter - > ;< ;convert converter = bean match = com.
openjweb.portal.entity.PortalAdvise / > ;&hellip ;< ;&mdash ;PortalAdviseUtil class !The following statement ,so that the page you can use the JS form Jane then calls > ;< ;create creator = new JavaScript = PortalAdviseUtil > ;< ;param name = class value = com.
openjweb.portal.util.PortalAdviseUtil / > ;< ;include method = submitPortalAdvise / > / create> ;< ;< ;< ;allow> ;dwr> ;/ ;below is the complete site observations page style :( CSDN Image upload function seems to be used, the picture is slightly below the page code ( ) is the only list click submit recommendations to the JavaScript code ) :< ;&mdash ;DWR required !-- > ;< ;script type = text / JavaScript SRC = < ;% = request.
getContextPath ( ) %> / DWR / util.js > ;;< ;script> ;< ;&mdash ;DWR required !-- > ;< ;script type = text / JavaScript SRC = < ;% = request.getContextPath ( ) %> / DWR / engine.
js ;> ;< ;< ;script / script> ;type = / JavaScript ;&mdash !;java--> < ;script DWR calls ;type = / JavaScript = ;% = request.getContextPath %> ( ) ;/ DWR / interface / PortalAdviseUtil.
js > / script> ;< ;DWR ;use direct submission page data has the advantage of avoiding the use of complex MVC frame ,directly to the page data is submitted to the business logic layer processing .
Related articles:

没有评论:

发表评论