Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: NetBeans IDE GlassFish Environment Relative Paths. Or is it?

  1. #1
    Junior Member
    Join Date
    Nov 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default NetBeans IDE GlassFish Environment Relative Paths. Or is it?

    Hi all

    Strange behaviour observed. Perhaps someone with more experience can explain.

    I have a NetBeans project page that pulls a list of products from a database.

    There is a script block in the jsp that parses the list and creates image tags in the body of the jsp.

    I have been trying for 4 days to figure out why the images don't render in the browser thinking it was a relative paths issue
    because there seems to be a lot on the net associated with people having relative path issues.

    However, today I had the bright idea of hardcoding an image tag into the jsp and moving the image around the project
    file system to see where in the file sysem the app actually picks it up. Eureka. Found it. Its nothing at all to do
    with relative paths. Don't know why I didn't think of that sooner. Never mind.

    So what's the problem?

    Here it is. Now that I know where the images should be I modified my dynamic image tag generation code to suit.

    But, alas, still no image render. What the hell?

    So, I hard coded the image tag in the script block to one of the images defined in my data. Guess what? It renders fine in the browser.

    But when I build the image tag dynamically from my data within the script block it doesn't.

    Even though, when I look at the rendered html in the browser source, the image tags are identical.

    Here is the scriptlet code

     
          <%
     
             Category _category = new Category();
     
            _category.setCategoryid(41);
     
             List<CategoryProductItem> _cpilist = SampleServletBean.DAC().CategoryProductListPage(_category);
     
             for(CategoryProductItem cpiitem : _cpilist) {
     
            %> 
     
            <%= "In Product List " + String.valueOf(cpiitem.Productid()) + cpiitem.Productname() +  "<br />" %>
     
            <%
     
                String _imageURL = "Images\\dbe83c66-054c-4604-a71d-45d02dba73ca.png";
     
                String _imageURL2 = "Images\\" + cpiitem.Productimagefilename() + "." + cpiitem.Productimageextension();
     
                String imglink = "<img src=\"" + _imageURL + "\" alt=\"\" />";
     
                String imglink2 = "<img src=\"" + _imageURL2.toLowerCase() + "\" alt=\"\" />";
     
            %>
     
            <%=imglink %><br /><br />  
            <%=imglink2 %><br /><br />      
     
            <% 
                }
            %>

    .... and here is the html source rendered in the browser for the two images

     
    <img src="Images\dbe83c66-054c-4604-a71d-45d02dba73ca.png" alt="" /><br /><br />  
    <img src="images\dbe83c66-054c-4604-a71d-45d02dba73ca.png" alt="" /><br /> <br />

    Identical as you can see.

    The top one renders ok.

    The second one doesn't.

    See the attached pic.

    Twilight zone?

    Is it possible thet the page is being rendered at the second image tag point BEFORE the image is downloaded to the browser.

    Is this a known synch problem?

    What do you reckon?

    All suggestions appreciated.

    Thanks

    Ray
    Attached Images Attached Images


  2. #2
    Junior Member
    Join Date
    Nov 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: NetBeans IDE GlassFish Environment Relative Paths. Or is it?

    That is just so typical. After 4 frustrating days I decide to go to forum and within 5 minutes of doing so I get a lightbulb moment.

    The damn url is case sensitive!!!! WTH?

    Its the leading "i" in the second image tag src.

    Anyone know how to switch that off in GlassFish? Can't find anything in the admin console.

    Christ! Four days wasted.

    That just sucks so much.

    Cheers

    Ray

Similar Threads

  1. Why it run in Netbeans(7,3,1) IDE but not with jar (in side dist folder)
    By simonongsk in forum What's Wrong With My Code?
    Replies: 0
    Last Post: February 23rd, 2013, 04:05 AM
  2. Replies: 0
    Last Post: January 15th, 2013, 08:59 PM
  3. Accesing Old Projects In NEtBeans IDE
    By Farmer in forum Java IDEs
    Replies: 0
    Last Post: May 22nd, 2012, 12:13 PM
  4. How to configure context.xml in netbeans IDE?
    By tangara in forum Java IDEs
    Replies: 1
    Last Post: January 5th, 2012, 11:18 PM
  5. Problem with java swing JButton in Netbeans IDE
    By vrp in forum What's Wrong With My Code?
    Replies: 2
    Last Post: January 12th, 2011, 11:38 PM