Hi,
I have a requirement where i need to read a set a value to a custom tag property by reading its value from a .properties file. When i read the value and display, it works fine, but when i assign it to custom tag property it gives me error.
Here is the code for application.properties file:
# For Sample Database
SampleDBName = genSQLServer
SampleDBUrl =
jdbc:microsoft:sqlserver://SampleDB;DatabaseName=Sample
SampleDBUserName = prakash
SampleDBPassword = prakash123
JSP code:
<% Properties p = new Properties(); %>
<% p.load(new FileInputStream(new File("C:\\tomcat\\webapps\\sampleapplication
application.properties"))); %>
<SampleApplication:useSQLDataSource
name = "genSQLServer"
driver = "com.microsoft.jdbc.sqlserver.SQLServerDriver"
url = "<%=p.getProperty("SampleDBUrl ") %>"
username = �<%=p.getProperty("SampleDBUserName ") %>�
password = �<%=p.getProperty("SampleDBPassword ") %>�
remove = "true"/>
When i use the above code it throws an Exception "No suitable driver".
But when i use the following code it works fine:
<SampleApplication:useSQLDataSource
name = "genSQLServer"
driver = "com.microsoft.jdbc.sqlserver.SQLServerDriver"
url = "jdbc:microsoft:sqlserver://SampleDB;DatabaseName=Sample"
username = "prakash"
password = "prakash123"
remove = "true"/>
And more over when i print the "SampleDBUrl " property value in the JSP using <%=p.getProperty("SampleDBUrl ") %>, it print the correct value, only problem occurs is when i assign it in the custom tag property.
Please help me in resolving this issue.
Thanks and Regards.