struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Todd Pierce <Todd.Pie...@hubbub.com.au>
Subject RE: html:link confusion
Date Wed, 25 Sep 2002 00:06:52 GMT
I had this issue, but solved it fairly simply by using html:rewrite istead:

window.open('<html:rewrite href="reportReceived.do" name=
"investigationEmploymentHistoryForm" property="map">View 
Employment History Report</html:rewrite>')

It looks a bit ugly. That's why I swept all the javascript rubbish into a
tile that essentially replaces the <html:link> tag for popups in my
application. 

<tiles:insert page="/tiles/popuplink.jsp">
   <tiles:put name="hlink">
      <html:rewrite forward="your.link" name="name" property="property"/>
   </tiles:put>
   <tiles:put name="label">Your link</tiles:put>
   <tiles:put name="class">someCSS</tiles:put>
</tiles:insert>						

The generated HTML looks something like this: 

<a class="someCSS" href="javascript:void(0)"
onclick="window.open('yourlink.do?name=value','windowName',....)>Your
link</a>

It's a lot of code for a little link, but in practical terms its cleaner and
promotes reuse. The next step would be a custom tag. Actually, that sounds
like fun - I might do it today!

-----Original Message-----
From: Stephen.Chambers@transplace.com
[mailto:Stephen.Chambers@transplace.com]
Sent: Wednesday, 25 September 2002 4:19 AM
To: Struts Users Mailing List
Subject: html:link confusion



All,

I had the code below in my jsp and everything was fine. It worked like it
was supposed to.


<html:link href="reportReceived.do" name=
"investigationEmploymentHistoryForm" property="map" target="_blank">view
Employment History Report</html:link>

Then the users decide that they didn't like the fact that the new window
had all the scrollbars and menus and everything on the top and so I did the
next piece of code below:



<script language="JavaScript">
<!--
function openWindow(theURL,winName,features) {
window.open(theURL,winName,features);
}

//-->
</script>
<html:link href="reportReceived.do" name=
"investigationEmploymentHistoryForm" property="map" onclick="openWindow
('reportReceived.do','','scrollbars=yes')">view Employment History Report
</html:link>

and it stopped working. I got the pop up without all the needed parameters
as well as going to the new page in the parent window. What am I doing
wrong?


Steve



--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message