aspose file tools*
The moose likes Servlets and the fly likes please help,Custom tags In Tomact3.2.1 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "please help,Custom tags In Tomact3.2.1" Watch "please help,Custom tags In Tomact3.2.1" New topic
Author

please help,Custom tags In Tomact3.2.1

vaibhav punekar
Ranch Hand

Joined: Jan 20, 2001
Posts: 134
Hi,
I m spending almost aweek with no output yet.I ve even stared hating myself that I m not able to do this thing.But the problem is with server conf.Please help me out as early as possible.
I ve developed my tag that has no body.
My application is upload1.So directory structure is
1)webapps/upload1/jsp----->for html and Jsp files
2)upload1/web-inf/jsp---->.tld file
3)web-inf/classes/upload1----->class files.
What's wrong with this?I ll post all my files.Please get me out of this riddle.I m tired now trying it.
------------------Jsp file----------------------------------
<%@page language="java" import="java.io.*,java.util.*,javax.servlet.*,javax.servlet.http.*,java.rmi.*,java.rmi.server.*;" %>
<%//@page import="MultipartRequest"
%>
<html>
<head><title>
Great!</title>
</head>
<body>
before upload
<%
String name=null;
String filenames[]=new String[3];
String filename=null;
String type=null;
File f;
try
{
MultipartRequest multi=new MultipartRequest(request,".",5*1024*1024);
%>
<h1>Upload test</h1>
<h3>params</h3>
<pre>
<% Enumeration params=multi.getParameterNames();
while (params.hasMoreElements()) {
name = (String)params.nextElement();
String value = multi.getParameter(name);
out.println(name + " = " + value);
}
%>
</pre>
<h3>Files:</h3>
<pre>
<%

int count=0;
Enumeration files = multi.getFileNames();

while (files.hasMoreElements())
{

name = (String)files.nextElement();
filename = multi.getFilesystemName(name);
type = multi.getContentType(name);
f = multi.getFile(name);
//out.println("name: " + name);
out.println("filename: " + filename);
out.println("type: " + type);
filenames[count]=filename;
count++;
// if(f != null)
// {
// out.println("length: " + f.length());
// }
%>
</pre>
<%
}
out.flush();
//AddServerIntf addServerIntf = null;
/*
try{
addServerIntf = (AddServerIntf)Naming.lookup("rmi://127.0.0.1:80/AddServer");
addServerIntf.run();
}catch(Exception e) {System.out.println("rr"+e);}
*/
try
{
Process p=java.lang.Runtime.getRuntime().exec("cpp2.exe"+" "+filenames[0]+" "+filenames[1]+
" "+".\\..\\webapps\\upload1\\test.bmp"+" 2");
out.flush();
}
catch(IOException ioe)
{
System.err.println("error");
System.exit(1);
}
System.out.flush();
}
catch(Exception e){
System.out.println(e);
}
out.println("<p align=left><img src=file:\\..\\..\\bin"+filenames[0]+" height=200 width=200></p>");
out.println("<p align=center><img src=file:\\..\\..\bin"+filenames[1]+" height=200 width=200></p>");
%>
<p align=right><img src="http://localhost:8080/upload1/test.bmp" height=200 width=200></p>
</body>
</html>
------------------------ExeTag.java-------------------package upload1;
import java.io.*;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
public class ExeTag extends TagSupport
{
Process p;
boolean b=false;
String name=null;
String filenames[]=new String[3];
String filename=null;
String type=null;
File f;
public int doStartTag() throws JspTagException
{
try
{
Process p=java.lang.Runtime.getRuntime().exec("cpp2.exe"+
" "+filenames[0]+" "+filenames[1]+
" "+".\\..\\webapps\\upload1\\test.bmp"+" 2");
// out.flush();
}
catch(IOException ioe)
{
System.err.println("error");
System.exit(1);
}
System.out.flush();
return SKIP_BODY;
}
public int doEndTag()throws JspTagException
{
return EVAL_PAGE;
}
}
-----------------------------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>
<servlet>
<servlet-name>
snoop
</servlet-name>
<servlet-class>
SnoopServlet
</servlet-class>
<!--
<init-param>
<param-name>foo</param-name>
<param-value>bar</param-value>
</init-param>
-->
</servlet>
<servlet>
<servlet-name>
servletToJsp
</servlet-name>
<servlet-class>
servletToJsp
</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>
snoop
</servlet-name>
<url-pattern>
/snoop
</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>
snoop
</servlet-name>
<url-pattern>
*.snp
</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>
servletToJsp
</servlet-name>
<url-pattern>
/servletToJsp
</url-pattern>
</servlet-mapping>
<taglib>
<taglib-uri>
./webapps/upload1/web-inf/jsp/exetag
</taglib-uri>
<taglib-location>
/WEB-INF/jsp/exetag.tld
</taglib-location>
</taglib>
<security-constraint>
<web-resource-collection>
<web-resource-name>Protected Area</web-resource-name>
<!-- Define the context-relative URL(s) to be protected -->
<url-pattern>/jsp/security/protected/*</url-pattern>
<!-- If you list http methods, only those methods are protected -->
<http-method>DELETE</http-method>
<http-method>GET</http-method>
<http-method>POST</http-method>
<http-method>PUT</http-method>
</web-resource-collection>
<auth-constraint>
<!-- Anyone with one of the listed roles may access this area -->
<role-name>tomcat</role-name>
<role-name>role1</role-name>
</auth-constraint>
</security-constraint>
<!-- Default login configuration uses BASIC authentication -->
<!--
<login-config>
<auth-method>BASIC</auth-method>
<realm-name>Example Basic Authentication Area</realm-name>
</login-config>
-->
<!-- Form-based login is enabled by default. If you wish to
try Basic authentication, comment out the <login-config>
section below and uncomment the one above. -->
<login-config>
<auth-method>FORM</auth-method>
<realm-name>Example Form-Based Authentication Area</realm-name>
<form-login-config>
<form-login-page>/jsp/security/login/login.jsp</form-login-page>
<form-error-page>/jsp/security/login/error.jsp</form-error-page>
</form-login-config>
</login-config>
</web-app>
---------------------------exetag.tld---------------------------
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE taglib
PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN"
"http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd">
<!-- a tag library descriptor -->
<taglib>
<!-- after this the default space is
"http://java.sun.com/j2ee/dtds/jsptaglibrary_1_2.dtd"
-->
<tlibversion>1.0</tlibversion>
<jspversion>1.1</jspversion>
<shortname>exetag</shortname>
<uri></uri>
<info>
A simple tab library for the examples
</info>
<tag>
<name>ExeTag</name>
<tagclass>upload1.ExeTag</tagclass>
<info> Display JSP sources </info>

</tag>
</taglib>
---------------------------------------------------
Here is the ditching error I m cofronting since a week.
org.apache.jasper.compiler.CompileException: E:\jakarta-tomcat-3.2.1\webapps\upload1\jsp\exetag\uploadtag.jsp(3,0) Unable to open taglibrary ./webapps/upload1/web-inf/exetag : Could not locate TLD META-INF/taglib.tld
at org.apache.jasper.compiler.JspParseEventListener.handleDirective(JspParseEventListener.java:713)
at org.apache.jasper.compiler.DelegatingListener.handleDirective(DelegatingListener.java:116)
at org.apache.jasper.compiler.Parser$Directive.accept(Parser.java:215)
at org.apache.jasper.compiler.Parser.parse(Parser.java:1077)
at org.apache.jasper.compiler.Parser.parse(Parser.java:1042)
at org.apache.jasper.compiler.Parser.parse(Parser.java:1038)
PLEASE HELP.


VAIBHAV <BR>SCJP
vaibhav punekar
Ranch Hand

Joined: Jan 20, 2001
Posts: 134
Hello,
I m expecting a response from anybody.Is there nobody who has worked on tag libraries in Tomcat.Then I m proud that I m the one who is working.
Please Mr.William Brogden I think you can through some light on it.Thanks.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: please help,Custom tags In Tomact3.2.1