代码
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%
response.setHeader("Pragma", "No-cache");
response.setDateHeader("Expires", 0);
response.setHeader("Cache-Control", "no-cache");
%>
<html>
<head>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<LINK href="<%=request.getContextPath()%>/css/index.css" type=text/css rel=STYLESHEET>
<title><s:text name="App.Title" /></title>
<script>
window.onload=function()
{
document.logonform.userName.focus();
}

function check(){
var frm = document.logonform;
if(frm.userName.value==""){
alert("用户名不能为空!");
document.logonform.userName.focus();
return false;
}else if(frm.password.value==""){
    alert("登录密码不能为空!");
    frm.password.focus();
    return false;
}else {
return true;
}
}
</script>
</head>
<body>
<center>
<DIV>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD bgColor=#ffffff colSpan=4 height=85></TD>
</TR>
</TBODY>
</TABLE>
</DIV>
<DIV id=content>
<DIV class=module_darkgray>
<DIV class=topleft_darkgray></DIV>
<DIV class=topright_darkgray></DIV>
<DIV class=bottomleft_darkgray></DIV>
<DIV class=bottomright_darkgray></DIV>
<DIV class=module_border>
<DIV class=module_inset_darkgray>
<DIV class=topleft_inset_darkgray></DIV>
<DIV class=topright_inset_darkgray></DIV>
<DIV class=bottomleft_inset_darkgray></DIV>
<DIV class=bottomright_inset_darkgray></DIV>
<DIV class=contentBkGround>
<DIV
style="PADDING-LEFT: 35px; PADDING-BOTTOM: 20px; PADDING-TOP: 40px; align: left; FONT-SIZE: 30px; COLOR: #000; FONT-FAMILY: Lucida Grande, Arial, sans-serif">
<s:text name="App.Title" /></DIV>
<DIV style="PADDING-RIGHT: 15px; PADDING-LEFT: 35px">
<TABLE cellSpacing=0 cellPadding=0 width=689 border=0>
<TBODY>
<TR> <TD style="PADDING-LEFT: 20px; vAlign: top; width: 318;"><!-- Message 2 -->
<TABLE cellSpacing=0 cellPadding=0 border=0>
<TBODY>
<TR>
<TD class="content_gray_bold" vAlign="top">

<s:text name="App.ServiceDesc"></s:text> <br>
</TD>
</TR>
</TBODY>
</TABLE>
</TD>

<TD vAlign=top>
<TABLE cellSpacing=0 cellPadding=0 border=0>
<TBODY>
<TR>
<TD style="BACKGROUND-COLOR: #e3e3e3" width="2" height="250"></TD>
</TR>
</TBODY>
</TABLE>
</TD>

<TD style="PADDING-RIGHT: 20px">
<TABLE cellSpacing=5 cellPadding=0 border=0>
<TBODY>
<TR>
<TD height="25">
</TD>
</TR>
<TR>
<TD class="content_black_bold" valign="top"><strong><s:text
name="Login.PageDesc"></s:text></strong></TD>
</TR>
<TR>
<TD class="content_gray_bold"><s:text name="Login.ActionHint"></s:text>
</TD>
</TR>
</TBODY>
</TABLE>
<!-- Begin Form -->
<s:form method="post" action="/sys/logon.action" name="logonform" onsubmit="return check()" theme="simple">
<TABLE cellSpacing=5 cellPadding=0 width=318 border=0>
<TBODY> <TR>
<TD align=left>
<SPAN class=content_black_bold>用户名</SPAN>
<BR>
<FONT class=form><INPUT class=form value="<s:property value='userName' />"
style="WIDTH: 250px"
maxLength=28 name=userName> </FONT>
</TD>
</TR> <TR>
<TD align=left>
<SPAN class=content_black_bold>密码</SPAN>
<BR>
<FONT class=form><INPUT class=form value="<s:property value='password'/>"
style="WIDTH: 250px" type="password" maxLength=32
name="password"> </FONT>
</TD>
</TR>
<TR>
<TD height=10>
<IMG height=10 alt=""
src="images/spacer.gif"
width=1 border=0>
<font class="content_red_bold"><s:property value="tip" /></font>
</TD>
</TR>
<TR>
<TD noWrap align=center>
<span style="padding-right: 20px;"><input type="submit" value="提  交"/></span>
</TD>
</TR>
</TBODY>
</TABLE>
</s:form>

</TR>
</TBODY>
</TABLE>
</DIV>
</DIV>
</DIV>
</DIV>
</DIV>
</DIV><DIV>
<TABLE cellSpacing="0" cellPadding="0" width="776" border="0"
align="center">
<TBODY>
<TR>
<TD vAlign="top" align="center" width="776"><s:text
name="App.Title"></s:text> <BR>
</TD>
</TR>
<TR>
<TD align="center" valign="bottom"><FONT class="disclaimer">
<s:text name="CopyRight"></s:text> </FONT></TD>
</TR>
</TBODY>
</TABLE>
</DIV>
</center>
</body>
</html>错误信息:
org.apache.jasper.JasperException: Exception in JSP: /WebContent/jsp/index.jsp:1411: <%@ taglib prefix="s" uri="/struts-tags"%>
12: <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
13: <LINK href="<%=request.getContextPath()%>/css/index.css" type=text/css rel=STYLESHEET>
14: <title><s:text name="App.Title" /></title>
15:  <script>
16:  window.onload=function()
17:  {
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:451)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)

解决方案 »

  1.   

    估计是工程的包没有加完全吧,例如struts2的标签库都加了吗,路径对吗?
      

  2.   

    <s:text name=""> 的name对应的是国际化资源包中的key,你设置了吗
      

  3.   

    换用 普通标签看看 若下面的struts标签依次出现问题 就是struts 加载的问题 检查 web.xml文件吧
      

  4.   

    web.xml 内容<?xml version="1.0" encoding="UTF-8"?>
    <web-app id="WebApp_ID" 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">
    <display-name>GridPrint</display-name>

    <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>/WEB-INF/spring/applicationContext.xml</param-value>
    </context-param>

    <filter>
    <filter-name>struts2</filter-name>
    <filter-class>
    org.apache.struts2.dispatcher.FilterDispatcher
    </filter-class>
    <init-param>
    <param-name>
    config
    </param-name>
    <param-value>
    struts-default.xml,struts-plugin.xml,../struts/struts.xml
    </param-value>
    </init-param>
    </filter> <filter-mapping>
    <filter-name>struts2</filter-name>
    <url-pattern>/*</url-pattern>
    </filter-mapping>
    <servlet>
    <description>
    </description>
    <display-name>
    GenerateReport</display-name>
    <servlet-name>GenerateReport</servlet-name>
    <servlet-class>
    com.gridprint.util.ui.GenerateReport</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>GenerateReport</servlet-name>
    <url-pattern>/getReport</url-pattern>
    </servlet-mapping>
    <welcome-file-list>
    <welcome-file>/jsp/index.jsp</welcome-file>
    </welcome-file-list> <listener>
    <listener-class>
    org.springframework.web.context.ContextLoaderListener
    </listener-class>
    </listener>
    </web-app>
      

  5.   

    <filter>
            <filter-name>struts2</filter-name>
            <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
        </filter>试试这个filter 。