• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Images are not coming in JSP pages

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I am running my Struts project in linux.. i deployees successfully in linux machine but while running in server images are not displaying in jsp pages...

please send whats the problem.

regards
ajay
 
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi sunil,

for displaying the images in jsp, you need to give correct path..

1. where you put your images

2. what is the path you give in your jsp


can you post you jsp code and also mention in which directory (absolute path) you put images
 
sunil ajay
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

i made image folder in WebContent, i gaving that path in JSP page.

If i write <taglib> in jsp code. i wrote in 4 line.. than only virtual image is coming, not real image if i remove virtal image wont come.. what is the problem???

here images is Login button.....


<%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %>
<taglib>

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<script>
function setAction(actionName)
{
document.forms[0].action.value = actionName;

if(actionName == "LoginDetails")
{
if(document.forms[0].username.value == "")
{
alert("Please Enter User Name");
document.forms[0].username.focus();
return;
}
else if(document.forms[0].password.value == "")
{
alert("Please Enter Password");

document.forms[0].password.focus();
}

else{
document.forms[0].submit();
}

}
}
</script>
<body bgcolor="#C3D9FF">

<html:form action="login" name="loginForm" type="com.my.login.action.LoginForm">
<p> </p>
<p> </p>
<table width="287" height="146" border="1" align="right" cellpadding="0" cellspacing="0">

<logic:present name="usernamePassword">
<tr>
<td colspan="2"><label>
<font color="red"><bean:write name="usernamePassword"/></font>
</label></td>
</tr>
</logic:present>
<tr>
<td width="84" height="28"><strong>Username: </strong></td>
<td width="203"><label>
<html:text property="username" />
</label></td>
</tr>
<tr>
<td height="26"><strong>Password:</strong></td>
<td><label>
<html:password property="password" />
</label></td>
</tr>


<tr>
<td height="30"> </td>
<td><a href="javascript:setAction('LoginDetails')">
<img src="./images/Login.gif" width="61" height="21" border="0"></a></td>
</tr>
<tr>
<td height="28"> </td>
<td></td>
</tr>
</table>
</html:form>
</body>
</html>
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you are using stuts jsp form ...so you need to give <%@ taglib...%>

you put images under image or images folder

or the images belong to .png or .gif

--------------------------------------------------------------------

<img src="./images/Login.gif" width="61" height="21" border="0">
-------------------------------------------------------------------
 
sunil ajay
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you are using stuts jsp form ...so you need to give <%@ taglib...%>
you put images under image or images folder
or the images belong to .png or .gif
Hi,
1) im using
<%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %>
this tlds in header...

If i write <taglib> in jsp code. after these 3 tld's than only virtual image is coming, not real images, if i remove virtal image wont come..


2)ya i made images folder.....
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are using improper URLs for your images.

Please see the JSP FAQ for the entry on creating proper resource URLs.

Also, please be sure to use UBB code tags when posting code to the forums. Unformatted code is extremely hard to read and many people that might be able to help you will just move along to posts that are easier to read. Please read this for more information.

You can go back and change your post to add code tags by clicking the .
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic