Archive for the 'tomcat' Category

tomcat - struts datasource - mysql

I was configuring struts DS to connect to mysql today morning. i got failed day be4 yesterday, it ended with some classnot found exception. ooops! i noted tday, there was some error in the webpage i read. here is the details.

mydb name: shiksha
u/n: root
pwd: mysql

here is the datasource part of my struts-config.xml

<>
< type="org.apache.tomcat.dbcp.dbcp.BasicDataSource">
< property="driverClassName" value="com.mysql.jdbc.Driver">
< property="url" value="jdbc:mysql://localhost:3306/shiksha">
< property="username" value="root">
< property="password" value="mysql">
< property="maxActive" value="10">
< property="maxWait" value="5000">
< property="defaultAutoCommit" value="false">
< property="defaultReadOnly" value="false">
< property="validationQuery" value="SELECT COUNT(*) FROM test">
< /data-source>
< /data-sources>

and my action mapping goes like this

< path="/DataSource" type="org.shiksha.TestDB">
< name="success" path="/pages/Welcome.jsp">
< /action>

when i hit
http://localhost/shiksha/DataSource.do

I got the following in the trace

******************************************
********Out Put from TestDataSource ******
User Name is: rajesh
User Name is: george
User Name is: prakash
******************************************

Enjoy buddy, have a nice day.

help: http://forum.java.sun.com/thread.jspa?threadID=528490&messageID=2974589

JSP, Filter and Forward

Filters generally applied to corresponding requests. But when the request is forwarded from one servlet to another source, that will not be processed with Filter. (I checked with Tomcat 4.1). We need to add some more parameters with Filter mapping as noted below.

<filter-mapping> <filter-name>VJFilterTest</filter-name> <!–<servlet-name>VJServlet</servlet-name>–> <url-pattern>/servlet/MyTest</url-pattern> <dispatcher>REQUEST</dispatcher> <dispatcher>FORWARD</dispatcher> </filter-mapping> ————————————————— *Free* software is a matter of liberty not price. You should think of “free” as in “free speech”.

« Previous Page