Results 1 to 8 of 8

Thread: How insert image tag into file jsp with acegi security

  1. #1
    Join Date
    Aug 2008
    Posts
    11

    Default 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. #2
    Join Date
    May 2008
    Posts
    34

    Default

    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.

  3. #3
    Join Date
    Aug 2008
    Posts
    11

    Default

    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

  4. #4
    Join Date
    May 2008
    Posts
    34

    Default

    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?

  5. #5
    Join Date
    Aug 2008
    Posts
    11

    Default

    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" %>

  6. #6
    Join Date
    May 2008
    Posts
    34

    Default

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


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

  7. #7
    Join Date
    Aug 2008
    Posts
    11

    Default

    It's works! Thanks michael.

  8. #8
    Join Date
    Aug 2008
    Posts
    11

    Default Setting timeout session in acegi

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

    Thanks
    Pasquy

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •