Announcement Announcement Module
No announcement yet.
How insert image tag into file jsp with acegi security Page Title Module
Move Remove Collapse
This topic is closed
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • How insert image tag into file jsp with acegi security

    Hi all,
    I'm new in this forum and now I want to use spring.
    I see on net a spring example with acegi security, and I want to edit the example : SpringAcegiTutorial.

    This example works, but I don't understand how to insert my image in to jsp protected.
    In other words, the springweb example has a security section (in the folder WEB-INF/jsp/secure) and I try to insert an image (with <img> tag) in my jsp under secure folder.

    Can you help me?
    Thanks for your time.

  • #2
    first of all please make sure you're using Spring Security 2.0 instead of Acegi Security 1.0. Acegi is the previous version.
    Besides, I think your problem is due to the WEB-INF folder. When loading images, your web browser makes separate queries. It cannot directly reference anything which is inside the WEB-INF folder. If you remove Acegi, you will have the same issue!
    I would suggest that you put your images under another folder, not WEB-INF. In that case you'll be able to secure accesses to that folder.


    • #3
      I'm using acegi-security-1.0.0-RC2 that it is used in example!
      (search on google page - now I cannot post this url).

      In my app, the image folder is not under WEB-INF folder but it's extern and in my login page the img tag works.

      I think that in the file xml (web.xml or dispatcher-servlet.xml) must be insert a properties to access a this resorse (images).



      • #4
        Have you seen this tutorial ?

        I think this is the new version of the one you're using.

        You shouldn't need to add anything to any xml file regarding resources. Can you post the <img ...> declaration which is not working?


        • #5
          Ok, I have a header.jsp file under WEB-INF/jsp/secure/admin/

          <%@ taglib uri="" prefix="spring" %>
          <%@ include file="/WEB-INF/jsp/secure/admin/include.jsp"%>
          <title>:: My Examples ::</title>
          <link rel="stylesheet" type="text/css" href="../../css/stile.css">
          <img alt="My banner" src="image/banner.jpg" />

          include.jsp file is:

          <%@ taglib prefix="c" uri="" %>
          <%@ taglib prefix="fmt" uri="" %>


          • #6
            I believe the image path should start from your context root:

            <img alt="My banner" src="<%=request.getContextPath()%>/image/banner.jpg" />


            • #7
              It's works! Thanks michael.


              • #8
                Setting timeout session in acegi

                Hi all,
                How can I to set a timeout with acegi security?