Hassan,
Tomcat works differently to glassfish tough
here is what im doing-
In tomcat jsp are placed in the -
Installed - dir \tomcat\WORK\tomcat\ROOT
and servlets are placed -
E:\tomcat\WORK\tomcat\ROOT\web-inf\classes
that's how I do mine in tocat. Of cause, the tomcat
is a web server not a whole application server. I am
using glassfish.
Some body suggested placing in tomcat\Work\tomcat\ROOT\images
images being the folder containing the images
and ROOT would contain jsps.
so construct as-
> <display:column>
> <img src="../images/${bpic}"/>
> </display:column>
in the database the string menjeans.png is contained in the table attribute.
But in glassfish, as you may already know it works like this:
I have created a project folder / dir using netbeans as e.g
Enterappli
Now my jsp files are in:-
dir\Enterappli\Enterappli-war\web\viewapp.jsp
my servlets are in-
dir\Enterappli\Enterappli-war\src\java\myservletfiles\myservletcontrol.java
Now I have my images folder in-
Enterappli\Enterappli-war\images
im the attribute on my table in the DB, I've
menjeans.png
which is a string.
my servlet invoke the bean and forward data to my jsp as
in the case of MVC design.
Ok now my jsp already display the data except the pic.
So how do I construct it:
<display:column><img border="1" src="../images/${bpic}" height="200" width="200" title="Picture"/></display:column>
bpic is an attribute of my table in the database.
Pls, any suggestion.
Thanking you in advance.
eve
> Date: Tue, 22 Sep 2009 08:11:26 -0700
> From: hassan.schroeder_at_gmail.com
> To: users_at_glassfish.dev.java.net
> Subject: Re: where to place images in application using glassfish
>
> On Tue, Sep 22, 2009 at 7:39 AM, Eve Pokua <gorgeous65_at_msn.com> wrote:
>
> > In tomcat, i would do something like the following:
>
> > if your jsp page is at /ROOT/jsps/mydisply.jsp and images
> > are in /ROOT/images I can construct a <display:column> tag:
> >
> > <display:column>
> > <img src="../images/${bpic}"/>
> > </display:column>
>
> That should be an absolute path ( drop the leading ".."). And it
> really should include the context path, though if this is the ROOT
> context it's not essential.
>
> > Now where to I place my images using glassfish.
>
> Exactly the same place as using Tomcat.
>
> > I assum in my web-inf folder of my application
> >
> > then I can access it as follows:
>
> > <display:column><img border="1" src="/WEB-INF/${bpic}" height="200"
> > width="200" title="Bale Picture"/></display:column>
>
> No, then as you've discovered, no one will be able to see them --
> files in WEB-INF are protected from direct access, which a browser
> needs in order to fetch them. That's part of the Servlet Spec.
>
> --
> Hassan Schroeder ------------------------ hassan.schroeder_at_gmail.com
> twitter: @hassan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
_________________________________________________________________
Get the best of MSN on your mobile
http://clk.atdmt.com/UKM/go/147991039/direct/01/
--_3d9b7dc8-2fe2-41c8-8750-e543eda405fc_
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
--></style>
</head>
<body class='hmmessage'>
Hassan,<BR>
<BR>
Tomcat works differently to glassfish tough<BR>
<BR>
here is what im doing-<BR>
<BR>
<BR>
<BR>In tomcat jsp are placed in the -<BR> <BR>Installed - dir \tomcat\WORK\tomcat\ROOT<BR> <BR>and servlets are placed -<BR> <BR>E:\tomcat\WORK\tomcat\ROOT\web-inf\classes<BR> <BR>that's how I do mine in tocat. Of cause, the tomcat<BR>is a web server not a whole application server. I am<BR>using glassfish.<BR> <BR>Some body suggested placing in tomcat\Work\tomcat\ROOT\images<BR>images being the folder containing the images<BR>and ROOT would contain jsps.<BR> <BR><BR> <BR>so construct as-<BR> <BR>> <display:column><BR>> <img src="../images/${bpic}"/><BR>> </display:column><BR><BR> <BR>in the database the string menjeans.png is contained in the table attribute.<BR> <BR>But in glassfish, as you may already know it works like this:<BR><BR> <BR>I have created a project folder / dir using netbeans as e.g<BR>Enterappli<BR> <BR>Now my jsp files are in:-<BR> <BR>dir\Enterappli\Enterappli-war\web\viewapp.jsp<BR> <BR>my servlets are in-<BR><BR>dir\Enterappli\Enterappli-war\src\java\myservletfiles\myservletcontrol.java<BR> <BR>Now I have my images folder in-<BR> <BR>Enterappli\Enterappli-war\images<BR> <BR>im the attribute on my table in the DB, I've<BR> <BR>menjeans.png<BR> <BR>which is a string.<BR> <BR>my servlet invoke the bean and forward data to my jsp as <BR>in the case of MVC design.<BR> <BR>Ok now my jsp already display the data except the pic.<BR> <BR>So how do I construct it:<BR> <BR><display:column><img border="1" src="../images/${bpic}" height="200" width="200" title="Picture"/></display:column><BR> <BR>bpic is an attribute of my table in the database.<BR> <BR>Pls, any suggestion. <BR> <BR>Thanking you in advance.<BR> <BR>eve<BR> <BR>> Date: Tue, 22 Sep 2009 08:11:26 -0700<BR>> From: hassan.schroeder@gmail.com<BR>> To: users@glassfish.dev.java.net<BR>> Subject: Re: where to place images in application using glassfish<BR>> <BR>> On Tue, Sep 22, 2009 at 7:39 AM, Eve Pokua <gorgeous65@msn.com> wrote:<BR>> <BR>> > In tomcat, i would do something like the following:<BR>> <BR>> > if your jsp page is at /ROOT/jsps/mydisply.jsp and images<BR>> > are in /ROOT/images I can construct a <display:column> tag:<BR>> ><BR>> > <display:column><BR>> > <img src="../images/${bpic}"/><BR>> > </display:column><BR>> <BR>> That should be an absolute path ( drop the leading ".."). And it<BR>> really should include the context path, though if this is the ROOT<BR>> context it's not essential.<BR>> <BR>> > Now where to I place my images using glassfish.<BR>> <BR>> Exactly the same place as using Tomcat.<BR>> <BR>> > I assum in my web-inf folder of my application<BR>> ><BR>> > then I can access it as follows:<BR>> <BR>> > <display:column><img border="1" src="/WEB-INF/${bpic}" height="200"<BR>> > width="200" title="Bale Picture"/></display:column><BR>> <BR>> No, then as you've discovered, no one will be able to see them --<BR>> files in WEB-INF are protected from direct access, which a browser<BR>> needs in order to fetch them. That's part of the Servlet Spec.<BR>> <BR>> -- <BR>> Hassan Schroeder ------------------------ hassan.schroeder@gmail.com<BR>> twitter: @hassan<BR>> <BR>> ---------------------------------------------------------------------<BR>> To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net<BR>> For additional commands, e-mail: users-help@glassfish.dev.java.net<BR>> <BR> <br /><hr />Beyond Hotmail - see what else you can do with Windows Live. <a href='
http://clk.atdmt.com/UKM/go/134665375/direct/01/' target='_new'>Find out more.</a></body>
</html>
--_3d9b7dc8-2fe2-41c8-8750-e543eda405fc_--