--- Begin Message ---
Hi All,

I am a newbee to struts and trying some hands on it. I was just trying to 
develop a simple login form but getting following exception on initial run only.

---------------------------------------------------------------------------------------------

SEVERE: Error creating form bean of class com.abc.struts.form.LoginForm
java.lang.NullPointerException
at 
org.apache.struts.config.FormBeanConfig.createActionForm(FormBeanConfig.java:212)
at org.apache.struts.util.RequestUtils.createActionForm(RequestUtils.java:292)
at org.apache.struts.util.RequestUtils.createActionForm(RequestUtils.java:191)
at org.apache.struts.taglib.html.FormTag.initFormBean(FormTag.java:477)
at org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:457)
at jsp_servlet.__login._jspService(__login.java:196)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:33)

---------------------------------------------------------------------------------------------

I tried searching thru all forums from last 2 days but could not found any 
solution to the issue. This seems to be a very common problem but I don't know 
why its not going away. I am really stuck up.

Below are the listing of files required to analyize the cause of error.

web.xml
------------
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 
2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd";>
<web-app>
  <servlet>
    <servlet-name>action</servlet-name>
    <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
    <init-param>
      <param-name>config</param-name>
      <param-value>/WEB-INF/struts-config.xml</param-value>
    </init-param>
    <init-param>
      <param-name>debug</param-name>
      <param-value>3</param-value>
    </init-param>
    <init-param>
      <param-name>detail</param-name>
      <param-value>3</param-value>
    </init-param>
    <load-on-startup>0</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>action</servlet-name>
    <url-pattern>*.do</url-pattern>
  </servlet-mapping>
  <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>
  <taglib>
            <taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
            <taglib-location>/WEB-INF/struts-html.tld</taglib-location>
  </taglib>
</web-app>


index.jsp
---------
......
<body>
    <html:link page="/home.do">Login</html:link>
  </body>
.....


struts-config.xml
-----------------
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts 
Configuration 1.2//EN" "http://struts.apache.org/dtds/struts-config_1_2.dtd";>

<struts-config>
  <data-sources />
  <form-beans >
    <form-bean name="loginForm" type="com.siemens.struts.form.LoginForm" />

  </form-beans>

  <global-exceptions />
  <global-forwards />
  <action-mappings >
    <action
      attribute="loginForm"
      name="loginForm"
      path="/empLogin"
      scope="request"
      type="com.siemens.struts.action.EmpLoginAction"
      validate="false" />

    <action forward="/Login.jsp" path="/home" />

  </action-mappings>

  <message-resources parameter="com.siemens.struts.ApplicationResources" />
</struts-config>


Login.jsp
---------

<body>
    <html:form action="/empLogin" method="post" focus="login">
      <table border="0">
        <tr>
          <td>Login:</td>
          <td><html:text property="login" /></td>
        </tr>
        <tr>
          <td>Password:</td>
          <td><html:password property="password" /></td>
        </tr>
        <tr>
          <td colspan="2" align="center"><html:submit>Login</html:submit></td>
        </tr>
      </table>
    </html:form>
  </body>

I can also provide the form bean and action class if required but I believe it 
won't add to solving the problem as the exception occurs when I click on the 
link on index.jsp and then it tries to render the Login.jsp.

Please help.

Nanu

________________________________
Important notice: This e-mail and any attachment there to contains corporate 
proprietary information. If you have received it by mistake, please notify us 
immediately by reply e-mail and delete this e-mail and its attachments from 
your system.
Thank You.

--- End Message ---
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to