Thu Feb 12, 2009 4:09 pm
Hi guyz. I have a problem in retrieving data rfrom my database and displaying them on the screen. I have written a java beans class, a DAO, controller class and the view part(jsp). I use a custom tag to call the controller class which should invoke the DAO but then to my surprise the controller class shows that the getAttributes method has no value. I have the setAttribute method in the controller class in the following mode...
....
....
protected void handleHttpRequest(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
req.getSession().setAttribute("id", kvitt );
}
I then call the doStartTag method in the same class in the following mode...
...
...
public int doStartTag() throws JspException {
try {
JspWriter out = pageContext.getOut();
if (getRequest().getAttribute("id") != null) {
kvitt = (Kvittering)getRequest().getAttribute("id");
.....
.......
the kvitt instance always returns null. Anyone knows why this is so??
Sat Feb 14, 2009 10:26 am
i think i found the problem .
in part of setting , you use session ,
- Code:
req.getSession().setAttribute("id", kvitt );
in the part of getting you use request .
- Code:
if (getRequest().getAttribute("id") != null) {
Mon Feb 16, 2009 9:37 am
msi_333 wrote:i think i found the problem .
in part of setting , you use session ,
- Code:
req.getSession().setAttribute("id", kvitt );
in the part of getting you use request .
- Code:
if (getRequest().getAttribute("id") != null) {
I have tried to use session but the problem is still there. Nothing is printed on the browser. Any other alternative would be welcome
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.