Use java classes available package in JSP? -
i new in jsp development. have run simple .jsp files. noe have problem of using classes available in package. have app dir in webapp dir in app dir have .jsp files , package named mypack. mypack contains classes want use in .jsp file in app dir. error of 500 while want run .jsp file contains class of mypack package.
example: example1.jsp <%@page contenttype="text/html"%> <%@page pageencoding="utf-8"%> <%@ page import="mypack.display" %> <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <% display cnt=new display(); string outpt=cnt.echovar("hi da"); out.println(outpt); %> counter.java package mypack; public class display { public string echovar(string var){ return var; } }
is there way accomplish task?
java
files goes under src
, packages. jsp
files goes under webapp
or webcontent
(in eclipse) directory should contain web-inf
directory.
example:
this should more : http://tomcat.apache.org/tomcat-7.0-doc/appdev/deployment.html#standard_directory_layout
Comments
Post a Comment