在服务器端可以控制,通过读取余额,如果有足够的钱就继续,如果钱不够的话就抛出安全异常。见EJB的编程控制安全。

解决方案 »

  1.   

    怎样防止用户直接输入url对这个页面进行访问呢?
      

  2.   

    问的好!关注ing我觉得好像jaas可以解决吧,不过没具体用过
      

  3.   

    我首先想到的就是过滤器,其次是jaas,就象tomcat的realm
      

  4.   

    过滤器听说过,好像可以实现根据session对象对访问的所有网页,进行统一处理(过滤),无需再每一个页面中都增加判断语句jaas是什么ya?
      

  5.   

    google的功能真强大
    http://java.sun.com/security/jaas/doc/api.html
      

  6.   

    这是我用过的办法!给每一个页面加上SESSION的判断!你能明白吗?就是在用户登陆时创建SESSION然后在每个页面里跟踪SESSION OK!
      

  7.   

    Find "filter" from Sun J2EE Specification
      

  8.   

    web.xml文件中是有安全设定的,可以防止直接输入url来访问
    给你个例子  <security-constraint>
       <web-resource-collection>
        <web-resource-name>index</web-resource-name>
           <url-pattern>/admin/*</url-pattern>
           <http-method>GET</http-method>
           <http-method>POST</http-method>
       </web-resource-collection>
       <auth-constraint>
        <role-name>systemAdmin</role-name>
       </auth-constraint>
       <user-data-constraint>
        <transport-guarantee>NONE</transport-guarantee>
       </user-data-constraint>
      </security-constraint>