You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by rh...@rdg.boehringer-ingelheim.com on 2001/01/22 22:44:57 UTC

ifPropertyEquals problem, and ErrorMessages problem

Hi,

I am new to Struts and trying to use the framework for a new project. I am
curious if anyone else using Struts has deployed to WebLogic (specifically
5.1) since this is the server I am using... and I am observing some strange
behavior. Of course this could all just be due to my own inexperience, but I
have thoroughly examined all the examples and I think what I am doing is
correct...

First of all, there is a problem if an ErrorMessages is created and set in
an ActionBase, but the contents remain null. For example:

ErrorMessages errors = new ErrorMessages();
... never add anything to errors ...
saveErrors(request, errors);

This will fail- WebLogic will throw an exception (because Struts tries to
remove a session attribute that does not exist). So, the quick fix is just
to do:

if ( errors.getSize() > 0 )
    saveErrors(request, errors);


My second and more important issue has to do with the use of the Struts
tags: ifPropertyEquals and ifPropertyNotEquals. When I try to use these
tags, WebLogic seems to be throwing an exception during JSP page
compilation. When I take them out, the page complies and displays just fine.
The error message "userForm is not defined as a bean" seems to indicate that
this bean is not present. Here is what is in my action.xml for this mapping:

  <action    path="/userEdit"
      actionClass="com.bipi.plims.view.UserEditAction"
    formAttribute="userForm"
        formClass="com.bipi.plims.model.UserForm"
        inputForm="/userEdit.jsp">
    <forward name="success"    path="/mainMenu.jsp"/>
  </action>

And here is a piece of the JSP:

		<struts:ifPropertyEquals name="userForm"
                               property="action" value="new">
			<struts:submit property="submit" value="Create
User"/>
		</struts:ifPropertyEquals>

When I try to access this page, this is the output generated by the WebLogic
console:

Mon Jan 22 16:07:19 EST 2001:<I> <WebAppServletContext-plims> action:
Processing a POST for /userEdit
Mon Jan 22 16:07:19 EST 2001:<I> <WebAppServletContext-plims> action:
Looking for ActionForm bean under attribute 'userForm'
Mon Jan 22 16:07:19 EST 2001:<I> <WebAppServletContext-plims> action:
Populating bean properties from this request
Mon Jan 22 16:07:19 EST 2001:<I> <WebAppServletContext-plims> action:
Validating bean properties
Mon Jan 22 16:07:19 EST 2001:<I> <WebAppServletContext-plims> resolving
taglib uri '/WEB-INF/struts.tld' to taglib-location /WEB-INF/struts.tld:
Mon Jan 22 16:07:20 EST 2001:<E> <WebAppServletContext-plims> Servlet failed
with Exception
weblogic.servlet.jsp.JspException: (line 32): userForm is not defined as
bean
        at weblogic.servlet.jsp.JspLexer.jspException(JspLexer.java:610)
        at weblogic.servlet.jsp.JspLexer.mXML_GET_PROPERTY(JspLexer.java,
Compiled Code)
        at weblogic.servlet.jsp.JspLexer.mXML_THING(JspLexer.java:1584)
        at weblogic.servlet.jsp.JspLexer.mTOKEN(JspLexer.java, Compiled
Code)
        at weblogic.servlet.jsp.JspLexer.nextToken(JspLexer.java, Compiled
Code)
        at weblogic.servlet.jsp.JspLexer.parse(JspLexer.java, Compiled Code)
        at weblogic.servlet.jsp.JspParser.doit(JspParser.java, Compiled
Code)
        at weblogic.servlet.jsp.JspParser.parse(JspParser.java:116)
        at weblogic.servlet.jsp.Jsp2Java.outputs(Jsp2Java.java:97)
        at
weblogic.utils.compiler.CodeGenerator.generate(CodeGenerator.java, Compiled
Code)
        at weblogic.servlet.jsp.JspStub.compilePage(JspStub.java, Compiled
Code)
        at weblogic.servlet.jsp.JspStub.prepareServlet(JspStub.java:180)
        at
weblogic.servlet.internal.ServletStubImpl.getServlet(ServletStubImpl.java:18
1)
        at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
:118)
        at
weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImp
l.java:154)
        at
org.apache.struts.action.ActionServlet.processActionInstance(ActionServlet.j
ava:803)
        at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:702)
        at
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:332)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:772)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
        at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
:123)
        at
weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImp
l.java:154)
        at
org.apache.struts.action.ActionServlet.processActionInstance(ActionServlet.j
ava:803)
        at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:702)
        at
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:332)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:772)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
        at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
:123)
        at
weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImp
l.java:761)
        at
weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImp
l.java:708)
        at
weblogic.servlet.internal.ServletContextManager.invokeServlet(ServletContext
Manager.java:252)
        at
weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP.java:346)
        at
weblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java:246)
        at weblogic.kernel.ExecuteThread.run(ExecuteThread.java, Compiled
Code)



Just wondering if anyone has any suggestions, before I dig into the code and
search for the problem... I have not tried to run the sample project on
WebLogic yet (only on JRun which works fine) but this is my next step since
this would prove if I am doing something wrong :)

Thanks,
Bob


Robert Hayden
Lead Software Engineer
Boehringer Ingelheim Pharmaceuticals Inc.
(203) 798-5034
rhayden@rdg.boehringer-ingelheim.com