Converting HTML Links to Hyperlinks in InDesign

Hi--I'm new to this forum, so forgive any newbie-ness...
Working on a pretty intense automated page layout which creates a product cut sheet based from content that is on the web (using AppleScript). One feature I'm trying to build in is to convert typical HTML href tags to an actual hyperlink in InDesign.
I'm using GREP to find all the html tags, which works very well.
What I can't do (and it might be a limitation of GREP in ID) is store the 'change to' locations as variables in AppleScript. For example, I use:
--find the href tag
set find what of find grep preferences to "(?i)(<a href=\")(.+?)(\")(.*)(>)(.*)(</a>)"
--change to the stuff in the href=" " and the text I want to keep
set change to of change grep preferences to "$2 $6"
What I NEED is the ability to make $2 and $6 variables.
Any advice, tips, hints, tricks, and/or help?
Thanks all!

Sorry, it's been a while since I solved this, so its not too fresh. There may be pieces missing. Here's the exerpt of what I did to change real html marked-up text (which contains hyperlinks) into real, clickable InDesign hyperlinks. In a few words, I found the html hyperlinks in the text, and "marked it up" with my own "xml" type language (for later). Then I think I made an array of every link and location, then had InDesign go through and convert to hyperlinks.
---CONVERT HREFS TO HYPERLINKS------------------------------------------------------
    set find grep preferences to nothing
    set change grep preferences to nothing
    --FIND HYPERLINKS
    set include footnotes of find change grep options to false
    set include hidden layers of find change grep options to false
    set include locked layers for find of find change grep options to false
    set include locked stories for find of find change grep options to false
    set include master pages of find change grep options to true
    set find what of find grep preferences to "(?i)(<a href=\")(.+?)(\")(.*?)(>)(.*?)(</a>)"
    --set find what of find grep preferences to "(?i)(?<=<a href=\").+?(?=\")"
    set change to of change grep preferences to "<url>http://www.mywebaddress.com$2</url> <linked text>$6</lt>"
    set applied character style of change grep preferences to nothing
    tell specSheet
        change grep
    end tell
set find grep preferences to nothing
    set change grep preferences to nothing
    --FORMAT HYPERLINKS
    set include footnotes of find change grep options to false
    set include hidden layers of find change grep options to false
    set include locked layers for find of find change grep options to false
    set include locked stories for find of find change grep options to false
    set include master pages of find change grep options to true
    set find what of find grep preferences to "http://.+?(?=</url> <linked text>)"
    set change to of change grep preferences to ""
    set applied character style of change grep preferences to nothing
tell specSheet
        set myFoundItems to find grep
        set linkURL to get myFoundItems
    end tell
    set find what of find grep preferences to "(?<= <linked text>).+?(?=</lt>)"
    tell specSheet
        set myFoundTextLinks to find grep
        set linkNames to get myFoundTextLinks
    end tell
    set masterList to {}
    set numItems to count of linkURL
    set n to 1
    repeat numItems times
        set end of masterList to {item n of linkURL, item n of linkNames}
        set n to (n + 1)
    end repeat
    tell specSheet
        repeat with currentLink in masterList
            set hyperLinklocation to item 2 of currentLink
try
                set hyperLink1 to make hyperlink URL destination with properties {name:item 2 of currentLink as string, destination URL:item 1 of currentLink as string}
            on error
                set hyperLink1 to hyperlink URL destination (item 2 of currentLink as string)
            end try
            try
                set hyperLinkText to make hyperlink text source with properties {source text:hyperLinklocation, hidden:false, applied character style:character style "hyperlink"} --name:item 2 of currentLink as string,
            on error
                set hyperLinkText to hyperlink text source (item 2 of currentLink as string)
            end try
            try
                make new hyperlink with properties {destination:hyperLink1, source:hyperLinkText, hidden:false} --name:item 2 of currentLink as string}
            on error
                make hyperlink with properties {destination:hyperLink1, source:hyperLinkText, hidden:false}
            end try
        end repeat
        --set linksDone to "true"
    end tell
    set myFoundItems to {}
    set myFoundTextLinks to {}
end tell
tell application "Adobe InDesign CS5"
    --REMOVE MARKUP -URLS FROM COPY
    set find grep preferences to nothing
    set change grep preferences to nothing
    --Set the find options.
    set include footnotes of find change grep options to false
    set include hidden layers of find change grep options to false
    set include locked layers for find of find change grep options to false
    set include locked stories for find of find change grep options to false
    set include master pages of find change grep options to true
    set find what of find grep preferences to "<url>.+?</url> "
    set change to of change grep preferences to ""
    tell specSheet
        change grep
    end tell
    --Clear the find/change preferences after the search.
    set find grep preferences to nothing
    set change grep preferences to nothing
    --display dialog "URL text deleted."
    --LINKED TEXT TAGS REMOVAL AND CHARACTER FORMAT
    set find grep preferences to nothing
    set change grep preferences to nothing
    --Set the find options.
    set include footnotes of find change grep options to false
    set include hidden layers of find change grep options to false
    set include locked layers for find of find change grep options to false
    set include locked stories for find of find change grep options to false
    set include master pages of find change grep options to true
    set find what of find grep preferences to "<linked text>|</lt>"
    set change to of change grep preferences to ""
    --set applied character style of change grep preferences to "hyperlink"
    tell specSheet
        change grep
    end tell
    --Clear the find/change preferences after the search.
    set find grep preferences to nothing
    set change grep preferences to nothing
    --display dialog "Linked text tags removed, style applied."
end tell

Similar Messages

  • Convert URL to Hyperlinks in Indesign

    Hyperlinks in 2-3 lines are clickable when exported to PDF
    I have many URL in the PDF, but the problem is the URL's that are in 1 line are clickable.
    The URLs that runs to 2-3 lines are not clickable. One the 1st line of the same URL is clickable.
    For example:
    https://developer.atlassian.com/display/DOCS/Set+Up+the+Eclipse+IDE+for+Linux
    On the page layout the same URL comes in 2 lines. Only the URL till https://developer.atlassian.com/display/DOCS/Set+Up is clickable, but the following URL is not clicable in PDF.
    Please assist me with this.

    Thanks Ellis for the sugesstion but we have to convert all the Hyperlinks Manually and its taking lot of time.
    I have found a Script from http://kasyan.ho.com.ua/make_hyperlinks_from_urls.html.
    But there is a little problem.
    When I run this script its converting the URL to Hyperlink, but its changing the original URL text present in the Indesign file.
    Can this script search for a specific URL character style and convert it to Hyperlink by retaining the Original text in Indesign.
    For Example:
    The Original URL in Indesign file is this:
    https://confluence.atlassian.com/display/JIRA/Connecting+JIRA+to+a+Database
    When I run the script its changed to:
    confluence.atlassian.com
    Please help me.

  • Preserving HTML links when converting Word docs

    I created a document in MS Word for Mac 2011 (ver 14.5.2)
    When I used Adobe Pro 11 to convert the document into pdf format, all the HTML links are lost. 
    I have tried converting from MS Word, opening the word version with Adobe Pro, printing from MS Word to pdf.  Nothing works. Even opened the MS Word document using Apple's Pages software, re-formatted and then converted to pdf.  Still no live links.
    Best work around so far is to convert and then use the edit feature in Adobe Pro to re-insert the HTML links as invisible rectangles on top of the still-blue-and- underlined text.  So to the user it looks like the html links are still live, but what a pain for editor.
    I have seen this issue raised in other posts, but none of the answers seem to work. And the work around described above is clearly less than ideal.
    Very curious, as reading other posts, the issue apparently does not arise when the word doc converted from a Wintel computer.  But I can't imagine Adobe writes software one way for Intel and another for Mac.

    Imagine it. this has been 15 year fued between Microsoft and Adobe.  Adobe Claims that Mac office doesn't hav ethe proper hooks for URLs. Microsoft says the fault is with adobe.
    Since a Word Created file will work when opened in the windows version  and saved as a PDF, the links work just fine. Just opening and not saving, but converted to Pdf does nothing to the actual Word File.
    They had it fixed last year  in Acrobat X if your dropped the file on to Acroabt directly. But broke it again with the upgrade to XI.
    IF you have iWork and Open the word file in Pages then exported as a Word.docx file then create The PDF the links will become active.  Also if you Open in OpenOffice and export as docx file the resulting PDF when open in Word and PDF is Created the links will become active.
    If you have neither you will have to open the PDF and add the links. Note the Links will be hot (active) but the links will not turn Blue and  be Underlined
    Mac Office2011 is a Conversion of Office2010/2007 code.  So there should be no pproblem.
    Also Don't use the Save As . . .  PDF Method. Instead go to Print Menu  click on PDF wait for context menu > the choos Adobe Quality PDF or Adobe PDF (uses Adobe's PDF engine).
    wait for next screen that shows qualtity leave as sent unles you need specific job options. click okay then next screen File name. Rename as necessary the browser to desired to location then click save.  Or you can drop the saved Word document (with Word quit.) on to Acrobat and after a minute or so the PDF will be created. (Using this method in AcrobatX would actully show URL s or Mailtos as active - They broke this in Acrobat XI PDF still can be created but hot links no longer work).
    Well it seems it does work on occasion  see: http://www.screencast.com/t/cib2kcYG

  • We are currently looking for a way to link images to a design file within programs like InDesign and Illustrator using an HTML link instead of a local file.  We are hosting our images in SharePoint and need the design file to retain it's links, no matter

    We are currently looking for a way to link images to a design file within programs like InDesign and Illustrator using an HTML link instead of a local file.  We are hosting our images in SharePoint and need the design file to retain it's links, no matter who on our network opens the design file.

    The Cloud forum is not about using individual programs
    The Cloud forum is about the Cloud as a delivery & install process
    If you will start at the Forums Index https://forums.adobe.com/welcome
    You will be able to select a forum for the specific Adobe product(s) you use
    Click the "down arrow" symbol on the right (where it says All communities) to open the drop down list and scroll

  • Convert Pages document to PDF and maintain html links accurately

    Hi - I am trying to convert a Pages document to pdf, simple right? go to Print / PDF / Save as pdf...
    I have also tried Print / Save as Postscript and Print / Open in PDF
    with the same results, which are...
    Pages dutifully converts to pdf, but on some pages where I have multiple links the formatting position of the links is all over the place on the page, some links are conflated on the page so it says one thing 'www.bbc.co.uk' for example but when you click that link it links to 'www.cnn.com' instead because CNN is the link a little further on in the line, or in the line of text above, or whole sections of the page (half of one page) become a link!
    I have checked the formatting positions and link lables over and over again in Pages and they are spot on, no confusion, no leaking in positional accuracy, it is only when converting to pdf or postscript
    I have many html links in my document so it is vital that the exact position of the formatted links in Pages is converted accurately.
    Any advice on
    a) using Pages Print command accurately? or
    b) third party apps (really dont want to go there)
    that might convert more accurately?
    many thanks

    Thank you Roger!
    I went back to 09 as suggested which identified the section in question as having a whole load of text that had become associated with one of the links - goodness knows how or why - but this wasn't apparent in the Pages 5 doc, nothing explicit signified that there was an issue with the formatting until converting to pdf
    It took me a while to strip it all out without losing all the other formatting! but done now and converting beautifully to pdf with complete accuracy in terms of formatting positions of linked text...
    I then reimported back into Pages 5 to see if I could make sense of it in the same way, long story short no chance, there is still background formatting in there, despite going through it line by line, character by character and removing all traces of any link through the 'right click' 'remove link' function - as soon as you convert to pdf lots of text becomes active again even though it is absolutely not visible in the Pages 5 doc
    Clearly, despite a strong desire to continue in 5 from a being uptodate perspective, I shall stick to the 09 world and wait for Apple to sort things out.
    If anyone from Apple is reading this, it has cost me approx 2 days of messing about to get to a point where I give up on 5 and return to 09. Please resolve as soon as possible!

  • I want to bring in text from Word (and the web) that is already hyperlinked into InDesign. How do I do it while keeping the links active?

    I want to bring in text from Word (and the web) that is already hyperlinked into InDesign. How do I do it while keeping the links active?
    Whenever I copy/paste from web or Word it removes the hyperlinks.  And when I try to do it by "Place"ing a Word document into my InDesign project it keeps the formatting with it, the rectangles around the text.
    I have the latest version of InDesign.
    Any help is appreciated. 

    Copy-and-paste may not include formatting. A regular import using Place is the best way.
    The rectangles around the hyperlinks are just to indicate they are links -- they do not print, but they do show up in your PDF.
    You can remove them by double-clicking the hyperlink in the Hyperlinks panel and select "Invisible Rectangle" as type.
    Typically, Word hyperlinks are formatted -- blue text, underline -- with a Character Style. If you want to remove or change the formatting, all you have to do is change the character style. My experience, though, is you must check all hyperlinks because for no apparent reason sometimes they appear in the document without the character style.

  • Regular Expression to convert URI to HTML link tag

    I'm trying to create a method that takes an input string and converts any URIs found in the string to a html link tag.
    For example,
    String input = "This is a test string.  I like http://www.sun.com/ and think you should check out http://java.sun.com/"; The output should contain an html a tag for each URI and use the URI as the text as well.
    I need this for a blogging web app i'm working on.
    I tried a few things like
    import java.util.regex.*;
    import java.text.*;
    public class test
         public static void main(String[] args)
              final Pattern p = Pattern.compile("(\\sI\\n|^)(\\w+://[^\\s\\n]+)");
            final Matcher m = p.matcher(args[0]);
              System.out.println(args[0]);
              args[0] = m.replaceAll( "$1<a href=\"$2\">$2</a>");
              System.out.println(args[0]);
    }Any ideas? Something like this will match "http://www.apple.com/" but not a complex string. I've googled this quite a bit and I'm not very good with regular expressions.

    Couldn't get your posted regex to work on anything. Try this:public static void main(String[] args) {
        String input = "This is a test string.  I like http://www.sun.com/ and think you should check out http://java.sun.com/";
        final Pattern p = Pattern.compile("(\\s|^)(\\w+://\\S+)(\\s|$)");
        final Matcher m = p.matcher(input);
        input = m.replaceAll("$1<a href=\"$2\">$2</a>$3");
        System.out.println(input);
    }It should match any uri, however I recommend replacing \\w+ with a more concrete string like (?:(?:http)|(?:https)|(?:ftp)). Let me know if you have a uri that it doesn't match.

  • How would you convert ToC links to cross references?

    Hello gang,
    InDesign CS6 can export to ePub, and can support the exporting of one ToC to ePub hyperlinks, but cannot support two. Is there a script or plug-in that you know of that can take a second or third selected ToC generated, and convert its links to cross-references, so that more than one ToC can result in an html-based link once we export to ePub?
    Many thanks for any pointers,
    Mike Witherell in Maryland

    Hi Ariel,
    Can you let me know if your script could be useful to me? Here's my situation:
    I have a ~250 page document with a lot of named cross references.
    I want to generate a formatted list at the end of the document of all these cross references, in the order they appear in the text, in a format like this:
    P<page no>, <name of reference>: Note about this cross reference.
    (where the <page no> and <name of reference> are drawn from the text anchor in the main text of the document, and the note about the reference is manually typed in to the reference list.)
    Any thoughts appreciated! I have a decent handle on Javascript in a web development context but haven't used it to script InDesign before.
    Thanks
    Pat

  • HTML link to bookmark in pdf file

    Hi everyone,
    I use the following suffix on an html link in order to link to a specific page within a pdf file:  #page=15  This works but I need to know go one step further and link to a specific bookmark within the pdf. I use the following suffix to try to do this:  #bookmark name  The above syntax doesn't work because the bookmarks all have spaces in their names. Apparently it's supposed to work if I remove the spaces from the bookmark names but this isn't practical because I'm generating the pdf out of Indesign and the bookmarks in the resulting pdf are just a reflection of the table of contents in Indesign. I can't remove the spaces from the TOC entries just so that there's no spaces in the bookmarks in the pdf.
    So I need some sort of workaround and wondered if anyone would have any suggestions. Is there some acrobat script or any other solution to this problem?
    Really appreciate any help.

    Try %20 instead of spaces. HTML links are URL-encoded, and this is the usual translation of a single space, as for example can be seen in links in Google.
    If it works, you can automatically convert the bookmark name to URL format with the function encodeURI ("Every non-alphanumeric character is encoded as a percent escape").

  • Table of Contents links and hyperlinks lose accuracy in FP past 5 pages?

    I've come up dry searching for any mention of this bug
    anywhere.
    We've got Word documents that have a table of contents (TOC
    created dynamically in word, using the standard "Heading" style
    method.) When we convert these to Flashpaper SWFs, about 50% of the
    TOC links don't work - they go sort of nearby spots in the
    document, but bring you to a spot off by half a page or more. The
    links to spots in the first 4-5 pages work ok, but TOC links that
    go deeper into the doc - from 5 to 20 pages in - those are off by a
    half page to a page. The working TOC links in Word or in PDF
    versions of the doc take you directly to the right spot.
    The "outline" option in flashpaper also fails - the outline
    links past 5 pages or so are innacurate just like the in-document
    links.
    According the the (scanty) documentation for Flashpaper,
    Heading/Outlines, etc. are supposed to work fine and get converted
    into the SWF.
    I've already tried creating fresh example files, to make sure
    it isn't a problem with sloppy Word formatting, extra Headings,
    etc. - no dice. I still get TOC and outline links that fail to work
    in many cases. They mostly fail for things that jump to spots after
    5-6 pages into the doc. But if I convert these same docs to PDFs,
    the PDF bookmarks and TOC links and hyperlinks work perfectly.
    We've also tried using Hyperlinks in Word to create "pretend"
    Table of Contents (not dynamic, but we're desperate), and we find
    that those hyperlinks that go past 5 or 6 pages into the 20 page
    doc lose their acuracy also - they are a half to a full page off.
    We already tried the method of saving the word docs as HTML
    then converting to FP(suggested within this board) but that did not
    improve things.
    Thanks in advance.
    - Chris

    We solved our issue. In our case we have Word 2007, but our
    client is still on Word 2003 so our Word document was originally
    created in Word 2007 and then converted by Word 2007 into the Word
    2003 format. It appears that we were having these problems because
    we were running Flashpaper on the coverted Word document. A
    document converted this way is internally different than a document
    created by the Word 2003 application.
    To fix the problem we downloaded the Word 2003 application,
    created a new Word 2003 document, copy and pasted the contents of
    the converted Word document into the document created on Word 2003,
    and then ran Flashpaper on the new Word 2003 document. Problem
    solved.

  • Generating html links from plain text

    How can I scan a text (a String) and add links when a word is an URL?
    I tried the following which works but it's too slow:
      String text = rs.getString("text");         
                    text2scan=text.split("[\n ]")
                    for(int i = 0; i < text2scan.length; i++){
                        String replacement = null;
                        String word = text2scan;
    log.info(word);
    if(word.indexOf(".com")!=-1){
    replacement="<a href=\""+word+"\">"+word+"</a>";
    text=text.replaceAll(word, replacement);
    text=text.replaceAll("www","http://www");
    text=text.replaceAll("http://http://","http://");
    text=text.replaceAll(">http://",">");
    Isn't this already implemented somewhere?
    Thanks
    Niklas

    Because I was semi interested by this issue, and how best to solve it, heres a quick and dirty example program.
    It does a very basic job, but should be pretty much equivalent to what you had originally.
    package mypackage;
    import java.io.BufferedReader;
    import java.io.BufferedWriter;
    import java.io.File;
    import java.io.FileReader;
    import java.io.FileWriter;
    import java.io.IOException;
    import java.io.PrintWriter;
    import java.io.StringReader;
    import java.io.StringWriter;
    import java.util.regex.Matcher;
    import java.util.regex.Pattern;
    public class RegexpMakeHyperlinks {
          * Loads a file into a StringBuffer
          * @param f File to read
          * @return StringBuffer with contents of text file.
          * @throws IOException
         public StringBuffer loadFile(File f) throws IOException {
            System.out.println("Reading file " + f.getAbsolutePath());
              BufferedReader in = new BufferedReader(new FileReader(f));
              StringWriter sw = new StringWriter();
              PrintWriter pw = new PrintWriter(new BufferedWriter(sw));
              String line = null;
              while ((line = in.readLine()) != null) {
                   pw.println(line);
              pw.flush();
              in.close();
              return sw.getBuffer();
          * Writes the contents of a StringBuffer to file
          * @param f File to write to
          * @param sb Text to write to file
          * @throws IOException
         public void writeToFile(File f, StringBuffer sb) throws IOException{
              System.out.println("Outputting to " + f.getAbsolutePath());
              BufferedReader in = new BufferedReader(new StringReader(sb.toString()));
              PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(f)));
              String line = null;
              while ((line = in.readLine()) != null) {
                   out.println(line);
              out.flush();
              in.close();     
          * Converts all urls like "www.google.com" into hyperlinks in the text.
          * @param initialText The text to convert
          * @return Converted text.
         public StringBuffer convertText(StringBuffer initialText) {
              StringBuffer result = new StringBuffer(initialText.length());          
              Pattern p = Pattern.compile("(href=\")?(http://)?www\\..*?.com\\b");
              Matcher m = p.matcher(initialText);
              while (m.find()) {
                   String href = m.group();
                   // ignore links that are already hyperlinks
                   if (href.startsWith("href")){
                        continue;
                   // add on the http:// if necessary
                   if (!href.startsWith("http://")) {
                        href = "http://" + href;
                   // add the new text into the output.
                   m.appendReplacement(result, "<a href=\"" + href + "\">" + href + "</a>");
              m.appendTail(result);
              return result;
          * Testing method for experimenting with the patternmatching
          * @param text
         public void matchLink(String text) {
              System.out.println("Analyzing text " + text);
              Pattern p = Pattern.compile("(http://)?www\\..*?.com\\b");
              Matcher m = p.matcher(text);
              while (m.find()) {
                   System.out.println("Found: " + m.group());
         public static void main(String[] args) {
              RegexpMakeHyperlinks hyper = new RegexpMakeHyperlinks();
              String[] testStrings = { "www.google.com", "www.myspace.net", "make sure you visit www.yahoo.com for details", "Two sites: http://www.java.com and http://www.javabeans.com" };
              for (int i = 0; i < testStrings.length; i++) {
                   hyper.matchLink(testStrings);               
              System.out.println();
              System.out.println("----------------------------");
    System.out.println();
    File inFile = new File("makeHyperlinkTest.txt");
    File outFile = new File("makeHyperlinkTest.output");
    try{
    StringBuffer sb = hyper.loadFile(inFile);
    StringBuffer result = hyper.convertText(sb);
    hyper.writeToFile(outFile, result);
    catch(Exception e){
         System.out.println("Error " + e.getMessage());
         e.printStackTrace(System.out);      
    And a test file makeHyperlinkTest.txt
    This file just contains plain text with hyperlinks to places like www.google.com and http://www.yahoo.com.
    The program I have written will convert these links like www.google.com into hyperlinks for displaying as html.
    Make sure you visit http://www.java.sun.com and read all about Java.
    And if I already have an <a href="www.google.com">Hyperlink</a> in this file it should leave it alone right?

  • How to convert html to pdf using acrobat sdk 8.0?

    hi
    I am a beginner of acrobat sdk .
    I want to know How to use acrobat sdk 8.0 to convert html to pdf?
    herere some questions :
    1:How to support navigation inside PDF file that generated using acrobat sdk 8.0? For example: theres catalog in the top of HTML file, customer hopes can navigate inside the PDF file just like navigating inside the HTML file.
    2:How to support operating some controls in the PDF file that generated using acrobat sdk 8.0? For example: therere some drop down list and text box in HTML file, customer hopes can input text in the text box, click the drop down list to see available options in it just like in HTML file.
    Thanks in advance for any help and suggestion.

    Hello,
    I want a system to re-brand my 37 pages PDF for affiliates.
    I want a php dynamic link in the PDF online in order to personalize automatically the PDF for each affiliate. I need to change 2 links each time. The affiliate ID and the Paypal email (payment button) in page 36.
    Can you help?
    Please let me know
    Thank you
    Alex
    PS My system is online and i can give you the url if it helps.

  • Hyperlinks from InDesign to Acrobat

    I am using CS3 programs on a PC on Windows XP
    I'm trying to create hyperlinks in InDesign. When I export the document to a pdf, I clicked "include interactive elements." However, in Acrobat, it only makes the email addresses or web addresses active. The regular sentences and images that I linked are not active. Any suggestions? Thank you.

    ah, I didn't notice the hyperlinks box as I was focusing on "interactive elements." Thanks!

  • Html:link not working in struts project driving me mad, please help...

    Afternoon all,
    Can anyone help me with an issue I'm having with my first struts project, I'm learning as I go.
    Anyway, I'm trying to create a bog standard hypertext link which passes a value back to a specified struts action. The flow of the application
    is as follows:
    1) search.jsp
    User enters a name and postcode to search on, then click submit
    2) searchAction
    Struts action 'search' is called and does the search in a back-end db.
    Each result found from search is created as a javabean (named resultsBean), and added to a list object. The list object is set as a request
    attribute named 'SearchResults'.
    The action is then forwarded on to another jsp page named results.jsp
    3) results.jsp
    The results.jsp page retrieves the list object from the 'SearchResults' attribute and loops through each entry
    in the list and converts each entry to the 'resultsBean' javabean object.
    Each resultsBean object has a getVirtualID method which stores a string value. This value is retrieved and a hypertext link is created which
    passes this value on to another struts action named 'select'.
    When this link is clicked on, the select struts action is called and the value passed as a parameter is retrieved.
    This is the part I can't get to work, I can't get the link to render properly. When I click the link the select action retrieves
    & lt;%= resultsBean.getVirtualID() & gt; as the value of the parameter 'vid' instead of the value stored in the getVirtualID method of the resultsBean.
    Listed below is the code from my results.jsp page. If anyone can help me get this to work I would be very grateful.
    Thanks in advance,
    Alex
    results.jsp code
    <%
       List searchResults = (List)portletRequest.getPortletSession().getAttribute("SearchResults");
    %>
    <div id="table_layout" style="width: 713px; margin: 0px 0px 0px 3px;">
      <div id="row">
        <div id="column"><img src='<%= response.encodeURL("/images/results.gif") %>' alt="" width="223" height="159" border="0" /></div>
         <div id="column" style="width: 30px;"></div>
         <div id="column">
          <div id="table_layout" style="width: 460px;">
            <div id="row" style="width: 430px; border-bottom: 1px solid #4e137d;">
              <div id="column" style="width: 155px;">Name</div>
              <div id="column" style="width: 10px;"> </div>
              <div id="column" style="width: 130px;">Address</div>
              <div id="column" style="width: 10px;"> </div>
              <div id="column" align="right" style="width: 120px;">References</div>
            </div>
    <% if (searchResults.size() > 0) {
           Iterator it = searchResults.subList(0, searchResults.size()).iterator();
           ResultsBean resultsBean = new ResultsBean();
           while (it.hasNext()) {
                resultsBean = (ResultsBean)it.next(); %>
            <div id="row" style="padding: 5px 0px 10px 0px;">
              <div id="column" style="width: 155px;"><html:link styleClass="results"  page="/select.do?vid='<%= resultsBean.getVirtualId() %>'" title="<%= resultsBean.getFullName() %>"><%= resultsBean.getFullName() %></html:link></div>
              <div id="column" style="width: 10px;"></div>
              <div id="column" style="width: 130px;"><%= resultsBean.getFullAddress() %></div>
              <div id="column" style="width: 10px;"></div>
              <div id="column" align="right" style="width: 120px;"><%= resultsBean.getReferenceIcons(portletResponse) %></div>
              <div id="column" style="width: 13px;"></div>
              <div id="column" style="width: 22px;"><input id="<%= resultsBean.getVirtualId() %>" name="ckbox" type="checkbox" value="" title="tick to select for merging" style="border: 0px solid #ffffff;"></div>
            </div>
    <%     }
       } %>
           </div>
         </div>
      </div>
    </div>
    <br />
    <br />
    <html:link forward="/searchpage">Return to search page</html:link>

    If you have part of an attribute dynamic, you need to make the entire attribute an expression.
    ie instead of
    page="/select.do?vid='<%= resultsBean.getVirtualId() %>'"
    it has to be
    page="<%= "/select.do?vid=" + resultsBean.getVirtualID() %>"
    However for my approach, I would aim for zero scriptlets, and use the struts tags even more. For instance instead of an iterator, use the struts logic:iterate tag (or the JSTL c:forEach>
    Also instead of div tags, I would use html table tags - <table> <tr><td> etc etc. Thats what its for right?
    Here is at least some of it rewritten with struts tags.
    I left out the div tags so I could focus on the "important" stuff.
    <logic:iterate id="resultsBean" name="SearchResults">
      <html:link styleClass="results"  page="/select.do" paramId="vid" paramName = "resultsBean" paramProperty="virtualId">
        <bean:write name="resultsBean" property="fullName"/>
      </html:link>
      <bean:write name="resultsBean" property="fullAddress"/>
    <%= resultsBean.getReferenceIcons(portletResponse) %>
    <input id="<%= resultsBean.getVirtualId() %>" name="ckbox" type="checkbox" value="" title="tick to select for merging" style="border: 0px solid #ffffff;">
    </logic:iterate>I'm not entirely certain what you are doing with that checkbox at the end. They all have the same name, but no value. You couldn't identify at the server end which one was clicked.
    Hope this helps some,
    evnafets

  • How to include HTML link in BI Publisher Report?

    Hi,
    I am trying to include an HTML link in a BI Publisher report. But I get the HTML Code, not the link.
    I have put this in the Data Set SQL Query:
    select id_constancia, rfc, apellido_paterno, apellido_materno, nombre, e_mail_empleado,
    'a href="http://dbxserver.dbxprts.com:7778/pls/apex/f?p=134:1:::NO::P1_ID_CONSTANCIA:'||ID_CONSTANCIA||'">CITA</a ' as liga_cita
    from geiq_constancias
    where entregada = '0' and sust_rh = '0'
    And I have included the field LIGA_CITA in the rtf template,
    But I get this in the HTML output:
    =======
    Please clic on the link below to log into the system:
    a href="http://dbxserver.dbxprts.com:7778/pls/apex/f?p=134:1:::NO::P1_ID_CONSTANCIA:1183">CITA</a
    =========
    (I removed the beginning and ending '<''>' to prevent the text to be shown as a link)
    I have put the property "Make HTML output accessible" to TRUE in the report configuration, but nothing changes.
    Does anyone know how to make this work?
    Thanks.
    Francisco

    Hi Francisco,
    Note:
    your xml should only have
    <URL>http://dbxserver.dbxprts.com:7778/pls/apex/f?p=134:1:::NO::P1_ID_CONSTANCIA:1183</URL>
    Show me your sample XML , i can help you.
    What is your expected output ? PDF or HTML ?
    here it is.
    option1:
    If the XML data includes an element that contains a hyperlink , then you can use that element to create dynamic hyperlinks at runtime.
    a. insert hyperlink from word menu
    b. In the Type the file or Web page name field of the Insert Hyperlink dialog box, enter the following syntax:
    c. {ELEMENT_NAME_WHICH_HAS_URL_LINK}
    where ELEMENT_NAME_WHICH_HAS_URL_LINK is the xml data element name
    option2:
    create a form field, you can add it
    <fo:basic-link external-destination="http://www.google..com">
    <fo:inline text-decoration="underline">google Link</fo:inline>
    </fo:basic-link>
    or
    <fo:basic-link external-destination="{ELEMENT_NAME}">
    <fo:inline text-decoration="underline">google Link</fo:inline>
    </fo:basic-link>
    or
    <fo:basic-link>
    <xsl:attribute name="external-destination"><xsl:value-of select="ELEMENT_URL"/>
    </xsl:attribute>
           <xsl:value-of select="LINK_NAME"/>
    </fo:basic-link>

Maybe you are looking for