解决方案 »
- Cannot cast from ActionForm to XXForm
- 大侠帮忙看看 引起这些异常的原因可能有哪些,,,
- 高手请进
- jsp自定义标签问题
- spring rmi如何配置多接口
- 本人找师傅!!!有吗?熟悉各种框架就可以了!来接分的就算了!最鄙视这种人!!!
- struts乱码
- 怎么用JDOM输出<?xml:stylesheet ....?>这样的处理指令?
- No mapping found for HTTP request with URI
- SpringMVC Contoller中的俩个方法如何传值,例如传递对象?
- 谁有基于java_EE的论坛系统与设计的源码啊?毕业设计使用,急求!!!
- jsp做的网站本地调试不出来,连接数据库有问题!望大神们快快终结它!强劲加分哦!
应该是用struts2生成验证码图片的时候虽然表面上将验证码放入了session中,它只是用流输出了一张图片,但是由于action返回的字符串是null,故session没有传递到下一个页面,所以其它action中再取的时候就娶不到了。
解决办法:验证码最好是用servlet来生成
有人说:
这个是你不同步的问题,页面和图片同时访问SESSION,由于JSP先运行,先访问SESSION,获得的是上一次SESSION,在页面显示图片时SERVLET才运行,此时SERVLET生成一个新的代码。
正确顺序是在JSP里设定SESSION,在SERVLET中读SESSION.
然后把这样 HttpSession session = request.getSession(false);去获取session
结果抛出session为Null异常 那我该如何来处理session同步 ?
<?xml version="1.0" encoding="UTF-8"?><!-- ===================================================================== -->
<!-- -->
<!-- JBoss Server Configuration -->
<!-- -->
<!-- ===================================================================== --><!-- $Id: oracle-ds.xml 71535 2008-04-01 07:05:03Z [email protected] $ -->
<!-- ==================================================================== -->
<!-- Datasource config for Oracle originally from Steven Coy -->
<!-- ==================================================================== -->
<datasources>
<local-tx-datasource>
<jndi-name>OracleDS</jndi-name>
<connection-url>jdbc:oracle:thin:@192.168.1.31:1521:orcl</connection-url>
<!-- Here are a couple of the possible OCI configurations.
For more information, see http://otn.oracle.com/docs/products/oracle9i/doc_library/release2/java.920/a96654/toc.htm <connection-url>jdbc:oracle:oci:@youroracle-tns-name</connection-url>
or
<connection-url>jdbc:oracle:oci:@(description=(address=(host=youroraclehost)(protocol=tcp)(port=1521))(connect_data=(SERVICE_NAME=yourservicename)))</connection-url> Clearly, its better to have TNS set up properly.
-->
<driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
<user-name>devkind</user-name>
<password>devkind</password>
<!-- Uses the pingDatabase method to check a connection is still valid before handing it out from the pool -->
<!--valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleValidConnectionChecker</valid-connection-checker-class-name-->
<!-- Checks the Oracle error codes and messages for fatal errors -->
<exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
<!-- sql to call when connection is created
<new-connection-sql>some arbitrary sql</new-connection-sql>
--> <!-- sql to call on an existing pooled connection when it is obtained from pool - the OracleValidConnectionChecker is prefered
<check-valid-connection-sql>some arbitrary sql</check-valid-connection-sql>
--> <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->
<metadata>
<type-mapping>Oracle9i</type-mapping>
</metadata>
<min-pool-size>2</min-pool-size>
<max-pool-size>10</max-pool-size>
<blocking-timeout-millis>5000</blocking-timeout-millis>
<idle-timeout-minutes>2</idle-timeout-minutes> </local-tx-datasource>
<local-tx-datasource>
<jndi-name>fjcts-hotel</jndi-name>
<connection-url>jdbc:oracle:thin:@192.168.1.31:1521:orcl</connection-url>
<!-- Here are a couple of the possible OCI configurations.
For more information, see http://otn.oracle.com/docs/products/oracle9i/doc_library/release2/java.920/a96654/toc.htm <connection-url>jdbc:oracle:oci:@youroracle-tns-name</connection-url>
or
<connection-url>jdbc:oracle:oci:@(description=(address=(host=youroraclehost)(protocol=tcp)(port=1521))(connect_data=(SERVICE_NAME=yourservicename)))</connection-url> Clearly, its better to have TNS set up properly.
-->
<driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
<user-name>hotel</user-name>
<password>hotel</password>
<!-- Uses the pingDatabase method to check a connection is still valid before handing it out from the pool -->
<!--valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleValidConnectionChecker</valid-connection-checker-class-name-->
<!-- Checks the Oracle error codes and messages for fatal errors -->
<exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
<!-- sql to call when connection is created
<new-connection-sql>some arbitrary sql</new-connection-sql>
--> <!-- sql to call on an existing pooled connection when it is obtained from pool - the OracleValidConnectionChecker is prefered
<check-valid-connection-sql>some arbitrary sql</check-valid-connection-sql>
--> <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->
<metadata>
<type-mapping>Oracle9i</type-mapping>
</metadata>
<min-pool-size>2</min-pool-size>
<max-pool-size>10</max-pool-size>
<blocking-timeout-millis>5000</blocking-timeout-millis>
<idle-timeout-minutes>2</idle-timeout-minutes> </local-tx-datasource>
</datasources>