Solved

how to you c:if tag ?

Posted on 2004-03-26
13
284 Views
Last Modified: 2010-04-01

how to implement JSTL (maybe c:if) to do the following:-


 String sImageUrl = JP.getPreviewImageURL((DbNode)imgNode, 500, 500);  // url to the image with width and height
             String sImageFull =  JP.getPreviewImageURL((DbNode)imgNode, 700, 700);  // url to the image with width and height


<a href="GetPreview.jsp?">
          <img src="<%=sImageUrl%>">
          </a>


if user clicks of the anchor <a> then I want to change the
img source to the large image ie --

 <img src="<%=sImageFull%>">


awaiting a rresponse

thanks
0
Comment
Question by:sdesar
  • 9
  • 4
13 Comments
 
LVL 14

Expert Comment

by:kennethxu
ID: 10690085
jstl cannot do this!
you need javascript to do it.
0
 
LVL 14

Expert Comment

by:kennethxu
ID: 10690269
or if you can discribe more detail of your problem. hope I'll see it differently.
0
 

Author Comment

by:sdesar
ID: 10690388
Ok JavaScript should be okay for Onclick to check if its true .., but I think

if the onClick enent is true then I want to display <img src="<%=sImageFull%>">
else default is
<img src="<%=sImageUrl%>">




I just need to display a larger size image when the user clicks on the <a> tag and display this img src tag <img src="<%=sImageFull%>">

-Hope this helps
0
 
LVL 14

Expert Comment

by:kennethxu
ID: 10690481
then you'll have to pass a parameter to sever.
0
 
LVL 14

Expert Comment

by:kennethxu
ID: 10690569
or you can use javascript to change the image src righ in place.
0
 

Author Comment

by:sdesar
ID: 10690592
could you please give me the syntax for the JavaScript .. if that is easier

awaitng a reposnse
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 14

Expert Comment

by:kennethxu
ID: 10691315
give you img tag and id and get the tag, then tag.scr=newimageurl
0
 
LVL 14

Expert Comment

by:kennethxu
ID: 10691323
try:

<img src="<%=sImageUrl%>" onclick="this.src='<%=sImageFull%>'" >
0
 
LVL 14

Expert Comment

by:kennethxu
ID: 10691330
0
 

Author Comment

by:sdesar
ID: 10691883


I think all I need is to check is <a> tag is clicked then display <%=sImageFull%>
using JSTL c:if .. is that possible?

here is what I tried with your suggestion and it is NOT working

  <%-- OnClick
        <a href="GetPreview.jsp?"  onclick="this.src="<%=sImageFull%>"> <img src="<%=sImageUrl%>" > </a>

      --%>
HTML result
 
            <a href="http://rabbits10.jpg&width=3065&height=2176&format=jpg" >
        <img src="http://rabbits10.jpg&width=500&height=500&format=jpg">
          </a>


so i see that its being outputed in HTML source but not on the HTML screen
0
 
LVL 14

Accepted Solution

by:
kennethxu earned 50 total points
ID: 10691923
>> here is what I tried with your suggestion and it is NOT working
I told you to do this:
<img src="<%=sImageUrl%>" onclick="this.src='<%=sImageFull%>'" >
0
 

Author Comment

by:sdesar
ID: 10692287
Here are your Excellent points!

This works!

img src="<%=sImageUrl%>" onclick="this.src='<%=sImageFull%>'" >



Thanks a million!
0
 
LVL 14

Expert Comment

by:kennethxu
ID: 10692299
glad to know and my pleasure :)
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

In this step by step tutorial with screenshots, we will show you HOW TO: Enable SSH Remote Access on a VMware vSphere Hypervisor 6.5 (ESXi 6.5). This is important if you need to enable SSH remote access for additional troubleshooting of the ESXi hos…
In  today’s increasingly digital world, managed service providers (MSPs) fight for their customers’ attention, looking for ways to make them stay and purchase more services. One way to encourage that behavior is to develop a dependable brand of prod…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now