JAVA从页面上取得值

import javax.servlet.http.HttpServletRequest;
request.getParameter();与request.getSession().getAttribute();是从页面上取得所需要的值.
一般用request.getParameter()方法.(前题是有HttpServletRequest request).
//从页面得到所需要的值
String varIsNewShop = request.getParameter("varIsNewShop");
//把值赋给页面
request.setAttribute("isApproveFlag","false");

也可用
import com.ibm.bpe.core.exe.ContextInstance;
import java.util.Map;
import org.apache.log4j.Logger;
public class PrepayAction{
private Logger logger = Logger.getLogger(getClass());
public void execute(ContextInstance ctxInst, Map args)throws WorkflowException 
{
  //传递数据的Map
  Map paramMap=ctxInst.getTransientVar();
  //获得主Key
  Integer processId=(Integer)paramMap.get("processId");
  logger.info("----------------processId="+processId);
  String chargeCostCenter=(String)paramMap.get("varChargeCostCenter");
  //判断主Key是否为空
  if(processId==null||processId.intValue()<0)
  {
  throw new WorkflowException("ERROR_INTERFACE_ACTION","流程ID Error");
  }
}


import com.suning.biz.common.web.util.UIConstants;
try
{}
catch(Exception e)
{
  //获得错误,也错误信息返回页面
  request.setAttribute(UIConstants.ERROR_INFO,e.getMessage());
  throw new Exception();

你可能感兴趣的:(java,apache,log4j,servlet,IBM)