<resource-ref> <description>MySQL Datasource example</description> <res-ref-name>jdbc/MyDB</res-ref-name> <res-type>javax.sql.DataSource</res-type> <res-auth>Container</res-auth> </resource-ref>
时间: 2023-03-31 20:02:36 浏览: 73
这是一个在 Java web 应用程序中配置 MySQL 数据源的示例。其中,<res-ref-name> 指定了数据源的 JNDI 名称,<res-type> 指定了数据源的类型为 javax.sql.DataSource,<res-auth> 指定了容器管理该数据源的认证方式。
相关问题
<ng-container>有固定列 的效果吗
<ng-container>本身不是一个可见的HTML元素,而是一个容器,可以用来包含其他HTML元素或指令。因此,<ng-container>本身不会产生固定列的效果。
要实现固定列的效果,可以使用CSS样式或Angular Material中的表格组件。例如,在Angular Material中,可以使用<mat-table>组件,并通过指定<ng-container matColumnDef>来定义列,并使用CSS样式将其固定在表格的左侧或右侧。例如:
```html
<mat-table [dataSource]="dataSource">
<!-- define columns -->
<ng-container matColumnDef="id">
<mat-header-cell *matHeaderCellDef> ID </mat-header-cell>
<mat-cell *matCellDef="let element"> {{element.id}} </mat-cell>
</ng-container>
<ng-container matColumnDef="name">
<mat-header-cell *matHeaderCellDef> Name </mat-header-cell>
<mat-cell *matCellDef="let element"> {{element.name}} </mat-cell>
</ng-container>
<!-- fixed column using CSS -->
<ng-container matColumnDef="fixed" class="fixed-column">
<mat-header-cell *matHeaderCellDef> Fixed Column </mat-header-cell>
<mat-cell *matCellDef="let element"> {{element.fixed}} </mat-cell>
</ng-container>
<!-- define table rows -->
<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
<mat-row *matRowDef="let row; columns: displayedColumns;"></mat-row>
</mat-table>
<!-- CSS style for fixed column -->
<style>
.fixed-column {
position: sticky;
left: 0;
z-index: 1;
background-color: white;
}
</style>
```
在上面的示例中,我们使用<ng-container matColumnDef="fixed">来定义一个固定列,并使用CSS样式将其固定在表格的左侧。要在右侧固定列,可以将CSS样式中的left属性改为right即可。
那如果我使用的是com.mchange.v2.c3p0.ComboPooledDataSource,又该怎么写,是不是我的struts.xml文件不对导致了只读,还是用这个类就只能只读呢,这是struts.xml<context-param> <param-name>contextConfigLocation </param-name> <param-value>/WEB-INF/applicationContext.xml</param-value> </context-param> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <display-name>Struts2</display-name> <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> <filter> <filter-name>struts2</filter-name> <filter-class> <!--2.5版本的写法 --> org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter </filter-class> </filter> <filter> <filter-name>openSessionInViewFilter</filter-name> <filter-class>org.springframework.orm.hibernate5.support.OpenSessionInViewFilter</filter-class> <init-param> <param-name>flushMode</param-name> <param-value>AUTO</param-value> </init-param> <init-param><param-name>OpenSessionInViewFilter</param-name> <param-value>/*</param-value></init-param> </filter> <filter-mapping> <filter-name>struts2</filter-name> <url-pattern>/* </url-pattern> </filter-mapping>
如果您使用的是com.mchange.v2.c3p0.ComboPooledDataSource,则需要在配置文件中指定连接池的读写属性。您可以参考以下示例代码:
```
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
destroy-method="close">
<property name="driverClass" value="com.mysql.jdbc.Driver" />
<property name="jdbcUrl" value="jdbc:mysql://localhost:3306/mydatabase" />
<property name="user" value="root" />
<property name="password" value="password" />
<property name="acquireIncrement" value="5" />
<property name="minPoolSize" value="10" />
<property name="maxPoolSize" value="100" />
<property name="maxStatements" value="50" />
<property name="readOnly" value="false" />
</bean>
```
在此示例中,我们将readOnly属性设置为false,以允许对数据库进行读写操作。如果您的readOnly属性已经设置为false,那么您可以检查您的数据库用户是否具有写入权限。
另外,您的struts.xml文件中的配置看起来没有问题,不会导致只读。您可以检查您的数据库配置和权限设置来解决只读问题。