Skip to Content
avatar image
Former Member

Passing HTML code from bean to JSP for a dynamic link

Hello,

I am building an HTMLB Default TableView with a 2 dim array using data from a SAP Jco TableView and adding a column to display a link to a popup with details (if available) for each row. I am trying to store the HTML code in this column and then pass it to the JSP via the TableView. SO, I need some way to tell the JSP to evaluate the html. Here is some code:

if ((thisCol == numCols) && (detailsExist == true))

{

data[thisRow][thisCol] = "<a href='somelink here'>Details...</a>";

}

else if (thisCol == numCols) data[thisRow][thisCol] = "";

else data[thisRow][thisCol] = comphisdataModel.getValueAt(thisRow+1, jcoCol).toString();

I actually tried this first with <b> tags just to see if it works and it won't. Obviously I will need something more than just passing the tags right through-- I tried &lt and &gt but whatever I do it always displays just like it's written.

Hope this is clear.

Thank you,

NatG

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • Aug 04, 2004 at 04:01 PM

    If you are using a tableview then you can change a column type to be a link

    tvModel.getColumn("<column name>").setType(TableColumnType.LINK);

    D

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 17, 2004 at 06:41 PM

    Actually, I solved the problem with these statements:

    TableColumn myColumn = model.getColumnAt(6);

    myColumn.setEncode(false);

    Evidently setEncode(false) is what did the trick here.

    Hope this helps anyone else out there with a similar challenge.

    Add comment
    10|10000 characters needed characters exceeded