atom feed10 messages in org.apache.struts.userRe: JSP probleme
FromSent OnAttachments
Steven D. WilkinsonJan 29, 2001 7:21 am 
Michael MokJan 29, 2001 7:57 am 
Chris SmithJan 29, 2001 8:26 am 
Frederic BAGESJan 29, 2001 8:59 am 
Steven D. WilkinsonJan 29, 2001 9:37 am 
Frederic BAGESJan 29, 2001 9:48 am 
Steven D. WilkinsonJan 29, 2001 10:14 am 
Justin KennedyJan 29, 2001 10:18 am 
Frederic BAGESJan 29, 2001 10:18 am 
Craig R. McClanahanJan 31, 2001 2:08 pm 
Subject:Re: JSP probleme
From:Steven D. Wilkinson (stev@acm.org)
Date:Jan 29, 2001 9:37:25 am
List:org.apache.struts.user

Which version of struts are you using?

Note my answer is how you do it in struts 1.0 (actually form the 01-28-2001 source download) I'm not sure how to do it in 0.5. If you are just starting and trying to use 0.5, I suggest you start with one of the nightly source distributions because 1.0 should be released shortly. Just some bug fixes and documentation updates as I hear on the mail lists.

That said....

The tag library descriptors must be in your WEB-INF and registered in your web.xml and you must reference them properly in the JSP page.

<tomcat-home>/webapps/animation/WEB-INF/struts-bean.tld struts-html.tld struts-logic.tld struts-template.tld struts.tld In your web.xml <?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">

<web-app> .. other stuff here Note, refer to DTD about location of taglib. it's at the bottom if you are not using any ejb stuff. <!-- Struts Tag Library Descriptors --> <taglib> <taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri> <taglib-location>/WEB-INF/struts-bean.tld</taglib-location> </taglib>

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

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

</web-app>

You only need to enter the ones that you are using. This is from the struts-example/WEB-INF/web.xml file.

Then in you JSP page put this... <%@ 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" %>

Note, the file in the uri determines the name and location of the tlds. The prefix is upto you.

Good luck, Steve

Frederic BAGES wrote:

Hi all, i'm new to Struts and i have i problem that seems to concern Tomcat and Struts.

I've installed Strut and the two exemples WAR files under tomcat 3.2. the exemples are just running fine but when i try to run my own jsp file i have an error from the jsp compiler.

org.apache.jasper.compiler.CompileException: C:\jakarta-tomcat-3.2.1\webapps\animation\logon.jsp(1,0) Unable to open taglibrary /WEB-INF/struts.tld : Could not locate TLD META-INF/taglib.tld at org.apache.jasper.compiler.JspParseEventListener.handleDirective(JspParseEve ntListener.java, Compiled Code) at org.apache.jasper.compiler.DelegatingListener.handleDirective(DelegatingList ener.java:116) at org.apache.jasper.compiler.Parser$Directive.accept(Parser.java, Compiled Code) at org.apache.jasper.compiler.Parser.parse(Parser.java, Compiled Code) at org.apache.jasper.compiler.Parser.parse(Parser.java:1042) at org.apache.jasper.compiler.Parser.parse(Parser.java:1038) at org.apache.jasper.compiler.Compiler.compile(Compiler.java, Compiled Code) at org.apache.jasper.servlet.JspServlet.doLoadJSP(JspServlet.java:462) .....

My JSP file and the corresponding classes (LogonForm and LogonAction) are just copies of the examples with some little changes.

Does anyone could help me ?

Thanks.

Frederic.

The JSP file is following :

<%@ page language="java" %> <%@ taglib uri="/WEB-INF/struts.tld" prefix="struts" %>

<html> <head> <title>Titletitle> </head> <body bgcolor="white">

<struts:errors/>

<struts:form action="logon.do" name="logonForm" focus="username" type="com.infusio.gamezilla.portal.LogonForm"> <table border="0" width="100%">

<tr> <th align="right"> User name : </th> <td align="left"> <struts:text property="username" size="16" maxlength="16"/> </td> </tr>

<tr> <th align="right"> Password : </th> <td align="left"> <struts:password property="password" size="16" maxlength="16"/> </td> </tr>

<tr> <td align="right"> <struts:submit property="submit" value="Submit"/> </td> <td align="left"> <struts:reset/> </td> </tr>

</table>

</struts:form>

</body> </html>