[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Passing HTML from bean to JSP HTMLB TableView

Posted on 2004-08-02
8
Medium Priority
?
726 Views
Last Modified: 2010-08-05
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                  
                  
0
Comment
Question by:natG
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 35

Expert Comment

by:TimYates
ID: 11695372
is that java code, or jsp code?

Can you give us a bit more?
0
 

Author Comment

by:natG
ID: 11695453
That is the java code. It loads the array with data (including this column) and passes it to an HTMLB tableview. In the JSP there isn't direct interaction with the content itself, just the tableview tags. Here is the jsp code:

        <hbj:tableView  id="DefTable"
                          model= "MyCompHistBean.model"
                          design = "ALTERNATING"
                          headerText="<b><center>def table Compensation History</center></b>"
                          headerVisible="true"
                          fillUpEmptyRows = "true"
                          footerVisible = "true"                        
                          navigationMode = "BYLINE"                        
                          onNavigate = "onNavigation_CHTable"
                          visibleFirstRow = "<%= MyCompHistBean.getVisibleRowCHTable() %>"
                          visibleRowCount = "3"
                          selectionMode = "SINGLESELECT"
                          >      
          </hbj:tableView>

Here is a more complete snippet of the java (bean) code. Most of this is not relevent to the problem I'm having but it may give you a better sense of what I'm doing:

public void createDisplayTable()
{
 Object[] columns = null;
 Object[][] data = null;

 int numRows = comphisdataModel.getRowCount();
 int numCols = comphisdataModel.getColumnCount();
 boolean detailsExist = false;
 
//            System.out.println(numRows+ " rows.");
//            System.out.println(numCols+ " columns.");
//                        
 columns = new String[numCols+1];// extra column for details link
 data = new String[numRows][numCols+1];
 
 for (int thisCol=0; thisCol<numCols; thisCol++)
 {      
  columns[thisCol] = comphisdataModel.getColumnName(thisCol+1);
 }
 columns[numCols]="";
 
 for (int thisRow=0; thisRow<numRows; thisRow++)
 {
  int jcoCol=1;//the actual col in the jco table, since we are skipping some
  for (int thisCol=0; thisCol<=numCols; thisCol++)// using <= b/c need 1 col more than in jco table
   {      
    if(thisCol==1) jcoCol++;// skip ENDDA column
 

   if (thisCol==0)//while on 1st column look for matching rows in the details table
   {
    //System.out.println("check for DETAILS LOOP");
    for (int a=0; a < detailsModel.getRowCount(); a++)
    {
     //BEGDA is in Column 8 of details table - should use const or find dynamically
        if (detailsModel.getValueAt(a+1, 8).toString().trim().equals
        (comphisdataModel.getValueAt(thisRow+1, jcoCol).toString().trim()))
      {// match for BEGDA on details table exists
       detailsExist = true;
      }
     }
   }
   if ((thisCol == numCols) && (detailsExist == true))
   {
    data[thisRow][thisCol] = "<b>Details...</b>";
   }
   else if (thisCol == numCols) data[thisRow][thisCol] = "";
   else data[thisRow][thisCol] = comphisdataModel.getValueAt(thisRow+1, jcoCol).toString();                        
   
 
   if (thisCol<numCols) jcoCol++;//advance jcoCol - must occur at end of the loop
  }
  detailsExist = false; //reset for next row
 
 }
 
 model = new DefaultTableViewModel(data, columns);
 setModel(model);
 
}

Hope this gives a better picture. Thanks for the quick response.
0
 

Accepted Solution

by:
natG earned 0 total points
ID: 11696351
Well, I found  asolution myself.

For anyone who's interested, there is a command that apparently instructs the JSP not to encode the info being passed. First I found the column in the TVM and then set encode to false:

            TableColumn myColumn = model.getColumnAt(6);
            myColumn.setEncode(false);

That did the trick. Thanks to anyone/everyone who was looking into this for me.

NatG
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:natG
ID: 11696358
.
0
 
LVL 37

Expert Comment

by:zzynx
ID: 11697629
>> Well, I found a solution myself
In that case, you better request for a delete of this Q with a refund of the points.

Here's how:
Post a zero-point question in http://www.experts-exchange.com/Community_Support/

Subject: Please Delete with Refund
Body: Please delete this question:
http://www.experts-exchange.com/Programming/Programming_Languages/Java/Q_21079350.html
0
 

Author Comment

by:natG
ID: 11698977
thanks zzynx
0
 
LVL 37

Expert Comment

by:zzynx
ID: 11699038
You're welcome
0
 

Expert Comment

by:RomMod
ID: 11699382
Asker resolved - the 125 points have been refunded and the question PAQ'd.

RomMod
Community Support Moderator
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
This video teaches viewers about errors in exception handling.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses

656 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