Reputation: 4155
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>
Upvotes: 0
Views: 832
Reputation: 36
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>
Upvotes: 2