struts operational issues, you help me ah, engage in a few days

Category: Java EE
 
fzu001
2008-09-19 06:54:53

Sponsored Links
You master well, quickly help me

my struts in accordance with a textbook example of running on my machine is suggesting the following error:
type Exception report

message

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

exception

org.apache.jasper.JasperException: Unable to initialize TldLocationsCache: null
org.apache.jasper.compiler.TldLocationsCache.init (TldLocationsCache.java: 249)
org.apache.jasper.compiler.TldLocationsCache.getLocation (TldLocationsCache.java: 220)
org.apache.jasper.JspCompilationContext.getTldLocation (JspCompilationContext.java: 475)
org.apache.jasper.compiler.Parser.parseTaglibDirective (Parser.java: 417)
org.apache.jasper.compiler.Parser.parseDirective (Parser.java: 483)
org.apache . jasper.compiler.Parser.parseElements (Parser.java: 1539)
org.apache.jasper.compiler.Parser.parse (Parser.java: 126)
org.apache.jasper.compiler.ParserController . doParse (ParserController.java: 220)
org.apache.jasper.compiler.ParserController.parse (ParserController.java: 101)
org.apache.jasper.compiler.Compiler.generateJava (Compiler.java : 203)
org.apache.jasper.compiler.Compiler.compile (Compiler.java: 470)
org.apache.jasper.compiler.Compiler.compile (Compiler.java: 451)
org.apache.jasper.compiler.Compiler.compile (Compiler.java: 439)
org.apache.jasper.JspCompilationContext.compile (JspCompilationContext.java: 511)
org.apache.jasper.servlet . JspServletWrapper.service (JspServletWrapper.java: 295)
org.apache.jasper.servlet.JspServlet.serviceJspFile (JspServlet.java: 292)
org.apache.jasper.servlet.JspServlet.service (JspServlet . java: 236)
javax.servlet.http.HttpServlet.service (HttpServlet.java: 802)

note The full stack trace of the root cause ; is available in the Apache Tomcat/5.0.28 logs.

do not know why ah, experts Ariadne, be grateful!!!

Sponsored Links

wzhuangyi520
2008-09-19 07:06:12
Boss! Code stickers can do? I was Zikao, English is not good, to look at the code! Mistakenly blame!
ajing616
2008-09-19 07:13:20
not initialize TldLocationsCache, you to focus on this class, look for the reasons, why not initialized.
wazhml
2008-09-19 07:22:19
I wish you all a happy National Day! Autumn happy ah!
xdgxdg
2008-09-19 07:26:22
Thank you Ha
I put the code below Tieshanglai
1, hello.jsp file:
<% @ page contentType = "text / html; charset = UTF-8" language = "java"%>
<% @ taglib uri = "/ WEB-INF/struts-bean.tld" prefix = "bean"%>
<% @ taglib uri = "/ WEB-INF/struts- html.tld "prefix =" html "%>
<% @ taglib uri =" / WEB-INF/struts-logic.tld "prefix =" logic "%>

<html:html locale="true">
<head>
<title> <bean: message ; key = "hello.jsp.title" /> </title>
<html:base/>
</head>

< body bgcolor = "white"> <p>
<h2> <bean:message key="hello.jsp.page.heading"/> </ h2> <p>
<html:errors/> <p>

<logic:present name="personbean" scope="request">
<h2>
<bean:message key="hello.jsp.page.hello"/>
<bean write name = "personbean" property = "userName" />! <p>
</ h2>
</ logic: present>

<html: form action = " ;/ HelloWorld.do "focus =" userName ">
<bean:message key="hello.jsp.prompt.person"/>
<html: text ; property = "userName" size = "16" maxlength = "16" /> <br>
<html: submit property = "submit" value = "Submit" />
<html:reset/>
</ html: form> <br>

<html: img page = "/ struts-power.gif" alt = "Powered by Struts" />
</body>
</ html: html>
2, struts_config.xml
<? xml version = "1.0" encoding = "ISO-8859-1"?>
<! DOCTYPE struts-config PUBLIC
"- / / Apache Software Foundation / / DTD Struts Configuration 1.1 / / EN"
"

<! -
This is the Struts configuration file for the "Hello!" sample application
->

<struts-config>

<! - FormBean Definitions ->
<form-beans>
<form-bean name="HelloForm" type="hello.HelloForm"/>
</ form-beans>

<! - Action Mapping Definitions ->
<action-mappings>
<! - Say Hello! ->
<action path = "/ HelloWorld"
type = "hello.HelloAction"
name = "HelloForm"
scope = "request"
validation = "true"
input = "/ hello.jsp"
>
<forward name="SayHello" path="/hello.jsp"/>
</action>
</ action-mappings>

<! - Message Resource Definitions ->
<message-resources parameter="hello.application"/>
</ struts-config>
3, web.xml
<? xml version = "1.0" encoding = "ISO-8859-1"?>

<! DOCTYPE web-app
PUBLIC "- / / Sun Microsystems, Inc. / / DTD Web Application 2.2 / / EN"
"

<web-app>
<display-name> HelloApp Struts Application </ display-name>

<! - 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> 2 </ load-on-startup>
</servlet>

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

<! - The Usual Welcome FileList ->
<welcome-file-list>
<welcome- file> hello.jsp </ welcome-file>
</ welcome-file-list>

<! - Struts Tag Library Description ->
<taglib>
<taglib-url> / WEB-INF/struts-bean.tld </ taglib-url>
<taglib-location> / WEB-INF/struts-bean . tld </ taglib-location>
</taglib>

<taglib>
<taglib-url> / WEB-INF/struts-html.tld < / taglib-url>
<taglib-location> / WEB-INF/struts-html.tld </ taglib-location>
</taglib>

<taglib>
<taglib-url> / WEB-INF/struts-logic.tld </ taglib-url>
<taglib-location> / WEB-INF/struts-logic.tld </ taglib-location>
</taglib>

<taglib>
<taglib-url> / WEB-INF/struts-nested.tld </ taglib-url> ;
<taglib-location> / WEB-INF/struts-nested.tld </ taglib-location>
</taglib>

<taglib>
<taglib-url> / WEB-INF/struts-tiles.tld </ taglib-url>
<taglib-location> / WEB-INF/struts-tiles.tld </ taglib-location>
</taglib>

</ web-app>
zhoulj_oracle_dba
2008-09-19 07:32:05
4, application.properties
# Application Resource for ; the "Hello" sample application
hello.jsp.title = Hello A first struts program
hello.jsp.page.heading = Hello World! A first ; Struts application
hello.jsp.prompt.person = Please enter a UserName to say Hello to:
hello.jsp.page.hello = Hello

# Validation and error message for HelloForm.java and HelloAction.java
hello.dont.talk.monster = We don't want to say hello to ; Monster!!!
hello.no.username.error = Please enter a <i> UserName </i> to say hello to!
5, Constant.java
package hello;

public final class Constants
{
/ **
* The application ; scope attribute under which our user database
* is stored.
* /
public static final String PERSON_KEY = " ; personbean ";
}
6, HelloAction. java
package hello;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest ;
import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionMessage;
import org.apache.struts.action.ActionMessages;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.util.MessageResources;

public final class HelloAction extends Action
{
/ **
* Process the specified HTTP request, and create the corresponding HTTP
* response (or forward to another web component that will create it).
* control should be forward, or <code> null </code> ; if the response has
* already been completed.
* /

public ActionForward execute (ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception
{
/ / These "message" come from the ApplicationResource.properties file
MessageResources messages = getResources (request);

/ *
* Validate the request parameters specified by the user
* Note: Basic field validation done in HelloForm.java
*
* /

ActionMessages errors = new ActionMessages ();
String userName = (String) ( (HelloForm) form). getUserName ();

String badUserName = "Monster";

if (userName.equalsIgnoreCase (badUserName))
{
errors.add ("username", new ActionMessage ("hello.dont.talk.to.monster", badUserName));
/ / saveErrors (request, errors);
return (new ActionForward (mapping.getInput ()));
}

/ *
* Having received and validated the data submitted
* from the View.we now update the model
* /

PersonBean pb = new PersonBean ();
pb.setUserName (userName );
pb.saveToPersistentStore ();

/ *
* if there was a choice of View components that depended on the ; model
* (or some other) status.we 'd make the decision here as to which
* to display.In this case.there is only one View component.
*
* /

request.setAttribute (Constants.PERSON_KEY, pb);

/ / Remove the Form Bean-don't need to carry values ​​forward
request.removeAttribute (mapping.getAttribute ());

/ / Forward control to the specified success URI
return (mapping.findForward ("SayHello"));
}
}
7, HelloForm.java
package hello;

import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionMessage;
import org.apache.struts. action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;

public final class HelloForm extends ActionForm
{
private String userName = null;

public String getUserName ()
{
return (this . userName);
}

public void setUserName (String userName)
{
this.userName = userName;
}

/ **
* Reset all properties to their default values.
* /

public void reset (ActionMapping mapping , HttpServletRequest request)
{
this.userName = null;
}

/ **
* Validate the properties posted in ; this request.if validation errors are
* found, return an <code> ActionError </code> object containing the errors.
* if no validation ; errors occur, return <code> null </code> or an empty
* <code> ActionErrors </code> object.
* /

public ActionErrors validate (ActionMapping mapping, HttpServletRequest request)
{
ActionErrors errors = new ActionErrors ();

if (( userName == null) | | (userName.length () <1))
{
errors.add ("username", new ActionMessage ("hello.no.username.error" ));
}
return errors;
}
}
8, PersonBean.java
package hello;

public class PersonBean
{
private String userName = null;

public String getUserName ()
{
return this . userName;
}

public void setUserName (String userName)
{
this.userName = userName;
}

/ **
* This is a stub method that would be used for the Model to save
* the information submitted to a persistent store.in this sample
* application it is not used.
* /

public void saveToPersistentStore ()
{
/ *
* This is a stub method that might be used to save the person's
* name to a ; persistent store (iedatabase) if this were a real application.
*
* The actual business operations that would exist within a Model
* component would depend upon the requirements of the application.
* /
}
}
znj1001
2008-09-19 07:36:32
I just do not know why do you always see this message: Unable to initialize TldLocationsCache: nul
please experts continue Help me ah
Domain and server ip had changed since 8/23/2013. Suspend the user registration and posts for program maintenance.