e quindi le pagine ho dovuto lavorare a "caldo" e che poi mi trovo visibile via http si trovano in quel path.
.\tomcat\webapps\NOME_APP\WEB-INF\eclipse\plugins\webpath.InfoView\web
modificando la pagina custom.jsp le modifiche sono visibili via web ma poi la parte di codice che ho inserito nella pagina per la connessione è questa :
<%
String src_appName = request.getParameter("NOMETABELLA");
String table_name = "NOMETABELLA";
java.sql.Connection con = null;
java.sql.Statement stmt = null;
java.sql.ResultSet rs = null;
java.text.DateFormat dateFormat = new java.text.SimpleDateFormat("dd-MM-yyyy HH:mm:ss");
//String connect to SQL server
String url = "jdbc:sqlserver://NOMESERVER\\BI:61146;DatabaseName=NOMEDB;";
try
{
//Loading the driver...
Class.forName( "com.microsoft.sqlserver.jdbc.SQLServerDriver" );
}
catch( java.lang.ClassNotFoundException e )
{
out.print(e);
}
try
{
//Buiding a Connection
con = java.sql.DriverManager.getConnection(url, "user", "pwd");
stmt = con.createStatement();
// Create and execute an SQL statement that returns the news ordered
String SQL = "SELECT * " +
" FROM dbo." + "NOMETABELLA" + " " +
" WHERE " +
" GETDATE() >= DATESTART AND " +
" GETDATE() <= DATEFINISH " +
" ORDER BY " +
" DATESTART desc";
rs = stmt.executeQuery(SQL);
// Iterate through the data in the result set and display it.
boolean hasNews = false;
while (rs.next()) {
hasNews = true;
out.print( "<li><div class='" );
// if it's an important news we put the correct style
if ( rs.getString(6).equals("Y") == true )
{
out.print( "boldNewsImportant");
} else {
out.print( "boldNews");
}
out.print ( "'>");
if ( rs.getString(6).equals("Y") == true || rs.getString(5).equals("Y") == true)
{
out.print( " <input type='image' src='./images/Button-Warning-icon.png' ");
// insert the alert to show if need
if ( rs.getString(5).equals("Y") == true )
{
out.print( " onload='showAlert(" +
"\"" + dateFormat.format(rs.getTimestamp(1)) + "\"," +
"\"" + rs.getString(3).replace("'", ":QUOTE:") + "\"," +
"\"" + rs.getString(4).replace("'", ":QUOTE:") + "\"" +
")' ");
}
out.print( "> ");
}
// print the title of the news
out.print( rs.getString(3) + "</div></li>");
// print the date
out.print( "<div class='boldDate'>" + dateFormat.format(rs.getTimestamp(1)) + " </div>" );
// print the text of the news
out.print( "<div> " + rs.getString(4) + " </div>");
out.print( "<br />");
}
if ( hasNews == false )
{
out.print( "<p align='center'><div class='boldNewsImportant'> Nothing new </div></p>");
}
}
catch( java.sql.SQLException e )
{
out.print(e);
}
finally
{
if (rs != null) try { rs.close(); } catch(Exception e) {}
if (stmt != null) try { stmt.close(); } catch(Exception e) {}
if (con != null) try { con.close(); } catch(Exception e) {}
}
%>

Rispondi quotando
