package example;
import com.opensymphony.xwork2.ActionSupport;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
public class Acceuil extends ActionSupport
{
public static String description;
public static String logo;
private String nomDocument;
private String descriptionDocument;
private String logoEntreprise;
public String titre = null;
public void setNomDocument(String nomDocument)
{
this.nomDocument=nomDocument;
}
public String getNomDocument()
{
return nomDocument;
}
public void setDescriptionDocument(String descriptionDocument)
{
this.descriptionDocument=descriptionDocument;
}
public String getDescriptionDocument()
{
return descriptionDocument;
}
public void setLogoEntreprise(String logoEntreprise)
{
this.logoEntreprise=logoEntreprise;
}
public String getLogoEntreprise()
{
return logoEntreprise;
}
public String execute() throws Exception
{
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
String connectionString= null;
try
{
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
try
{
connectionString ="jdbc:sqlserver://CSS;database=Bilan Prospectif;user=wael;password=09111985";}
catch (Exception e)
{
System.out.println(e.getMessage());
e.printStackTrace();
}
conn = DriverManager.getConnection(connectionString);
stmt = conn.createStatement();
rs = stmt.executeQuery("SELECT DESIGNATION_CAPITAL FROM CAPITAL where ID_CAPITAL=11");
while (rs.next())
{
titre=((rs.getString("DESIGNATION_CAPITAL")));
}
}
catch (Exception e)
{
System.out.println(e.getMessage());
e.printStackTrace();
}
this.setNomDocument(titre);
return SUCCESS;
}
/*public static void main (String arg[])
{
Acceuil a=new Acceuil();
try {
a.execute();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.print(a.getNomDocument());
}*/
}
Partager