mike bravo

Greenhorn
+ Follow
since Jul 03, 2007
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by mike bravo

Bert Bates wrote:This idea has been around for several decades. This thread states the original idea, but thinking and research have evolved, and most learning experts these days would say that everyone uses all three types of learning. Some people might feel that they have *slight* preferences, but in studies, those preferences don't really hold up well.

But, from a learning and teaching perspective, most everybody DOES benefit when instruction includes approaches from two or three of those channels as opposed to instruction that focuses only on one of the three channels.



Excellent point Bert.. so that's why I love reading the Head First Series... seeing those funny pics and then doing the exercise adds to your learning experience..
10 years ago
Hi all, I am a new to web and struts programming and just starting to learn how to program in struts by making some simple WEB programs taken from the tutorials I had gotten from the web.

I have a JSP that displays the list of users and in the last column of each row, theres an html link that allows it to View, Edit or Delete each row. Here's my JSP.

<%@ taglib uri="/WEB-INF/taglibs/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/taglibs/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/taglibs/struts-logic.tld" prefix="logic" %>

<html:html>
<head>
<base href="<%=basePath%>">

<title>
<bean:message key="apex.title"/>
<bean:message key="apex.user.title"/>
</title>


<script type="text/javascript">
function showRow(r)
{
var i=r.parentNode.rowIndex
var x=document.getElementById('tblUser').rows [i].cells
return (x[0].innerHTML)
}
</script>

</head>

<body bgcolor="lightblue">
<center>
<p><h1><bean:message key="apex.user.list"/></h1></p>

<table border="1" cellpadding="3" id="tblUser">
<tr bgcolor="CCCCFF">
<th width="100">
<bean:message key="apex.user.username"/>
</th>
<th width="150">
<bean:message key="apex.user.lastname"/>
</th>
<th width="150">
<bean:message key="apex.user.firstname"/>
</th>
<th width="150">
<bean:message key="apex.user.actions"/>
</th>
</tr>
<logic:iterate id="user" name="users">
<tr align="center" bgcolor="FFFFFF">
<td bgcolor="FFFFCC">
<bean:write name="user" property="username"/>
</td>
<td>
<bean:write name="user" property="lastName"/>
</td>
<td>
<bean:write name="user" property="firstName"/>
</td>
<td bgcolor="FFFFCC">
<html:link property="uvwe" action="/viewUser.do">
<bean:message key="button.view"/>
<jsp:useBean id="personUserName" class="com.training.bdo.User" scope="request">
<jsp:setProperty name="personUserName" property="username" param="showRow(r)"/>
</jsp:useBean>
</html:link>
<html:link property="uedt" action="/editUser.do">
<bean:message key="button.edit"/>
</html:link>
<html:link property="udel" action="/deleteUser.do">
<bean:message key="button.delete"/>
</html:link>
</td>
</tr>
</logic:iterate>
</table>

<button property="uadd">
<bean:message key="apex.user.new"/>
</button>
<button property="main">
<bean:message key="apex.main.page"/>
</button>

</center>
</body>
</html:html>


What I want is that when I click the link like view user, it will forward me to the url = "/viewUser.do" defined in the struts-config.xml. This will just basically display complete user data. But before I could forward it I want to save the data of the username.

So what I have thought was to save it in a java bean using <jsp:usebean>. I use javascript so I could have a reference on the rows that I have click. I dont know if this is the right way of doing it

<jsp:useBean id="personUserName" class="com.training.bdo.User">
<jsp:setProperty name="personUserName" property="username" param="showRow(this)"/>
</jsp:useBean>

The jsp that I want to forward this just basically displays the username

<html>
<head>
<base href="<%=basePath%>">

<title>My JSP 'viewUserProfile.jsp' starting page</title>


</head>

<body>
<h1>This page will show user data. </h1><br>

<p>
Your user Name is: ${personUserName.username}
<!--Other data to follow upon retrieval of the user name attribute-->
</p>
</body>
</html>

I am receiving an error: Attempted a bean operation on a null object.
Please pardon me if my question maybe too simple to others. I am just working this out on my own through web tutorials.
15 years ago