Total members 11894 |It is currently Sun Nov 24, 2024 11:24 pm Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





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??




Author:
Newbie
User avatar Posts: 2
Have thanks: 0 time

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) {


_________________
M. S. Rakha, Ph.D.
Queen's University
Canada


Author:
Mastermind
User avatar Posts: 2715
Have thanks: 74 time

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


Author:
Newbie
User avatar Posts: 2
Have thanks: 0 time
Post new topic Reply to topic  [ 3 posts ] 

  Related Posts  to : MVC problem....
 i have problem     -  
 Paging problem in php     -  
 JSTL URI problem     -  
 Windows problem!!!     -  
 Map Class problem     -  
 Skymiles [3.04] little? problem     -  
 Window 7 problem....     -  
 Problem with skymiles_red     -  
 problem with JcheckBox method     -  
 JavaScript fade out problem     -  









Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
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