blank_target in struts2 - struts2

can any one suggest how to write target="_blank" in struts2. I tried something like below but the hyperlink was not working
<s:url id="imageDownload" namespace="/" action="downloadImage" var="urlTag">
<s:param name="ImageFileName" value="%{ImageFileName}"></s:param>
<s:param name="id" value="%{id}"></s:param>
</s:url>
<a class="linkView" href="<s:property value="#urlTag" />" target="_blank">
<s:property value="ImageFileName" />
</a>
thanks

I think
<a class="linkView" href="<s:property value="#urlTag" />" target="_blank">
<s:property value="ImageFileName" />
</a>
is correct.

Related

Thymeleaf show another image if not exists

I'm using the following image code that will show an image only if it exists.
<img th:if="${!ad.adPhotos.empty}" th:src="|/imageDisplay?id=${ad.adPhotos[0].id}|" alt="" class="img-respocive" />
I want to show this for the else caluse
<img height="150" width="150" src="img/NoPicAvailable.png" />
How would this be done with Thymeleaf?
I would personally do it like this:
<img th:unless="${ad.adPhotos.empty}" th:src="|/imageDisplay?id=${ad.adPhotos[0].id}|" alt="" class="img-respocive" />
<img th:if="${ad.adPhotos.empty}"height="150" width="150" src="img/NoPicAvailable.png" />
As a sidenote, I think I would generate the src with thymeleaf url syntax, rather than string concatenation.
<img th:unless="${ad.adPhotos.empty}" th:src="#{/imageDisplay(id=${ad.adPhotos[0].id})}" alt="" class="img-respocive" />

How can i highlight the boxes if when i mouseover?

Im just really new at this, i dont even know how to use CSS, anyway, this is the html that i want to fix, I WANT THE BOXES that has links in them to be highlighted or something when mouse is on it.
<img class="aligncenter wp-image-351" src="http://gms-wga.org/wp-content/uploads/2014/08/WGA-Organogram.jpg" alt="WGA Organogram" usemap="#wga" width="1126" height="1122" />
<map name="wga"> <area title="" alt="" coords="135,131,479,228" shape="rect" href="/about-us/program-implementation-structure/wga-coordinators-and-focal-points/" target="" /> <area title="" alt="" coords="152,299,457,415" shape="rect" href="/about-us/program-implementation-structure/wga-coordinators-and-focal-points/" target="" /> <area title="" alt="" coords="642,132,949,227" shape="rect" href="/about-us/program-implementation-structure/wga-co-chairdirector/" target="" /> <area title="" alt="" coords="662,303,911,394" shape="rect" href="/about-us/program-implementation-structure/adb-officer/" target="" /> <area title="" alt="" coords="290,512,837,742" shape="rect" href="/about-us/program-implementation-structure/wga-secretariat/" target="" /> </map>
Sadly you can't do it with just html. If you want interactivity like that you will have to learn Jquery. Our just javascript in order to do that. A good place to learn it is www.codeacademy.com/
Why dont you use a background image and transparent <div> tags so that it will highlight when you hover? Only if you are okay with using them :)

how to implemant image map in flexslider?

I am using flexslider.
It is very easy to implement and customizing.
Now my every slide is a link.
is there any way to put to links for a single slide?
that needs to redirect to PAGE1 when click the left side of the image and must redirect to PAGE2 when click the right side.
Thanks in advance dear seniors...
I've found the answer.
The following method is working
<div class="flexslider">
<ul class="slides">
<!-- slide1 -->
<li>
<img src="images/slider/2.jpg" alt="" usemap="#map2" />
<map name="map2">
<area shape="rect" coords="494,2,961,745" href="http://www.john-anthony.com/mens/jeans/" alt=""/>
<area shape="rect" coords="0,4,482,749" href="http://www.john-anthony.com/vivienne-westwood/blazer-jackets/burgundy/jacket-waistcoat-check/vw024-a13-bur/" alt=""/>
</map>
</li>
</ul>
</div>
I've found the answer. The following method is working
<div class="flexslider">
<ul class="slides">
<!-- slide1 -->
<li>
<img src="images/slider/2.jpg" alt="" usemap="#map2" />
<map name="map2">
<area shape="rect" coords="494,2,961,745" href="http://www.john-anthony.com/mens/jeans/" alt=""/>
<area shape="rect" coords="0,4,482,749" href="http://www.john-anthony.com/vivienne-westwood/blazer-jackets/burgundy/jacket-waistcoat-check/vw024-a13-bur/" alt=""/>
</map>
</li>
</ul>
</div>

struts variable value in href id

I have Map type.
I want to iterate over it using struts tag library.
now want to generate a token using { id + '_nav' } and set this token to id field of href.
Can You please help me out how to do that in struts?
The JSP Code :
<div class="box-heading">Quick Links</div>
<ul>
<s:set name="currentPage" value="currentNavigationPage"></s:set>
<s:iterator value="orderedSectionName_StartPageMap" >
<s:if test="%{#currentPage > key}">
<li><a id="{key + '_nav'}" href="#" ><s:property value="value"/></a></li>
</s:if>
<s:else>
<li><a href="#" ><s:property value="value"/></a></li>
</s:else>
</s:iterator>
</ul>
Can u please suggest me , how can i appen key from map with '_nav' token ?
Thanks.
Not tested you can try something like
<s:iterator value="orderedSectionName_StartPageMap" var="mapObject" >
<s:if test="%{#currentPage > key}">
<li><a id="%{#key}__nav" href="#" ><s:property value="value"/></a></li>
</s:if>
<s:else>
<li><a href="#" ><s:property value="value"/></a></li>
</s:else>
</s:iterator>
or
<li><a id='%{#key+"__nav"}' href="#" ><s:property value="value"/></a></li>
Honestly i have not tested both of them myself
As update by the Zuned it will work with <s:propert> also
<li><a id='<s:property value="key"/>' href="#" ><s:property value="value"/></a></li>
Try this,
<s:a id="%{key}__nav" href="#" ><s:property value="value"/></s:a>
instead of
<a id="%{#key}__nav" href="#" ><s:property value="value"/></a>

Struts2: Hidden field and anchor tag <s:a> values In Action Class

I am working on a struts2 application. In my jsp page I have 2-3 anchor tag and 2-3 hidden fields like
<s:a href="#">File 1</s:a>
<s:a href="#">File 2</s:a>
<s:a href="#">File 3</s:a>
and
<s:hidden name=" hidden1" />
<s:hidden name=" hidden2" />
<s:hidden name=" hidden3" />
Now please let me know, In my action class how can I get value of all the hidden fields and anchor tag which was clicked.
I had tried following
<s:a href="#" action=”someAction”>File 1</s:a>
Its working but didn’t transfer value of hidden fileds.
Also
<s:a href="#" name=”File1” onclick=”submit”>File 1</s:a>
But no gain.
Looking for your reply.
Like Boris said, you need to put the hidden fields inside a form, and submit that form, OR you can add them as URL parameters to your links. The best method is probably using a form with POST so the hidden fields aren't on your browser's location bar.
Here's an example
<s:form id="myform" name="myform" action="someAction" method="POST">
<s:hidden name=" hidden1" value="first value"/>
<s:hidden name=" hidden2" value="second value"/>
<s:hidden name=" hidden3" value="third value"/>
Submit with link
<s:submit value="%{'Submit with button'}" />
</s:form>
Since this really has nothing to do with struts2, here's an example with pure HTML:
<form id="myform" name="myform" action="someAction.action" method="POST">
<input type="hidden" name=" hidden1" value="first value"/>
<input type="hidden" name=" hidden2" value="second value"/>
<input type="hidden" name=" hidden3" value="third value"/>
Submit with a link
<br/>
<input type="submit" value="Submit with a button"/>
</form>

Resources