Results 1 to 3 of 3
Thread: [SOLVED] Use Tablib in a servlet
- 08-11-2008, 03:07 PM #1
[SOLVED] Use Tablib in a servlet
Hi @all,
I want to use a the Apache Tiles 2 TagLib in an servlet. I mean the page which is generated uses some Tiles 2 Tags, and therefor I have to use this taglib. But how can I get this taglib in my servlet.
This line out.println("<%@ taglib uri=\"http://tiles.apache.org/tags-tiles\" prefix=\"tiles\" %>;"); will not work, because the writer writes it in html and it will not get compiled or whatever. But how can I use this taglib in my servlet????Java Code:public class ProjectDetails extends HttpServlet { /** * Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods. * @param request servlet request * @param response servlet response */ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); try { //out.println("<%@ taglib uri=\"http://tiles.apache.org/tags-tiles\" prefix=\"tiles\" %>;"); out.println("<html>" + "<head>" + "<meta http-equiv=\"content-type\" content=\"text/html; charset=ISO-8859-1\">" + "<link href=\"css/layout.css\" type=\"text/css\" rel=\"stylesheet\">" + " <title>AIS DCL</title>" + "</head>" + "<body>" + "<tiles:insertDefinition name=\"aisdcl.projectAdminView\" />" + "</body>" + "</html>"); } finally { out.close(); } }
- 08-21-2008, 05:29 PM #2
Senior Member
- Join Date
- Jun 2007
- Location
- Bali, Indonesia
- Posts
- 696
- Rep Power
- 6
What I understand that the taglib technology is used inside a JSP file and not a Servlet. Is there other way that you can think of so that the page is not created by Servlet but simply a JSP file?
Website: Learn Java by Examples
- 08-21-2008, 05:42 PM #3
I can take a jsp file
Hello wsaryada,
thank you for your reply. Actually I did like you sad. I only forgot to post my soulution here. Sorry for that. And now that I understand the jsp concept better I know that a jsp file will be always compiled to a servlet. And thats why now matter about that. And furthermore taking a jsp file is better than use this f*****g out.println("<img scr=\"blabla\"...>); (only a example :) in a servlet). Thank you very much.
Similar Threads
-
servlet
By kondalrao.p in forum Java ServletReplies: 1Last Post: 09-06-2008, 01:10 PM -
Servlet
By banie in forum New To JavaReplies: 6Last Post: 04-11-2008, 05:18 PM -
How to mix servlet & JSP
By Swamipsn in forum Java ServletReplies: 1Last Post: 08-08-2007, 12:57 AM -
javax.servlet.ServletException: Wrapper cannot find servlet class util.t2
By osval in forum Advanced JavaReplies: 1Last Post: 08-07-2007, 03:47 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks