⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 getitemdetailaction.java

📁 一个netstore的完整代码,他使用了j2ee和webservice技术,并使用ojb o/r管理框架,很不错的
💻 JAVA
字号:
package netstore.catalog;

import javax.servlet.http.*;
import org.apache.struts.action.*;
import netstore.framework.exceptions.BaseException;
import netstore.framework.NetstoreBaseAction;
import netstore.catalog.view.ItemDetailView;
import netstore.framework.util.IConstants;
import netstore.service.INetstoreService;

/**
 * An action that gets an ItemView based on an id parameter in the request and
 * then inserts the item into an ActionForm and forwards to whatever
 * path is defined as Success for this action mapping.
 */
public class GetItemDetailAction extends NetstoreBaseAction {
  public ActionForward execute( ActionMapping mapping,
                                ActionForm form,
                                HttpServletRequest request,
                                HttpServletResponse response )
   throws Exception {
    // Get the primary key of the item from the request
    String itemId = request.getParameter( IConstants.ID_KEY );

    // Call the netstore service and ask it for an ItemView for the item
    INetstoreService serviceImpl = getNetstoreService();

    ItemDetailView itemDetailView = serviceImpl.getItemDetailView( itemId );

    // Set the returned ItemView into the Dynamic Action Form
    // The parameter name 'view' is what is defined in the struts-config
    ((DynaActionForm)form).set("view", itemDetailView);

    //String userName = ((DynaActionForm)form).get( "username" );
    //((DynaActionForm)form).set( "password", password );


    // Return the ActionForward that is defined for the success condition
    return mapping.findForward( IConstants.SUCCESS_KEY );
  }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -