Hallo Leute,
ich muss Graph.jsp programmieren, deswegen versuche ich mich mit index.jsp auseinanderzusetzen
da ant und tomcat Verständnis nicht meine Stärke ist, komme ich nicht voran.
also mit brew install ant habe ich ant inhaliert und befindet im Ordner /usr/local/Cellar/ant/1.9.4
in eclipse habe ich ein Projekt für die uni und in dem Projekt unter tools ant habe ich apache-ant-1.7.0 und unter tools tomcat habe ich apache-tomcat-6.6.16, aber unter eclipse Servers habe ich diese Uniprojekt zu version tomcat 7. für bessere Verständnis habe ich Bilder im Anhang
Könnt ihr mir dabei helfen?
index.jsp
<%@ page import="java.util.*" %>
<%@ page import="java.io.*" %>
<%@ page import="java.net.*" %>
<%@ page import="itm.image.*" %>
<%@ page import="itm.model.*" %>
<%@ page import="itm.util.*" %>
<html>
<head>
</head>
<body>
<h1>Welcome to the ITM media library</h1>
<a href="infovis.jsp">infovis</a>
<%
// get the file paths - this is NOT good style (resources should be loaded via inputstreams...)
// we use it here for the sake of simplicity.
String basePath = getServletConfig().getServletContext().getRealPath( "media" );
if ( basePath == null )
throw new NullPointerException( "could not determine base path of media directory! please set manually in JSP file!" );
File base = new File( basePath );
File imageDir = new File( basePath, "img");
File audioDir = new File( basePath, "audio");
File videoDir = new File( basePath, "video");
File metadataDir = new File( basePath, "md");
MediaFactory.init( imageDir, audioDir, videoDir, metadataDir );
// get all media objects
ArrayList<AbstractMedia> media = MediaFactory.getMedia();
int c=0; // counter for rowbreak after 3 thumbnails.
// iterate over all available media objects
for ( AbstractMedia medium : media ) {
c++;
%>
<div style="width:300px;height:300px;padding:10px;float:left;">
<%
// handle images
if ( medium instanceof ImageMedia ) {
// ***************************************************************
// Fill in your code here!
// ***************************************************************
// show the histogram of the image on mouse-over
// display image thumbnail and metadata
ImageMedia img = (ImageMedia) medium;
%>
<div style="width:200px;height:200px;padding:10px;">
<a href="media/img/<%= img.getInstance().getName()%>">
<img src="media/md/<%= img.getInstance().getName() %>.thumb.png" border="0"/>
</a>
</div>
<div>
Name: <%= img.getName() %><br/>
Dimensions: <%= img.getWidth() %>x<%= img.getHeight() %>px<br/>
Tags: <% for ( String t : img.getTags() ) { %><a href="tags.jsp?tag=<%= t %>"><%= t %></a> <% } %><br/>
</div>
<%
} else
if ( medium instanceof AudioMedia ) {
// display audio thumbnail and metadata
AudioMedia audio = (AudioMedia) medium;
%>
<div style="width:200px;height:200px;padding:10px;">
<br/><br/><br/><br/>
<embed src="media/md/<%= audio.getInstance().getName() %>.wav" autostart="false" width="150" height="30" />
<br/>
<a href="media/audio/<%= audio.getInstance().getName()%>">
Download <%= audio.getInstance().getName()%>
</a>
</div>
<div>
Name: <%= audio.getName() %><br/>
Duration: <%= audio.getDuration() %><br/>
Tags: <% for ( String t : audio.getTags() ) { %><a href="tags.jsp?tag=<%= t %>"><%= t %></a> <% } %><br/>
</div>
<%
} else
if ( medium instanceof VideoMedia ) {
// handle videos thumbnail and metadata...
VideoMedia video = (VideoMedia) medium;
%>
<div style="width:200px;height:200px;padding:10px;">
<a href="media/video/<%= video.getInstance().getName()%>">
<object width="200" height="200">
<param name="movie" value="media/md/<%= video.getInstance().getName() %>_thumb.swf">
<embed src="media/md/<%= video.getInstance().getName() %>_thumb.swf" width="200" height="200">
</embed>
</object>
</a>
</div>
<div>
Name: <a href="media/video/<%= video.getInstance().getName()%>"><%= video.getName() %></a><br/>
Tags: <% for ( String t : video.getTags() ) { %><a href="tags.jsp?tag=<%= t %>"><%= t %></a> <% } %><br/>
</div>
<%
} else {
}
%>
</div>
<%
if ( c % 3 == 0 ) {
%>
<div style="clear:left"/>
<%
}
} // for
%>
</body>
</html>
graph.jsp
<%@ page import="java.io.*" %>
<%@ page import="java.net.*" %>
<%@ page import="itm.image.*" %>
<%@ page import="itm.model.*" %>
<%@ page import="itm.util.*" %>
<graphml xmlns="http://graphml.graphdrawing.org/xmlns"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns
http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd">
<graph id="G" edgedefault="undirected">
<key id="name" for="node" attr.name="name" attr.type="string"/>
<key id="url" for="node" attr.name="url" attr.type="string"/>
<key id="type" for="node" attr.name="type" attr.type="string"/>
<node id="n0">
<data key="type">concept</data>
<data key="name">Tags</data>
<data key="url">http://localhost:8080/itm/</data>
</node>
<%
// get all media objects
ArrayList<AbstractMedia> media = MediaFactory.getMedia();
// List for storing tag-nodes
Hashtable<String,String> tagNodes = new Hashtable<String,String>();
// ***************************************************************
// Fill in your code here!
// ***************************************************************
// iterate over all available media objects
int c=2;
for ( AbstractMedia medium : media ) {
c++;
if ( medium instanceof ImageMedia ) {
} else
if ( medium instanceof AudioMedia ) {
} else
if ( medium instanceof VideoMedia ) {
}
// create tag nodes (and respective edges) if not existing
}
%>
</graph>
</graphml>```