Why are the JavaBean properites not being set properly?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Greg_Scott
Posted On:   Tuesday, June 24, 2003 09:15 AM

I have a jsp which allows the user to enter the infomation that is sent in an email. However, properties are not being set from what is entered in the Jsp. Any Ideas?? // mehtod that calls bean public boolean processRequest(ServletContext application, HttpServletRequest request) throws IOException, Exception{ errmsg.setLength(0); String action = request.getParameter("Aaction"); String bankId = request.getParameter("cuFinNum"); DataSource ds=(DataSource)application.getAttribute("suncorpDS"); if (ds==null) { errmsg.append("DataSource is null"); return(false); } this.s   More>>

I have a jsp which allows the user to enter the infomation that is sent in an email. However, properties are not being set from what is entered in the Jsp.

Any Ideas??


			
// mehtod that calls bean
public boolean processRequest(ServletContext application, HttpServletRequest request)
throws IOException, Exception{

errmsg.setLength(0);

String action = request.getParameter("Aaction");
String bankId = request.getParameter("cuFinNum");


DataSource ds=(DataSource)application.getAttribute("suncorpDS");
if (ds==null) {
errmsg.append("DataSource is null");
return(false);
}
this.setDataSource(ds);


if (action == null)
return(false);

if (action.equals("Reset")) {
reset();
return(false);
} else if (!action.equals("Send")) {
errmsg.append("Unknown action");
return(false);
}

if (!isComplete())
return(false);


try{
EmailBean eb = new EmailBean();
ClaimRequestBean cr = new ClaimRequestBean();
cr.setCustomerName(cr.getCustomerName());
cr.setCustomerSSNum(cr.getCustomerSSNum());

eb.setServer(this.mailHost);
eb.addTo(this.recipient);
eb.setSender(this.sender);
eb.setSubject(this.subject);
eb.setBody(this.getMessage(bankId, cr));
eb.doSend();
return(true);
} catch(Exception e) {
e.printStackTrace();
errmsg.append("There is an error sending the message");
return(false);
}
}

			
// Jsp code
<%@page
language="java"
session="true"
isThreadSafe="true"
errorPage="error.jsp"
%>













<%cr.getCustomerName()%>" size=40>




   <<Less

Re: Why are the JavaBean properites not being set properly?

Posted By:   Joe_Millionaire  
Posted On:   Tuesday, June 24, 2003 02:13 PM

This doesnt look right.


ClaimRequestBean cr = new ClaimRequestBean();
cr.setCustomerName(cr.getCustomerName());
cr.setCustomerSSNum(cr.getCustomerSSNum());


You need to get your "ClaimRequestBean" from the request.

ClaimRequestBean cr = (ClaimRequestBean) request.getAttribute("cr");


You need to update your jsp to use the correct bean

About | Sitemap | Contact