Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JSP -> Servlet and form bean.  RSS feed

John Miller
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a JSP page the makes use of a form bean, the JSP pages gets submitted to a controller.jsp (MVC Arch.) that initialises the appropriate requesthandler. I'm trying to access the form bean inside the requesthandler, unfortunately it seems to return null.
Below is a snippet of the JSP and the code for the requesthandler.
Any ideas?
--SERVLET CODE---------------------------------------
package ui.requesthandlers;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
public class TechSupportRequestSubmitted implements ui.RequestHandler {
public String handleRequest(PageContext pageContext, HttpServletRequest request) {
String result = "";
try { formBean = ( request.getAttribute("techFormBean");
if ((formBean.getEmail() != null) || (!formBean.getEmail().equals(""))) {
result = "validationsuccess.htm";
}else {
result = "techsupp.jsp";
}catch (Exception ex) {
return result;
--SERVLET CODE---------------------------------------
--JSP CODE-------------------------------------------
<%@ page errorPage="systemError" %>
<jsp:useBean id="techFormBean" scope="request" class="" >
<jsp:setProperty name="techFormBean" property="*" />
--JSP CODE-------------------------------------------
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!