0

I have an XML file which stores content which is displayed using a Java Hashtable contained in a JSP Page (Its currently useing scriplets which I now know are bad practice)

As the amount of XML content has increased I need to start displaying this in batches of e.g. 5 <sliceContent> divs and then give the user the option of clicking next. I have the "Next" div at the end. I will of course also have to add a 'previous' option.

I am not sure what i am looking for, i have found a few posts such as this post but i cant really follow. Can this be done by CSS alone or do i need to implement it in Java?

Thanks again for any suggestions.

EDIT I have retagged this with CSS and Javascript as i have been told this is what i need.

My XML (content can extend to several paragraphs)

<slice><sliceContent> Content element 1 </sliceContent></slice>
<slice><sliceContent> Content element 2 </sliceContent></slice>
<slice><sliceContent> Content element 3 </sliceContent></slice>

My Java (contained in a JSP page)

<div class='result-container'>
<ul class="menu menu-style">
 <li>
    <a href="javascript:;">Concept for <%=keywords%></a>
            <ul xmlns:sparql-results="http://www.w3.org/2005/sparql-results#" class="menu menu-style">      
      <li>
        <a href="javascript:;">
            <span>Show Concept</span>
        </a>
<ul class="wer">
<%

    String testContent = contentPara;
    String startTag = "sliceXML\">"; 
    String endTag = "<";
    String xmlMatch = null; 
    String hashMatch = null;        

    int startPosition = testContent.indexOf(startTag);              
    if(startPosition >1)
    {               
        int subStringIndex = startPosition + startTag.length(); 
        int endPosition = testContent.indexOf(endTag, subStringIndex);      
        if(endPosition >= startPosition)
        {
            xmlMatch = testContent.substring(subStringIndex, endPosition);
        }   

        if(xmlMatch == null)
        {
        out.println("No concept matches for your query!" );     
        }
        else
        {

Hashtable<String, String> table = new Hashtable<String, String>();
(hash table links here)

        try{    
            FileInputStream fstream = new FileInputStream(table.get(xmlMatch));                 

            // Get the object of DataInputStream
            DataInputStream in = new DataInputStream(fstream);
            BufferedReader br = new BufferedReader(new InputStreamReader(in));
            String strLine;

        //Read File Line By Line
            while ((strLine = br.readLine()) != null)   
            {
                out.println (strLine);
            }               

        //Close the input stream
            in.close();
        }
            catch (Exception e)
            {
                //Catch exception if any
                System.err.println("Error: " + e.getMessage());
            }
        }

   }
      <li>
      <div class="next-div">
      <a class="next">Next<img height="10px" src="images/more.png" />
      </a>
    </div>
  </li>
  </ul>
  </li>
  </li>
  </ul>

  </div>
4
  • you need css and javascript. this isn't related to java and jsp Commented Oct 8, 2012 at 14:57
  • Thanks gigadot, ill edit and retag the Question. You have also given me a place to start looking. Commented Oct 8, 2012 at 14:58
  • you will need something like this, akrabat.com/dynamic-javascript-tabs or my-html-codes.com/javascript-tabs-html-5-css3 Commented Oct 8, 2012 at 14:59
  • 1
    You are correct, i copy and pasted the first to make the second just adding the "/" ill change that now. Thanks Commented Oct 8, 2012 at 15:11

1 Answer 1

2

You can do this with javascript:

<script type="text/javascript" language="JavaScript">
function showContent(){
document.getElementById('showContent').innerHTML = "Here is the text we want to show";
}
</script>

HTML:

<a href="#" onclick="showContent()">showContent</a>
<div id="showContent"></div>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.