-
Aug 20th, 2008, 05:02 PM
#1
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
-
Aug 21st, 2008, 01:43 AM
#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.
-
Aug 21st, 2008, 03:41 AM
#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
-
Aug 21st, 2008, 03:45 AM
#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?
-
Aug 21st, 2008, 03:55 AM
#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" %>
-
Aug 21st, 2008, 03:59 AM
#6
I believe the image path should start from your context root:
<img alt="My banner" src="<%=request.getContextPath()%>/image/banner.jpg" />
-
Aug 21st, 2008, 04:03 AM
#7
It's works! Thanks michael.
-
Sep 9th, 2008, 11:47 AM
#8
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
-
Forum Rules