You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Peter L. Berghold" <pe...@berghold.net> on 2007/08/06 21:53:41 UTC

Getting beat up troubleshooting my app; help please.

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi folks,

I'm writing a web application that part of it maintains a list of
accounts and maps to those accounts privileges. I'm getting some odd
bomb-outs that aren't making sense to me. Of course, this could also be
a case I'm not seeing something.

The environment I'm developing against is the Tomcat JSP container,
using Struts 1.2 Java 5.0, Hibernate 3.0 using MyEclipse IDE to do my
actual development.

The pages I'm working with here, the first part of which works file. In
the struts-config.xml it is defined as:

	<action path="/actions/protected/maintenance/account/list"
		forward=".protected.account.list"/>

which in turn invokes a tiles deifinition like so:

	<definition name=".protected.account.list" extends=".public.layout">
		<put name="content"
value="/content-pages/protected/maintenance/account/show_list.jsp"/>
		<put name="title" value="Bayshore Companion Dog Club -- Account List" />
		<put name="left_menu" value="/menus/public/general.jsp" />
	</definition>

and the main operating JSP looks like:


<%@ page language="java" pageEncoding="UTF-8"%>
<%@ page import="org.bcdc.hbm.services.*"%>
<%@ page import="org.bcdc.hbm.tables.*"%>
<%@ page import="java.util.*" %>
<%
	AccountService asvc = AccountService.getInstance();
	Iterator accountList = asvc.getAllAccounts().iterator();
	
%>
<h2>Account List</h2>
<table width="100%" border="1">
<tr>
<th>Userid</th>
<th>Owner</th>
<th>Action</th>
</tr>
<%
	while ( accountList.hasNext()){
		Account account = (Account) accountList.next();
		Person  person = account.getPerson();
		String  givenName = person.getGivenName();
		String  surname = person.getSurname();
		String  fullName = givenName + " " + surname;
%>
<tr>
<td> <%= account.getLogin() %></td>
<td> <%= fullName  %></td>
<td>
<form action="/actions/protected/security/editAccountInfo.do">
<input type="hidden" name="account_id_rq" value="<%=
account.getAccountId().intValue() %>">
<input type="submit" name="action_rq" value="Edit Account">
</form>
<%
	}
%>
</table>


This works flawlessly so far.  A list of accounts along with the human
name of the accounts' owner appears with a submit butten entitled "Edit
Account" and there is where things go wrong.

If I click on the submit button the page never loads and in the
sserver's error logs I see:

SEVERE: Exception Processing
ErrorPage[exceptionType=java.lang.Throwable,
location=/error-pages/error500.jsp]
java.lang.IllegalStateException

Huh?  Not sure what that means.

The page that is being invoked through the submit button looks like:

struts-config.xml definition:

   <action
      attribute="editAccountInformationForm"
      input=".protected.account.edit"
      name="editAccountInformationForm"
      path="/actions/protected/system/security/editAccountInformation"
      scope="request"
      type="org.bcdc.struts.action.EditAccountInformationAction" />

	<definition name=".protected.account.edit" extends=".public.layout">
		<put name="content"
value="/content-pages/protected/maintenance/account/edit.jsp"/>
		<put name="title" value="Bayshore Companion Dog Club -- Account Edit" />
		<put name="left_menu" value="/menus/public/general.jsp" />
	</definition>

The JSP page itself:


<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="html" uri="/WEB-INF/struts-html.tld" %>
<%@ page import="org.bcdc.hbm.services.*"%>
<%@ page import="org.bcdc.hbm.tables.*"%>
<%
	AccountService asvc = AccountService.getInstance();
	
	Account account = (Account)
request.getSession().getAttribute("account_to_edit");
	if ( account == null ) {
		Integer account_id = new
Integer((String)request.getParameter("account_id_rq"));
		account = asvc.getAccountByID(account_id);
		if ( account == null )
		
			throw new RuntimeException("Could not load the account to be edited!");
	}
	
	Person person = account.getPerson();
	String  ownersName = person.getGivenName() + " "
	         + person.getSurname();
	String account_name = account.getLogin();
	Iterator accountRoles = account.getAccountRoles().iterator();
	
	if ( accountRoles == null )
		throw new RuntimeException("WTF? account roles is null! ");
		
	
%>

<html:form
action="/actions/protected/system/security/editAccountInformation"
method="post">
<h2>Account Information</h2>
<b>USERID: </b> <%= account_name  %>
<b>PERSON: </b> <%= ownersName %></br>
<html:submit property="edit_action_rq" value="Reset/Set Password"/><br>
<hr>
<h3>Account Status</h3>

<html:submit property="edit_action_rq" value="Change Status"/>
<hr>
<h3>List of Roles/Priviledges</h3>
<ol>
<%
	while ( accountRoles.hasNext()){
		AccountRole accountRole = (AccountRole) accountRoles.next();
		String roleName = accountRole.getAccountRoleType().getAccountRoleType();
%>
<li><%= roleName %></li>
<%
	}
%>
</ol>
<html:submit property="edit_action_rq" value="Modify Roles"/>
<hr>

<html:submit property="edit_action_rq" value="Delete Account"/>

</html:form>


Thoughts anybody?


What am I not seeing?


- ----

Peter L. Berghold                   Unix Professional
Peter@Berghold.Net             AIM: redcowdawg YIM: blue_cowdawg
"Those who fail to learn from history are condemned to repeat it."
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGt3xFUM9/01RIhaARAsoDAJ93NcQCl4eIauGXmJkjA5rmpATGzwCcCj8V
zLOsL2UM2YOYJ2hLfxuAXXY=
=oTL3
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org