struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hardik Shah <hardik_...@yahoo.com>
Subject realm use in s2
Date Tue, 26 Aug 2008 07:48:43 GMT

hi

i am trying to use jdbc realm with s2 for that i have configured like that 
 i am using eclipse ,so i have changed in server project 's server.xml file
like this

(first disable the userdatabase realm)
and then applying 

 <Realm  className="org.apache.catalina.realm.JDBCRealm"
             driverName="com.mysql.jdbc.Driver"
          connectionURL="jdbc:mysql://localhost:3306/cfa"
         connectionName="cfa" connectionPassword="cfa"
              userTable="usermast" userNameCol="username"
userCredCol="password"
          userRoleTable="usermast" roleNameCol="user_role" />


after that i have change in my project's web.xml file like that

----------------------------------------------------------
 <filter-mapping>
        <filter-name>struts2</filter-name>
        <url-pattern>*.jtp</url-pattern>
    </filter-mapping>

	<!-- End settings for sitemesh and struts  -->
	<security-constraint>
		<web-resource-collection>
				<web-resource-name>CFASystem</web-resource-name>
				<url-pattern>*.jtp</url-pattern>
				<http-method>GET</http-method>
                <http-method>POST</http-method>
                <http-method>PUT</http-method>
                <http-method>DELETE</http-method>
				
		</web-resource-collection>
	
	</security-constraint>
	
	<login-config>
		<auth-method>FORM</auth-method>
		<realm-name>MyFirst Protected Area</realm-name>
		<form-login-config>
			<form-login-page>/Login.jsp</form-login-page>
			<form-error-page>/error.jsp</form-error-page>
		</form-login-config>
	</login-config>
	<security-role>
		<description> admin user allowed</description>
		<role-name>admin</role-name>
	</security-role>
	<security-role>
		<description>cfa user allowed</description>
		<role-name>cfa</role-name>
	</security-role>
---------------------------------------------------

in login.jsp i have write like 

------------------------------

<form method="POST" action="j_security_check">

				<table width="70%" >
					<tr> 
						<td class="label"><s:text name="Username" /></td>
						<td><s:textfield  name="j_username" cssClass="textbox"  /></td>
					</tr>				
					<tr><td></td></tr>
					<tr> 
						<td class="label"><s:text name="Pasword" /></td>
						<td><s:password name="j_password" showPassword="true"
cssClass="textbox"  /></td>
					</tr>				
					<tr>						
					<td align="right">	
					<s:submit cssClass="button"/>
			  		</td>
					</tr>				
			</table>
			</form>

----------------------


when i try to login this 

gives error like 

HTTP Status 400 - Invalid direct reference to form login page

where i make mistake?
please help me !

it might be not que abt s2 but still expect help!




-----


Java/J2EE developer 
India

blogs
http://hardik4u.wordpress.com wordpress blog 

-- 
View this message in context: http://www.nabble.com/realm-use-in-s2-tp19157022p19157022.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message