Announcement Announcement Module
Collapse
No announcement yet.
How insert image tag into file jsp with acegi security Page Title Module
Move Remove Collapse
This topic is closed
X
X
Conversation Detail Module
Collapse
  • 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.
    Pasquy

  • #2
    Hi,
    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.

    Comment


    • #3
      I'm using acegi-security-1.0.0-RC2 that it is used in example!
      (search SpringAcegiTutorial.zip 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).

      Thanks
      Pasquy

      Comment


      • #4
        Have you seen this tutorial ?
        http://static.springframework.org/sp...-tutorial.html

        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?

        Comment


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

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

          include.jsp file is:

          <%@ taglib prefix="c" uri="....sun.com/jstl/core" %>
          <%@ taglib prefix="fmt" uri="....sun.com/jsp/jstl/fmt" %>

          Comment


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


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

            Comment


            • #7
              It's works! Thanks michael.

              Comment


              • #8
                Setting timeout session in acegi

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

                Thanks
                Pasquy

                Comment

                Working...
                X