Back Forum Reply New

Form Submit Problems in Weblogic

I have tested my small learning test app in Tomcat and it works fine.  Deploying it to Weblogic 8.1, it doesn't work correctly.  I have a simple login page.  

The form displays fine, but when I submit the form the ucl in weblogic changes to point directly to the JSP file and I get the Neither Errors instance nor plain target object for bean name... error message.

The initial ucl is:

springmvc/app/login

After clicking on submit, it changes to:

springmvc/login.jsp

In tomcat, this does not happen and the form submits just fine. I've included my files below for reference.  Thanks.Code:
lt;beansgt;
   lt;bean id=quot;viewResolverquot; class=quot;org..web.servlet.view.InternalResourceViewResolverquot;gt;       lt;property name=quot;prefixquot; value=quot;/quot; /gt;       lt;property name=quot;suffixquot; value=quot;.jspquot; /gt;   lt;/beangt;

   lt;bean id=quot;userValidatorquot; class=quot;com.springmvc.web.validator.UserValidatorquot; /gt;
   lt;bean name=quot;/homequot;       class=quot;com.springmvc.web.controller.HomeControllerquot;gt;   lt;/beangt;
   lt;bean name=quot;/loginquot; class=quot;com.springmvc.web.controller.LoginFormControllerquot;gt;       lt;property name=quot;commandNamequot; value=quot;userquot; /gt;       lt;property name=quot;commandClassquot; value=quot;com.springmvc.model.Userquot;/gt;       lt;property name=quot;formViewquot; value=quot;loginquot;/gt;       lt;property name=quot;successViewquot; value=quot;homequot;/gt;       lt;property name=quot;validatorquot; ref=quot;userValidatorquot; /gt;       lt;property name=quot;validateOnBindingquot; value=quot;truequot; /gt;       lt;property name=quot;countryServicequot; ref=quot;countryServicequot; /gt;   lt;/beangt;
lt;/beansgt;

Code:
lt;%@ page contentType=quot;text/html;charset=UTF-8quot; language=quot;javaquot; %gt;
lt;%@ taglib prefix=quot;formquot; uri=quot;/WEB-INF/spring-form.tldquot; %gt;
lt;%@ taglib prefix=quot;springquot; uri=quot;/WEB-INF/spring.tldquot; %gt;

lt;%@ taglib prefix=quot;cquot; uri=quot;/WEB-INF/c.tldquot; %gt;
lt;htmlgt; lt;headgt;lt;titlegt;Loginlt;/titlegt;lt;/headgt; lt;bodygt; lt;spring:hasBindErrors name=quot;userquot;gt;     lt;ulgt;lt;c:forEach var=quot;errMsgObjquot; items=quot;${errors.allErrors}quot;gt;   lt;ligt;      lt;spring:message code=quot;${errMsgObj.code}quot; text=quot;${errMsgObj.defaultMessage}quot;/gt;   lt;/ligt;lt;/c:forEachgt;        lt;/ulgt; lt;/spring:hasBindErrorsgt;

lt;form:form commandName=quot;userquot;gt;
     lt;tablegt;         lt;trgt;  lt;tdgt;Countrylt;/tdgt;  lt;tdgt;      lt;form:select path=quot;countryquot;gt;      lt;formptions items=quot;${countryList}quot; itemLabel=quot;countryquot; itemValue=quot;countryCodequot; /gt;  lt;/form:selectgt;  lt;/tdgt;         lt;/trgt;         lt;trgt;  lt;tdgt;Username:lt;/tdgt;  lt;tdgt; lt;form:input path=quot;usernamequot; /gt;lt;/tdgt;         lt;/trgt;         lt;trgt;  lt;tdgtasswordlt;/tdgt;  lt;tdgt;lt;form:password path=quot;passwordquot; /gt;lt;/tdgt;         lt;/trgt;         lt;trgt;  lt;td colspan=quot;2quot;gt;      lt;input type=quot;submitquot; value=quot;Loginquot;/gt;  lt;/tdgt;         lt;/trgt;     lt;/tablegt;
lt;/form:formgt; lt;/bodygt;
lt;/htmlgt;

Code:
package com.springmvc.web.controller;

import com.springmvc.model.User;
import com.springmvc.service.CountryService;
import org..web.servlet.ModelAndView;
import org..web.servlet.mvc.SimpleFormController;
import org..validation.BindException;

import javax.servlet.from.fromServletRequest;
import java.util.Map;
import java.util.HashMap;

public class LoginFormController extends SimpleFormController
{
   private CountryService countryService;
   public void setCountryService(CountryService countryService)   {       this.countryService = countryService;   }
   protected Map referenceData(fromServletRequest fromServletRequest) throws Exception   {       Map data = new HashMap();       data.put(quot;countryListquot;, countryService.getCountries());       return data;   }
   protected ModelAndView onSubmit(Object command, BindException errors) throws Exception   {       User user = (User)command;       ModelAndView mav = new ModelAndView(getSuccessView(), errors.getModel());       mav.addObject(quot;greetingquot;, quot;Thanks for logging in quot; + user.getUsername());       return mav;   }
}

Code:
lt;?xml version=quot;1.0quot; encoding=quot;UTF-8quot;?gt;
lt;!DOCTYPE web-app PUBLIC quot;-//Sun Microsystems, Inc.//DTD Web Application 2.3//ENquot; quot;dtd/web-app_2_3.dtdquot;gt;
lt;web-appgt;

   lt;listenergt;       lt;listener-classgt;org..web.context.ContextLoaderListener       lt;/listener-classgt;   lt;/listenergt;
   lt;servletgt;       lt;servlet-namegt;springlt;/servlet-namegt;       lt;servlet-classgt;org..web.servlet.DispatcherServletlt;/servlet-classgt;       lt;load-on-startupgt;1lt;/load-on-startupgt;   lt;/servletgt;
   lt;servlet-mappinggt;       lt;servlet-namegt;springlt;/servlet-namegt;       lt;ucl-patterngt;/app/*lt;/ucl-patterngt;   lt;/servlet-mappinggt;
   lt;welcome-file-listgt;       lt;welcome-filegt;index.htmllt;/welcome-filegt;       lt;welcome-filegt;index.jsplt;/welcome-filegt;   lt;/welcome-file-listgt;
   lt;taglibgt;       lt;taglib-urigt;/WEB-INF/spring-form.tldlt;/taglib-urigt;       lt;taglib-locationgt;/WEB-INF/spring-form.tldlt;/taglib-locationgt;   lt;/taglibgt;
   lt;taglibgt;       lt;taglib-urigt;/WEB-INF/spring.tldlt;/taglib-urigt;       lt;taglib-locationgt;/WEB-INF/spring.tldlt;/taglib-locationgt;   lt;/taglibgt;
    lt;taglibgt;       lt;taglib-urigt;/WEB-INF/c.tldlt;/taglib-urigt;       lt;taglib-locationgt;/WEB-INF/c.tldlt;/taglib-locationgt;   lt;/taglibgt;

lt;/web-appgt;Ok, I've found out what the problem is, but I am not sure if I am doing something wrong or if it might be a bug.  I am using the latest RC for Spring 2.0.

When I view source on my form, I get this:

lt;form id=quot;userquot; method=quot;postquot; action=quot;/springmvc/login.jspquot;gt;

which would be causing the incorrect behavior.  If I manually override this by specifying the action attribute in my jsp, it works great.  But again, in tomcat, it renderes just fine without specifying the action myself.

Thanks.
¥
Back Forum Reply New