Switch to full style
Java2 codes,problems ,discussions and solutions are here
Post a reply

MVC problem....

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



Re: MVC problem....

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


Re: MVC problem....

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

Post a reply
  Related Posts  to : MVC problem....
 i have problem     -  
 Windows problem!!!     -  
 Map Class problem     -  
 Skymiles [3.04] little? problem     -  
 Window 7 problem....     -  
 Problem with skymiles_red     -  
 Paging problem in php     -  
 JSTL URI problem     -  
 I have a serious virus/trojan problem, anyone pls?     -  
 ACM Forex unresponsiveness problem     -