السلام عليكم ورحمة الله .. أسعد الله" مساءكم/صباحكم " بكل خير..
يا إخوة : عندي دالة تتحكم في توجيه الـ request في الموقع ..
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String base = "/app/";
String url = base+"index.jsp";
String action = request.getParameter("action");
if(action != null){
if(action.equals(CATEGORIES)){
url = base+"categories.jsp";
}
else if(action.equals(PROD_DETAILS)){
url = base+"product_details.jsp";
}
else if(action.equals(SEARCH)){
url = base+"search.jsp";
}
else if(action.equals(CART)){
url = base+"cart.jsp";
}
else if(action.equals(CHECK)){
url = base+"/protected/customer/checkOut.jsp";
//send(request,response);
}
else if (action.equals("addShoppingItem") ||
action.equals("updateShoppingItem") ||
action.equals("deleteShoppingItem") ||
action.equals("displayShoppingCart"))
url = base + "cart.jsp";
}
RequestDispatcher req = getServletContext().getRequestDispatcher(url);
req.forward(request, response);
}أضفت قيد للوصول إلى صفحة checkout.jsp
<security-constraint>
<display-name>Constraint1</display-name>
<web-resource-collection>
<web-resource-name>customerPages</web-resource-name>
<description/>
<url-pattern>/app/protected/customer/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<description/>
<role-name>customer</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>FORM</auth-method>
<form-login-config>
<form-login-page>/login.jsp</form-login-page>
<form-error-page>/errorSignIn.jsp</form-error-page>
</form-login-config>
</login-config>
<security-role>
<description/>
<role-name>customer</role-name>
</security-role>لكن :unsure: للأسف لم يعمل! هل المشكلة من الرابط مثلا؟ جربت أكثر من طريقة وللأسف
أرجو المساعدة..