本文整理汇总了Java中org.apache.struts.util.RequestUtils.createActionForm方法的典型用法代码示例。如果您正苦于以下问题:Java RequestUtils.createActionForm方法的具体用法?Java RequestUtils.createActionForm怎么用?Java RequestUtils.createActionForm使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.struts.util.RequestUtils
的用法示例。
在下文中一共展示了RequestUtils.createActionForm方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initFormBean
import org.apache.struts.util.RequestUtils; //导入方法依赖的package包/类
/**
* Locate or create the bean associated with our form.
* @throws JspException
* @since Struts 1.1
*/
protected void initFormBean() throws JspException {
int scope = PageContext.SESSION_SCOPE;
if ("request".equalsIgnoreCase(beanScope)) {
scope = PageContext.REQUEST_SCOPE;
}
Object bean = pageContext.getAttribute(beanName, scope);
if (bean == null) {
// New and improved - use the values from the action mapping
bean =
RequestUtils.createActionForm(
(HttpServletRequest) pageContext.getRequest(),
mapping,
moduleConfig,
servlet);
if (bean instanceof ActionForm) {
((ActionForm) bean).reset(mapping, (HttpServletRequest) pageContext.getRequest());
}
if (bean == null) {
throw new JspException(messages.getMessage("formTag.create", beanType));
}
pageContext.setAttribute(beanName, bean, scope);
}
pageContext.setAttribute(Constants.BEAN_KEY, bean, PageContext.REQUEST_SCOPE);
}
示例2: createNewActionForm
import org.apache.struts.util.RequestUtils; //导入方法依赖的package包/类
private ActionForm createNewActionForm(ActionMapping mapping, HttpServletRequest request) {
String name = mapping.getName();
FormBeanConfig config = moduleConfig.findFormBeanConfig(name);
if (config == null) {
log.warn("No FormBeanConfig found under '" + name + "'");
return (null);
}
ActionForm instance = RequestUtils.createActionForm(config, servlet);
if ("request".equals(mapping.getScope())) {
request.setAttribute(mapping.getAttribute(), instance);
} else {
HttpSession session = request.getSession();
session.setAttribute(mapping.getAttribute(), instance);
}
return instance;
}
示例3: initFormBean
import org.apache.struts.util.RequestUtils; //导入方法依赖的package包/类
@Override
protected void initFormBean() throws JspException {
int scope = PageContext.SESSION_SCOPE;
if ("request".equalsIgnoreCase(beanScope)) {
scope = PageContext.REQUEST_SCOPE;
}
Object bean = pageContext.getAttribute(beanName, scope);
if (bean == null) {
bean = RequestUtils.createActionForm(
(HttpServletRequest) pageContext.getRequest(), mapping,
moduleConfig, servlet);
if (bean == null) {
throw new JspException(messages.getMessage("formTag.create",
beanType));
}
pageContext.setAttribute(beanName, bean, scope);
}
pageContext.setAttribute(Constants.BEAN_KEY, bean,
PageContext.REQUEST_SCOPE);
}
示例4: processActionForm
import org.apache.struts.util.RequestUtils; //导入方法依赖的package包/类
/**
* <p>Retrieve and return the <code>ActionForm</code> associated with
* this mapping, creating and retaining one if necessary. If there is no
* <code>ActionForm</code> associated with this mapping, return
* <code>null</code>.</p>
*
* @param request The servlet request we are processing
* @param response The servlet response we are creating
* @param mapping The mapping we are using
*/
protected ActionForm processActionForm(HttpServletRequest request,
HttpServletResponse response,
ActionMapping mapping) {
// Create (if necessary) a form bean to use
ActionForm instance = RequestUtils.createActionForm
(request, mapping, moduleConfig, servlet);
if (instance == null) {
return (null);
}
// Store the new instance in the appropriate scope
if (log.isDebugEnabled()) {
log.debug(" Storing ActionForm bean instance in scope '" +
mapping.getScope() + "' under attribute key '" +
mapping.getAttribute() + "'");
}
if ("request".equals(mapping.getScope())) {
request.setAttribute(mapping.getAttribute(), instance);
} else {
HttpSession session = request.getSession();
session.setAttribute(mapping.getAttribute(), instance);
}
return (instance);
}
示例5: obtenerActionForm
import org.apache.struts.util.RequestUtils; //导入方法依赖的package包/类
protected ActionForm obtenerActionForm(ActionMapping mapping, HttpServletRequest request, String path) {
ModuleConfig config = mapping.getModuleConfig();
ActionMapping newMapping = (ActionMapping) config.findActionConfig(path);
ActionForm newForm = RequestUtils.createActionForm(request, newMapping, config, this.servlet);
if ("session".equals(newMapping.getScope())) {
request.getSession(true).setAttribute(newMapping.getAttribute(), newForm);
} else {
request.setAttribute(newMapping.getAttribute(), newForm);
}
newForm.reset(newMapping, request);
return newForm;
}
示例6: obtenerActionForm
import org.apache.struts.util.RequestUtils; //导入方法依赖的package包/类
protected ActionForm obtenerActionForm(ActionMapping mapping, HttpServletRequest request, String path)
{
ModuleConfig config = mapping.getModuleConfig();
ActionMapping newMapping = (ActionMapping) config.findActionConfig(path);
ActionForm newForm = RequestUtils.createActionForm(request, newMapping, config, this.servlet);
if ("session".equals(newMapping.getScope())) {
request.getSession(true).setAttribute(newMapping.getAttribute(), newForm);
} else {
request.setAttribute(newMapping.getAttribute(), newForm);
}
newForm.reset(newMapping, request);
return newForm;
}
示例7: obtenerActionForm
import org.apache.struts.util.RequestUtils; //导入方法依赖的package包/类
/** Retorna el ActionForm asociado al action en el path especificado */
protected ActionForm obtenerActionForm(ActionMapping mapping, HttpServletRequest request, String path) {
ModuleConfig config = mapping.getModuleConfig();
ActionMapping newMapping = (ActionMapping) config.findActionConfig(path);
ActionForm newForm = RequestUtils.createActionForm(request, newMapping, config, this.servlet);
if ("session".equals(newMapping.getScope())) {
request.getSession(true).setAttribute(newMapping.getAttribute(), newForm);
} else {
request.setAttribute(newMapping.getAttribute(), newForm);
}
newForm.reset(newMapping, request);
return newForm;
}
示例8: initFormBean
import org.apache.struts.util.RequestUtils; //导入方法依赖的package包/类
/**
* Locate or create the bean associated with our form.
*
* @throws JspException
* @since Struts 1.1
*/
protected void initFormBean()
throws JspException {
int scope = PageContext.SESSION_SCOPE;
if ("request".equalsIgnoreCase(beanScope)) {
scope = PageContext.REQUEST_SCOPE;
}
Object bean = pageContext.getAttribute(beanName, scope);
if (bean == null) {
// New and improved - use the values from the action mapping
bean =
RequestUtils.createActionForm((HttpServletRequest) pageContext
.getRequest(), mapping, moduleConfig, servlet);
if (bean instanceof ActionForm) {
((ActionForm) bean).reset(mapping,
(HttpServletRequest) pageContext.getRequest());
}
if (bean == null) {
throw new JspException(messages.getMessage("formTag.create",
beanType));
}
pageContext.setAttribute(beanName, bean, scope);
}
pageContext.setAttribute(Constants.BEAN_KEY, bean,
PageContext.REQUEST_SCOPE);
}
示例9: processActionForm
import org.apache.struts.util.RequestUtils; //导入方法依赖的package包/类
/**
* <p>Retrieve and return the <code>ActionForm</code> associated with this
* mapping, creating and retaining one if necessary. If there is no
* <code>ActionForm</code> associated with this mapping, return
* <code>null</code>.</p>
*
* @param request The servlet request we are processing
* @param response The servlet response we are creating
* @param mapping The mapping we are using
* @return The <code>ActionForm</code> associated with this mapping.
*/
protected ActionForm processActionForm(HttpServletRequest request,
HttpServletResponse response, ActionMapping mapping) {
// Create (if necessary) a form bean to use
ActionForm instance =
RequestUtils.createActionForm(request, mapping, moduleConfig,
servlet);
if (instance == null) {
return (null);
}
// Store the new instance in the appropriate scope
if (log.isDebugEnabled()) {
log.debug(" Storing ActionForm bean instance in scope '"
+ mapping.getScope() + "' under attribute key '"
+ mapping.getAttribute() + "'");
}
if ("request".equals(mapping.getScope())) {
request.setAttribute(mapping.getAttribute(), instance);
} else {
HttpSession session = request.getSession();
session.setAttribute(mapping.getAttribute(), instance);
}
return (instance);
}
示例10: execute
import org.apache.struts.util.RequestUtils; //导入方法依赖的package包/类
public ActionForward execute(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws Exception {
InstanciaDelegate delegate = RegistroManager.recuperarInstancia(request);
if (delegate == null) {
ActionErrors errors = new ActionErrors();
errors.add(null, new ActionError("errors.session"));
saveErrors(request, errors);
return mapping.findForward("fail");
}
Pantalla p = delegate.obtenerPantalla();
if (p == null) {
// En caso de ser telematico comprobamos si debemos ir a la penultima pantalla o bien devolver el control
boolean telematic = (delegate instanceof InstanciaTelematicaDelegate);
if (telematic) {
InstanciaTelematicaDelegate itd = (InstanciaTelematicaDelegate) delegate;
Map propiedadesForm = itd.obtenerPropiedadesFormulario();
boolean mostrarPantallaFin = false;
try{
mostrarPantallaFin = (propiedadesForm.get("pantallaFin.mostrar")!=null?Boolean.parseBoolean((String)propiedadesForm.get("pantallaFin.mostrar")):false);
}catch (Exception ex){
log.error("La propiedad pantallaFin.mostrar no tiene un valor v�lido (true/false): " + propiedadesForm.get("pantallaFin.mostrar"));
mostrarPantallaFin = false;
}
if (!mostrarPantallaFin){
response.sendRedirect("finalitzarTelematic.do?ID_INSTANCIA=" + (String) request.getAttribute(RegistroManager.ID_INSTANCIA));
return null;
}
}
// Vamos a penultima pantalla
return mapping.findForward("end");
} else {
ModuleConfig config = mapping.getModuleConfig();
ActionMapping nextMapping = (ActionMapping) config.findActionConfig("/procesar");
PantallaForm pantallaForm = (PantallaForm) RequestUtils.createActionForm(request, nextMapping, config, getServlet());
request.setAttribute(nextMapping.getAttribute(), pantallaForm);
pantallaForm.reset(nextMapping, request);
// Alimentamos con datos pantalla actual
BeanUtils.populate(pantallaForm, delegate.obtenerDatosPantalla());
return mapping.findForward("view");
}
}