ho fatto queste modifiche e non funziona
web.xml
faces-config.xmlcodice:<?xml version="1.0" encoding="UTF-8"?> <web-app id="WebApp_ID" version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> <display-name>SSWA</display-name> <context-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/applicationContext-business.xml /WEB-INF/applicationContext-security.xml</param-value> </context-param> <filter> <filter-name>springSecurityFilterChain</filter-name> <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class> </filter> <filter-mapping> <filter-name>springSecurityFilterChain</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <servlet> <servlet-name>FacesServlet</servlet-name> <servlet-class>javax.faces.webapp.FacesServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>FacesServlet</servlet-name> <url-pattern>/faces/*</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>FacesServlet</servlet-name> <url-pattern>*.jsf</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>FacesServlet</servlet-name> <url-pattern>*.faces</url-pattern> </servlet-mapping> <welcome-file-list> <welcome-file>index.html</welcome-file> <welcome-file>index.htm</welcome-file> <welcome-file>index.jsp</welcome-file> <welcome-file>default.html</welcome-file> <welcome-file>default.htm</welcome-file> <welcome-file>default.jsp</welcome-file> </welcome-file-list> <login-config> <auth-method>BASIC</auth-method> <form-login-config> <form-login-page>/login.jsp</form-login-page> <form-error-page>/index.jsp</form-error-page> </form-login-config> </login-config> </web-app>
applicationContext-security.xmlcodice:<?xml version="1.0" encoding="UTF-8"?> <faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/w...sconfig_1_2.xsd"> <managed-bean> <managed-bean-name>calculatorController</managed-bean-name> <managed-bean-class>org.swview.springsecuritytestapp.jsf.CalculatorController</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> <managed-property> <property-name>calculator</property-name> <value>#{calculatorBean}</value> </managed-property> </managed-bean> <managed-bean> <managed-bean-name>login</managed-bean-name> <managed-bean-class>it.bean.Login</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> <managed-property> <property-name>password</property-name> <property-class>java.lang.String</property-class> <value/> </managed-property> <managed-property> <property-name>user</property-name> <property-class>java.lang.String</property-class> <value/> </managed-property> </managed-bean> <navigation-rule> <display-name>login</display-name> <from-view-id>/login.jsp</from-view-id> <navigation-case> <from-outcome>submit</from-outcome> <to-view-id>/calculator.jsp</to-view-id> </navigation-case> </navigation-rule> <application> <el-resolver>org.springframework.web.jsf.el.SpringBeanFacesELResolver</el-resolver> </application> </faces-config>
applicationContext-business.xmlcodice:<?xml version="1.0" encoding="UTF-8"?> <beans:beans xmlns="http://www.springframework.org/schema/security" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schem...-beans-3.0.xsd http://www.springframework.org/schema/security http://www.springframework.org/schem...curity-3.0.xsd"> <global-method-security> <protect-pointcut access="ROLE_SPECIAL_USER" expression="execution(* org.swview.springsecuritytestapp.logic.Calculator.add(..))"/> <protect-pointcut access="ROLE_GENERAL_USER" expression="execution(* org.swview.springsecuritytestapp.logic.Calculator.subtract(..))"/> </global-method-security> <!-- <http auto-config="true" > <intercept-url pattern="/*" access="hasRole('ROLE_USER')"/> <form-login login-page="/login.jsp" /> </http> --> <http auto-config='true'> <intercept-url pattern="/login.jsp*" access="IS_AUTHENTICATED_ANONYMOUSLY"/> <intercept-url pattern="/**" access="ROLE_USER" /> <form-login login-page='/login.jsp'/> </http> <!-- Usernames/Passwords are kamal/swview test/spring --> <authentication-manager> <authentication-provider> <password-encoder hash="md5"/> <user-service> <user name="kamal" password="65dc70650690999922d7dcd99dbd4033" authorities="ROLE_SPECIAL_USER" /> <user name="test" password="2a2d595e6ed9a0b24f027f2b63b134d6" authorities="ROLE_GENERAL_USER" /> </user-service> </authentication-provider> </authentication-manager> </beans:beans>
codice:<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schem...-beans-3.0.xsd"> <bean id="calculatorBean" class="org.swview.springsecuritytestapp.logic.CalculatorIpml"> </bean> <bean id="login" class="it.bean.Login"> </bean> </beans> login.jspERROREcodice:<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%> <%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%> <?xml version='1.0' encoding='windows-1252'?> <jsp :root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:af="http://xmlns.oracle.com/adf/faces/rich"> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Calculator</title> </head> <body> <f:view> <h:form> Inserisci la UserName: <h:inputText value="#{Login.user}" id="name" required="true" /></p> Inserisci la password: <h:inputText value="#{Login.password}" id="pwd" required="true" /></p> <h:commandButton value="Submit" action="submit" /> </h:form> </f:view></body></html>codice:HTTP Status 500 - -------------------------------------------------------------------------------- type Exception report message description The server encountered an internal error () that prevented it from fulfilling this request. exception org.apache.jasper.JasperException: An exception occurred processing JSP page /login.jsp at line 17 14: </head> 15: <body> 16: 17: <f:view> 18: <h:form> 19: Inserisci la UserName: <h:inputText value="#{Login.user}" id="name" required="true" /></p> 20: Inserisci la password: <h:inputText value="#{Login.password}" id="pwd" required="true" /></p> Stacktrace: org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:498)

Rispondi quotando