Results 1 to 6 of 6
  1. #1
    sireesha is offline Member
    Join Date
    Nov 2007
    Posts
    50
    Rep Power
    0

    Question Problem with my first Struts program....please help me

    Hi Everyone,
    I just started learning Struts programing.But got an error in my first program.From 2 days I am working on that...and i tried different solutions from different sites...but i couldn't find solution.I got this code from a book.I am using NetBeans6.0.
    I wrote the following files
    Registration.jsp,
    RegistrationAction.java,
    RegistrationForm.java,
    Success.html,
    Failure.html,
    web.xml,
    struts-config.xml,

    I am getting error in my Registration.jsp file.
    that error is..
    File"/WEB_INF/struts-form.tld"not found

    Here is my .jsp file
    Java Code:
    <%@ page language="java" %>
    <%@ taglib uri="/WEB-INF/struts-form.tld" prefix="form" %>
    <form:form action="Registration.do">
    UserName:<form:text property="username"/><br>
    enter password:<form:password property="password1"/><br>
    re-enter password:<form:password property="password2"/><br>
    <form:submit value="Register"/>
    </form:form>
    My web.xml file is

    Java Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
        <servlet>
            <servlet-name>action</servlet-name>
            <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
     <init-param>
         <param-name>application</param-name>
         <param-value>com.action.ApplicationResources</param-value>
    </init-param>
            <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>2</param-value>
            </init-param>
            <init-param>
                <param-name>detail</param-name>
                <param-value>2</param-value>
            </init-param>
            <load-on-startup>2</load-on-startup>
            </servlet>
        <servlet-mapping>
            <servlet-name>action</servlet-name>
            <url-pattern>*.do</url-pattern>
        </servlet-mapping>
        <session-config>
            <session-timeout>
                30
            </session-timeout>
        </session-config>
        <welcome-file-list>
            <welcome-file>index.jsp</welcome-file>
            </welcome-file-list>
    <!--Struts tag lib discriptions-->
    <taglib>
    <taglib-uri>/WEB-INF/struts-form.tld</taglib-uri>
    <taglib-location>/WEB-INF/struts-form.tld</taglib-location>
    </taglib>
     
        </web-app>
    Here is my struts-config.xml file

    Java Code:
    <?xml version="1.0" encoding="UTF-8" ?>
     
    <!DOCTYPE struts-config PUBLIC
              "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN"
              "http://jakarta.apache.org/struts/dtds/struts-config_1_2.dtd">
     
     
    <struts-config>
        <form-beans>
            <form-bean name="RegistrationForm" type="application.RegistrationForm"/>
        </form-beans>
        
        <action-mappings>
            <action path="/Registration" name="RegistrationForm" type="application.RegistrationAction">
            <forward name="success" path="/Success.html" />
            <forward name="failure" path="/Failure.html" />
            </action>
        </action-mappings>
        
    </struts-config>
    My preparation was stopped because of problem.Please help me.
    Thanks in advance.
    sireesha.

  2. #2
    bhaskary is offline Member
    Join Date
    Apr 2008
    Location
    hyderabad
    Posts
    11
    Rep Power
    0

    Default

    just comment out the struts tag lib in web.xml..
    not specifies tag libs in web.xml because if u are creating new project and add struts capabilities all tld files and all supporting configuration files no need to specifies

  3. #3
    sireesha is offline Member
    Join Date
    Nov 2007
    Posts
    50
    Rep Power
    0

    Default

    Thanks,
    I tried it but it didn't work for me.I am getting error again.

  4. #4
    raj999 is offline Member
    Join Date
    Apr 2008
    Posts
    1
    Rep Power
    0

    Default

    go for <html:form> instead of <form:form

  5. #5
    Join Date
    Apr 2008
    Posts
    3
    Rep Power
    0

    Default

    Quote Originally Posted by sireesha View Post
    Hi Everyone,
    I just started learning Struts programing.But got an error in my first program.From 2 days I am working on that...and i tried different solutions from different sites...but i couldn't find solution.I got this code from a book.I am using NetBeans6.0.
    I wrote the following files
    Registration.jsp,
    RegistrationAction.java,
    RegistrationForm.java,
    Success.html,
    Failure.html,
    web.xml,
    struts-config.xml,

    I am getting error in my Registration.jsp file.
    that error is..
    File"/WEB_INF/struts-form.tld"not found

    Here is my .jsp file
    Java Code:
    <%@ page language="java" %>
    <%@ taglib uri="/WEB-INF/struts-form.tld" prefix="form" %>
    <form:form action="Registration.do">
    UserName:<form:text property="username"/><br>
    enter password:<form:password property="password1"/><br>
    re-enter password:<form:password property="password2"/><br>
    <form:submit value="Register"/>
    </form:form>
    My web.xml file is

    Java Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
        <servlet>
            <servlet-name>action</servlet-name>
            <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
     <init-param>
         <param-name>application</param-name>
         <param-value>com.action.ApplicationResources</param-value>
    </init-param>
            <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>2</param-value>
            </init-param>
            <init-param>
                <param-name>detail</param-name>
                <param-value>2</param-value>
            </init-param>
            <load-on-startup>2</load-on-startup>
            </servlet>
        <servlet-mapping>
            <servlet-name>action</servlet-name>
            <url-pattern>*.do</url-pattern>
        </servlet-mapping>
        <session-config>
            <session-timeout>
                30
            </session-timeout>
        </session-config>
        <welcome-file-list>
            <welcome-file>index.jsp</welcome-file>
            </welcome-file-list>
    <!--Struts tag lib discriptions-->
    <taglib>
    <taglib-uri>/WEB-INF/struts-form.tld</taglib-uri>
    <taglib-location>/WEB-INF/struts-form.tld</taglib-location>
    </taglib>
     
        </web-app>
    Here is my struts-config.xml file

    Java Code:
    <?xml version="1.0" encoding="UTF-8" ?>
     
    <!DOCTYPE struts-config PUBLIC
              "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN"
              "http://jakarta.apache.org/struts/dtds/struts-config_1_2.dtd">
     
     
    <struts-config>
        <form-beans>
            <form-bean name="RegistrationForm" type="application.RegistrationForm"/>
        </form-beans>
        
        <action-mappings>
            <action path="/Registration" name="RegistrationForm" type="application.RegistrationAction">
            <forward name="success" path="/Success.html" />
            <forward name="failure" path="/Failure.html" />
            </action>
        </action-mappings>
        
    </struts-config>
    My preparation was stopped because of problem.Please help me.
    Thanks in advance.
    sireesha.
    hi, i hadbeen suffued too many problems like what u expline, thing is that netbeans id doen't implementing properly exceptionhandling meachnisam
    solution is as possiblee as just change ur id ,just try it agin

  6. #6
    varun.x.anand is offline Member
    Join Date
    Oct 2011
    Posts
    1
    Rep Power
    0

    Post Re: Problem with my first Struts program....please help me

    Please make the following change to your jsp file (rest of code remains same)
    change the old tag directive as follows:

    <%@ taglib uri="/tags/struts-html" prefix="form" %>


    Tell me if it works.

Similar Threads

  1. Problem with Struts Menu
    By sdp in forum Advanced Java
    Replies: 4
    Last Post: 10-02-2009, 03:13 AM
  2. in struts reset was problem
    By sureshBabu in forum Web Frameworks
    Replies: 1
    Last Post: 05-07-2008, 04:26 PM
  3. Problem with my program HelloWorld
    By trill in forum New To Java
    Replies: 1
    Last Post: 08-05-2007, 06:32 PM
  4. getting problem in compiling java program?
    By sathish04021984 in forum New To Java
    Replies: 3
    Last Post: 07-30-2007, 10:26 AM
  5. Struts problem
    By ziniestro in forum Web Frameworks
    Replies: 2
    Last Post: 05-10-2007, 06:41 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •