Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-11-2008, 03:07 PM
hannehomuth's Avatar
Member
 
Join Date: Jul 2008
Location: Sommerfeld (Brandenburg, Germany)
Posts: 35
Rep Power: 0
hannehomuth is on a distinguished road
Default [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.

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();
        }
    }
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????
Bookmark Post in Technorati
Reply With Quote
  #2 (permalink)  
Old 08-21-2008, 05:29 PM
Senior Member
 
Join Date: Jun 2007
Location: Bali, ID
Posts: 102
Rep Power: 0
wsaryada is on a distinguished road
Default
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:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
- Blog:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 08-21-2008, 05:42 PM
hannehomuth's Avatar
Member
 
Join Date: Jul 2008
Location: Sommerfeld (Brandenburg, Germany)
Posts: 35
Rep Power: 0
hannehomuth is on a distinguished road
Default 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.
Bookmark Post in Technorati
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
servlet kondalrao.p Java Servlet 1 09-06-2008 01:10 PM
Servlet banie New To Java 6 04-11-2008 05:18 PM
How to mix servlet & JSP Swamipsn Java Servlet 1 08-08-2007 12:57 AM
javax.servlet.ServletException: Wrapper cannot find servlet class util.t2 osval Advanced Java 1 08-07-2007 03:47 PM
Servlet Example JavaForums Java Blogs 0 08-04-2007 10:56 PM


All times are GMT +2. The time now is 09:53 AM.



VBulletin, Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2009, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org