struts问题,帮忙解答,谢谢!

mzer 2003-01-06 10:34:56
这是什么错误:

org.apache.jasper.JasperException: /index.jsp(5,0) According to the TLD attribute page is mandatory for tag Test
...全文
68 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
silentlamb 2003-01-06
  • 打赏
  • 举报
回复
提示不是说根据tld文件page属性是必须的么,看看你的index.jsp?
mzer 2003-01-06
  • 打赏
  • 举报
回复
高人帮忙看一下啦
mzer 2003-01-06
  • 打赏
  • 举报
回复
应该没有吧,望您看看代码:

package mazer;


import java.io.IOException;
import javax.servlet.http.HttpSession;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.PageContext;
import javax.servlet.jsp.tagext.TagSupport;
import org.apache.struts.action.Action;
import org.apache.struts.util.BeanUtils;
import org.apache.struts.util.MessageResources;


/**
* Check for a valid User logged on in the current session. If there is no
* such user, forward control to the logon page.
*
* @author Craig R. McClanahan
* @author Marius Barduta
* @version $Revision: 1.2 $ $Date: 2001/04/14 12:53:07 $
*/

public final class TestTag extends TagSupport {


// --------------------------------------------------- Instance Variables


/**
* The key of the session-scope bean we look for.
*/
private String name = "test";


/**
* The page to which we should forward for the user to log on.
*/
private String page = "/ok.jsp";


// ----------------------------------------------------------- Properties


/**
* Return the bean name.
*/
public String getName() {

return (this.name);

}


/**
* Set the bean name.
*
* @param name The new bean name
*/
public void setName(String name) {

this.name = name;

}


/**
* Return the forward page.
*/
public String getPage() {

return (this.page);

}


/**
* Set the forward page.
*
* @param page The new forward page
*/
public void setPage(String page) {

this.page = page;

}


// ------------------------------------------------------- Public Methods


/**
* Defer our checking until the end of this tag is encountered.
*
* @exception JspException if a JSP exception has occurred
*/
public int doStartTag() throws JspException
{
try
{
JspWriter writer = pageContext.getOut();
writer.print("<hr>success mazer!</hr>");
}
catch (IOException e)
{
System.out.println("doEndTag error!");
}
return(SKIP_BODY);
}


/**
* Perform our logged-in user check by looking for the existence of
* a session scope bean under the specified name. If this bean is not
* present, control is forwarded to the specified logon page.
*
* @exception JspException if a JSP exception has occurred
*/
public int doEndTag() throws JspException {

// Print the ending element to our output writer


return (EVAL_PAGE);

}


/**
* Release any acquired resources.
*/
public void release() {

super.release();
this.name = "test";
this.page = "/ok.jsp";

}


}
baitianhai 2003-01-06
  • 打赏
  • 举报
回复
你是不是有 tag写错了那
mzer 2003-01-06
  • 打赏
  • 举报
回复
高人帮忙呀
mzer 2003-01-06
  • 打赏
  • 举报
回复
<%@ page language="java" %>
<%@ taglib uri="/WEB-INF/app.tld" prefix="app" %>
<%@ 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="index.title"/></title>
<html:base/>
</head>
<body bgcolor="white">
start...
<app:Test scope="application"/>

<logic:notPresent name="org.apache.struts.action.MESSAGE" scope="application">
<font color="red">
ERROR: Application resources not loaded -- check servlet container
logs for error messages.
</font>
</logic:notPresent>

end
</body>
</html:html>

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧