-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Hibernate DAO DTO model and JSP page for display of values
PostPosted: Tue Dec 21, 2004 12:49 am 
Newbie

Joined: Sun Dec 19, 2004 8:10 pm
Posts: 10
Location: Australia
Hibernate version: 3.01

I have a question on using Hibernate values in a jsp page. I am using the DAO DTO model for hibernate and have had great sucess with java classes. Now I want to display the values in my jsp page. below is the page I have written. I am not getting any values returned by the call to my DAO. I do not get any errors just a blank section on my page. Is my syntax correct?

Any help appreciated

Connie




<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<%@ page import="frontgate.admin.AdminManager" %>
<%@ page import="frontgate.hibernate.dao.frontgate.FguserDAO" %>
<%@ page import="frontgate.hibernate.dto.frontgate.Fguser" %>
<%@ page import="frontgate.security.*" %>
<%@ page import="frontgate.exceptions.*" %>
<%@ page import="java.util.*" %>
<%@ page language="java" %>

<%
String strSession = request.getParameter("sessionId");
if (strSession==null) strSession = request.getSession().getId();
AdminManager myAdminManager = null;
try{
myAdminManager = new AdminManager();
}catch (Exception e){
%>
<jsp:forward page="../redirect.htm" />
<%
}
ArrayList myUsers = myAdminManager.getAdminUsers();
%>

<html>

<head>
<title>Frontgate: User Menu</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<link rel="stylesheet" href="../../stylesheets/frontgate.css" type="text/css" />
</head>

<script language="javascript1.2" type="text/javascript">
<!--
var filter = 0 ;
function getfilter(int)
{
filter = int;
}

function doDelete()
{
if (filter == 0)
{
alert ("You must select a record with the radio buttons first!");
}
else
{
if (confirm("Are you sure you want to delete this record?"))
{
document.userMenuForm.TODO.value="DELETE";
document.userMenuForm.USER.value=filter; //value of the radio button
document.userMenuForm.submit();
}
}
}
//edit button on footer
function doEdit()
{
if (filter == 0)
{
alert ("You must select a record with the radio buttons first!");
}
else
{
document.userMenuForm.TODO.value="EDIT";
//need to change the action of the form to get to the edit page
document.userMenuForm.USER.value=filter; //value of the radio button
document.userMenuForm.submit();
}
}
//new button on footer
function doNew()
{
document.userMenuForm.TODO.value="NEW";
//need to change the action of the form to get to the new page
document.userMenuForm.submit();
}

function buttonToggled(bName)
{
bName.className="buttonTextToggled";
}

function buttonDown(bName)
{
bName.className="buttonTextClick";
}

function buttonRoll(bName)
{
bName.className="buttonTextRoll";
}

function buttonLeave(bName)
{
bName.className="buttonText";
}

function buttonOff(bName)
{
bName.className="buttonTextRoll";
}

//-->
</script>

<body leftmargin="0" topmargin="0" style="background-color:#B3BDC6;">

<table width="100%" cellpadding="0" cellspacing="0" class="banner">
<tr >
<td width="41%" valign="middle" align="left" style="background-color:#002340;"><img src="../../images/frontgate_logo.gif" width="260" height="26" align="middle"></td>
<td width="59%" align="right" style="background-color:#002340;">&nbsp;</td>
</tr>
</table>
<table style="background-color:#B3BDC6;" width="100%" cellpadding="0" cellspacing="0" >
<tr >
<td width="5%">&nbsp;
</td>
</tr>
<tr>
<td style="font-size: 18px; color: #ffffff; vertical-align: middle; text-align:left;">
&nbsp;&nbsp;&nbsp;User Menu
</td>
</tr>
</table>
<form name="userMenuForm" action="/frontgate/resources/Administration/userNew.jsp" method="post">
<INPUT TYPE="hidden" name="TODO" Value="0">
<INPUT TYPE="hidden" name="USER" Value="0">

<!-- start of the body table -->
<table width="100%" cellpadding="0" cellspacing="0" >
<tr >
<td width="5%"></td>
<td width="90%">

<table style="background-color:#B3BDC6;" border="0" width="100%">
<tr style="color: #ffffff;" >
<td width="4%" align="center"></td>
<td width="24%" align="center">User Name</td>
<td width="24%" align="center">UserID</td>
<td width="24%" align="center">Password</td>
<td width="24%" align="center">Role</td>
<td width="24%" align="center">test me </td>
</tr>
</table>
<table width="100%">
<tr>
<td width="100%" style="border: 1px solid #FFFFFF; background-color: #B3BDC6">

<table style="background-color: #B3BDC6;" border="0" width="100%">
<% for ( int intUserCount = 0; intUserCount < myUsers.size(); intUserCount++ ) { %>

<tr>
<td width="4%"><div align="center">
<input type="radio" value="<%=((Fguser)myUsers.get(intUserCount)).getFguserId()%>" name="RB"
onclick="getfilter('<%=((Fguser)myUsers.get(intUserCount)).getFguserId()%>')" >
</div></td>
<td width="24%"><div align="center">
<%=((Fguser)myUsers.get(intUserCount)).getSurname()%>
</div></td>
<td width="24%"><div align="center">
<%=((Fguser)myUsers.get(intUserCount)).getUserid()%>
</div></td>
<td width="24%"><div align="center">
<%=((Fguser)myUsers.get(intUserCount)).getPassword()%>
</div></td>
<td width="24%"><div align="center">
<%=((Fguser)myUsers.get(intUserCount)).getUserrole()%></div></td>
</tr>
<% } %>

</table>
</td>
</tr>
</table><p></p>

<table width="620" height="29" class="lightBlueBg">
<tr >
<td width="9">&nbsp;</td>
<td width="132" class="buttonText" name="button_new" onMouseover="buttonRoll(this)" onMouseout="buttonLeave(this)" onMousedown="buttonDown(this)" onMouseUp="buttonOff(this)" onClick="doNew()">New User</td>
<td width="15">&nbsp;</td>
<td width="132" class="buttonText" name="button_edit" onMouseover="buttonRoll(this)" onMouseout="buttonLeave(this)" onMousedown="buttonDown(this)" onMouseUp="buttonOff(this)" onClick="doEdit()">Edit user</td>
<td width="15">&nbsp;</td>
<td width="132" class="buttonText" name="button_delete" onMouseover="buttonRoll(this)" onMouseout="buttonLeave(this)" onMousedown="buttonDown(this)" onMouseUp="buttonOff(this)" onClick="doDelete()">Delete User</td>
<td width="15">&nbsp;</td>
<td width="132" class="buttonText" name="button_help" onMouseover="buttonRoll(this)" onMouseout="buttonLeave(this)" onMousedown="buttonDown(this)" onMouseUp="buttonOff(this)" onClick="doHelp()">Help</td>
<td width="15">&nbsp;</td>
</tr>
</table>
</td>
<td width="5%"></td>
</tr>
</table>
</form>


</body>

</html>


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 21, 2004 11:33 pm 
Newbie

Joined: Sun Dec 19, 2004 8:10 pm
Posts: 10
Location: Australia
Hmm ... User error strikes again, This code was right it was an error in the underlying call to the DAO. I put debuggers in previously but until I actually put print statements in this page was not sure where I fell ... All is fixed now. Please delete this post guys and I will go back to RTFM


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.