Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Java > Java Open Source > BOOK: Professional Jakarta Struts
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Professional Jakarta Struts
This is the forum to discuss the Wrox book Professional Jakarta Struts by James Goodwill, Richard Hightower; ISBN: 9780764544378
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional Jakarta Struts section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Display Modes
  #1 (permalink)  
Old January 14th, 2005, 09:44 AM
Registered User
 
Join Date: Jan 2005
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Help me very urgent

My problem is i am getting this erro when i am trying to run my first struts programe can any body help error is:

please help me this is very urgent

org.apache.jasper.JasperException: /strutsEx/index.jsp(4,0) Attribute name invalid according to the specified TLD
    at org.apache.jasper.compiler.DefaultErrorHandler.jsp Error(DefaultErrorHandler.java:94)
    at org.apache.jasper.compiler.ErrorDispatcher.dispatc h(ErrorDispatcher.java:417)
    at org.apache.jasper.compiler.ErrorDispatcher.jspErro r(ErrorDispatcher.java:186)
    at org.apache.jasper.compiler.Validator$ValidateVisit or.visit(Validator.java:498)
    at org.apache.jasper.compiler.Node$CustomTag.accept(N ode.java:707)
    at org.apache.jasper.compiler.Node$Nodes.visit(Node.j ava:1028)
    at org.apache.jasper.compiler.Node$Visitor.visitBody( Node.java:1070)
    at org.apache.jasper.compiler.Node$Visitor.visit(Node .java:1076)
    at org.apache.jasper.compiler.Node$Root.accept(Node.j ava:232)
    at org.apache.jasper.compiler.Node$Nodes.visit(Node.j ava:1028)
    at org.apache.jasper.compiler.Validator.validate(Vali dator.java:607)
    at org.apache.jasper.compiler.Compiler.generateJava(C ompiler.java:222)
    at org.apache.jasper.compiler.Compiler.compile(Compil er.java:323)
    at org.apache.jasper.JspCompilationContext.compile(Js pCompilationContext.java:474)
    at org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:184)
    at org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:289)
    at org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:240)
    at javax.servlet.http.HttpServlet.service(HttpServlet .java:853)
    at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:247)
    at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.StandardWrapperValve.invo ke(StandardWrapperValve.java:260)
    at org.apache.catalina.core.StandardPipeline$Standard PipelineValveContext.invokeNext(StandardPipeline.j ava:643)
    at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(Cont ainerBase.java:995)
    at org.apache.catalina.core.StandardContextValve.invo ke(StandardContextValve.java:191)
    at org.apache.catalina.core.StandardPipeline$Standard PipelineValveContext.invokeNext(StandardPipeline.j ava:643)
    at org.apache.catalina.authenticator.AuthenticatorBas e.invoke(AuthenticatorBase.java:471)
    at org.apache.catalina.core.StandardPipeline$Standard PipelineValveContext.invokeNext(StandardPipeline.j ava:641)
    at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(Cont ainerBase.java:995)
    at org.apache.catalina.core.StandardContext.invoke(St andardContext.java:2396)
    at org.apache.catalina.core.StandardHostValve.invoke( StandardHostValve.java:180)
    at org.apache.catalina.core.StandardPipeline$Standard PipelineValveContext.invokeNext(StandardPipeline.j ava:643)
    at org.apache.catalina.valves.ErrorDispatcherValve.in voke(ErrorDispatcherValve.java:170)
    at org.apache.catalina.core.StandardPipeline$Standard PipelineValveContext.invokeNext(StandardPipeline.j ava:641)
    at org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:172)
    at org.apache.catalina.core.StandardPipeline$Standard PipelineValveContext.invokeNext(StandardPipeline.j ava:641)
    at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(Cont ainerBase.java:995)
    at org.apache.catalina.core.StandardEngineValve.invok e(StandardEngineValve.java:174)
    at org.apache.catalina.core.StandardPipeline$Standard PipelineValveContext.invokeNext(StandardPipeline.j ava:643)
    at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(Cont ainerBase.java:995)
    at org.apache.coyote.tomcat4.CoyoteAdapter.service(Co yoteAdapter.java:223)
    at org.apache.coyote.http11.Http11Processor.process(H ttp11Processor.java:405)
    at org.apache.coyote.http11.Http11Protocol$Http11Conn ectionHandler.processConnection(Http11Protocol.jav a:380)
    at org.apache.tomcat.util.net.TcpWorkerThread.runIt(P oolTcpEndpoint.java:508)
    at org.apache.tomcat.util.threads.ThreadPool$ControlR unnable.run(ThreadPool.java:533)
    at java.lang.Thread.run(Thread.java:536)


I have coppied all the jar file and perfectly written web.xml file and struts-html files there are as follows


web.xml file

<!--Standard Action Servlet Configuration †††
    -->
    <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>
            <load-on-startup>1</load-on-startup>

    </servlet>

<!--Standard Action Servlet Configuration †††
    -->
    <servlet-mapping>
        <servlet-name>
        †††action
        </servlet-name>
        <url-pattern>
            *.do
        </url-pattern>
    </servlet-mapping>

<taglib-uri>
            myTagUri
        </taglib-uri>
        <taglib-location>
        †††/WEB-INF/sureshtaglibs/taglibEx.tld
        </taglib-location>
    </taglib>


and the struts-config.xml is
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"
        ††"http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
<struts-config>

    <form-beans>
        <form-bean name="lookupForm" type="ch03.lookupForm" />
    </form-beans>
†††
    <action-mappings>
        <action path="/loookup" type="ch03.lookupAction"††name="lookupForm">
            ††<forward name="success" path="/result.jsp"/>
            ††<forward name="success" path="/index.jsp"/>
        </action>
    </action-mappings>
</struts-config>



my file are Index.jsp

<%@ page language = "java"%>
<%@ taglib uri="myTagStruts-Html" prefix="html" %>
<html>
<body>
<html:form action = "lookup" name = "lookupForm" type = "ch03.lookupForm">
    <table>
        <tbody>
            <tr>
                <td>Name:</td>
                <td><html:text property = "symbol" /></td>

            </tr>
            <tr>
                <td colspan = "2" align = "center"><html:submit /></td>
            </tr>
        </tbody>
    </table>
</html:form>
</body>
</html>


lookupForm.java

package ch03;
import javax.servlet.http.*;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;

public class lookupForm extends ActionForm {
    private String symbol;

    public void setSymbol (String symbol) {
        this.symbol = symbol;
    }

    public String getSymbol () {
        return symbol;
    }

    public void reset (ActionMapping map,HttpServletRequest req) {
        this.symbol = null;
    }
}

lookupAction.java

package ch03;
import java.io.*;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
public class lookupAction extends Action {

    protected String getQuote (String symbol) {
        if (symbol.equalsIgnoreCase ("suresh")) {
            return "Sucess";
        }
        return "notsucess";
    }

    public ActionForward execute (ActionMapping mapping,ActionForm form,
        HttpServletRequest req,HttpServletResponse res) throws ServletException,IOException {

        String result = "notsucess";
        String target = new String ("sucess");
        if (form != null) {
            lookupForm lpForm = (lookupForm)form;
            String symbol = lpForm.getSymbol ();
            result = getQuote (symbol);
        }

        if (result.equals("notsecess")) {
            target = new String ("failure");
        }
        else {
            req.setAttribute ("result",result);
        }
        return (mapping.findForward (target));
    }

}


result.html


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD>

<BODY>
    <table>
        <tbody>
            <tr>
                <td><h5> The output was</h5><%= request.getAttribute ("result")%></td>
            </tr>

        </tbody>
    </table>
</BODY>
</HTML>
  #2 (permalink)  
Old January 20th, 2005, 07:03 AM
Friend of Wrox
 
Join Date: Jul 2004
Location: , , India.
Posts: 345
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to gokul_blr Send a message via Yahoo to gokul_blr
Default

Have a check, whether you have all TLD and LIB files into the folder and set to the classPath too.

Gokulan Ethiraj
  #3 (permalink)  
Old February 7th, 2005, 04:35 AM
Registered User
 
Join Date: Feb 2005
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You have a caracter no valid. Parse the XML web.xml and struts-config.xml.



  #4 (permalink)  
Old February 18th, 2005, 12:31 AM
Registered User
 
Join Date: Feb 2005
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I had this problem before. Replace <html:form action = "lookup" name = "lookupForm" type = "ch03.lookupForm"> with <html:form action = "lookup"> in the index.jsp and you should be fine.



Balaji Balasubramaniam
SCJP, SCWCD, SCBCD
  #5 (permalink)  
Old January 18th, 2006, 10:51 AM
Registered User
 
Join Date: Jan 2006
Location: , Massachusetts, .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Similar problem here.. Looking for some help.

I have the files set up as follows:

..\webapps\ch03app\index.html
..\webapps\ch03app\quote.html
..\webapps\ch03app\WEB-INF\web.xml
..\webapps\ch03app\WEB-INF\struts-config.xml
..\webapps\ch03app\WEB-INF\classes\ch3\LookupAction.class
..\webapps\ch03app\WEB-INF\classes\ch3\LookupForm.class
..\webapps\ch03app\WEB-INF\src\LookupAction.java
..\webapps\ch03app\WEB-INF\src\LookupForm.java

I added c:...\webapps\ch03app\WEB-INF\classes to my classpath.

Both the LookupAction and the Lookup form are packaged as:

package ch3;

I compiled the code and put the class files into ..
..\WEB-INF\classes\ch3
I modified the code to remove the attributes from the form as described in the example above.

<html:form action="Lookup">

The struts-config.xml file contains the following:

<?xml version="1.0" encoding="ISO-8859-1" ?>

<!DOCTYPE struts-config PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"
    "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">

<struts-config>

    <form-beans>
        <form-bean name="lookupForm"
            type="ch3.LookupForm"/>
       </form-beans>

    <action-mappings>
        <action
            path="/Lookup"
            type="ch3.LookupAction"
            name="lookupForm"
            input="/index.jsp">
            <forward name="success" path="/quote.jsp"/>
            <forward name="failure" path="/index.jsp"/>
        </action>
    </action-mappings>

</struts-config>

This handled the attribute name being invalid, however I now have the following error:

Exception report

The server encountered an internal error () that prevented it from fulfilling this request.

javax.servlet.ServletException: Exception creating bean of class ch3.LookupForm: java.lang.ClassNotFoundException: ch3.LookupForm
    at org.apache.jasper.runtime.PageContextImpl.handlePa geException(PageContextImpl.java:495)
    at org.apache.jsp.index_jsp._jspService(index_jsp.jav a:101)
    at org.apache.jasper.runtime.HttpJspBase.service(Http JspBase.java:92)

Any suggestions?

-Deb
  #6 (permalink)  
Old December 6th, 2006, 02:52 AM
Registered User
 
Join Date: Nov 2006
Location: Mumbai, Maharastra, India.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,
i want some code using Hasmap.


 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
urgent deb_kareng ASP.NET 2.0 Professional 1 August 13th, 2007 08:29 AM
it's urgent deb_kareng ASP.NET 2.0 Professional 3 August 7th, 2007 08:40 AM
urgent help yash_coolbuddy_forindia BOOK: Wrox's ASP.NET 2.0 Visual Web Developer 2005 Express Edition Starter ISBN: 978-0-7645-8807-5 1 May 7th, 2007 09:40 AM
urgent???????????? nsr35 Beginning VB 6 1 October 3rd, 2005 11:57 AM
urgent ??????????????? nsr35 Pro VB Databases 0 October 3rd, 2005 05:53 AM



All times are GMT -4. The time now is 03:20 PM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.