You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Paul Kuykendall (EUS)" <Pa...@am1.ericsson.se> on 2003/05/15 21:55:46 UTC
Scriptlet to struts/jsp/taglib translation problem
Hi,
Being very new to JSP/Servlet/Struts programming, I'm having some problems in translating a scriptlet into a less kludgy alternative using struts/JSPs and possibly the occasional taglib. I'm trying to generate a table similar to:
PROFILE MINVAL MAXVAL MSGSIZE ENABLED
abcdefg 1 9 4 x
bcdefgh 1 9 4
cdefghi 1 9 4 x
defghij 1 9 4
efghijk 1 9 4 x
Where the profile name (eg. abcdefg) is a link to a form that gets prepopulated with the minval, maxval, msgsize, and enabled fields as editable and the profile name as not editable.
I've been reading _Struts in Action_ [Ted Husted] and am trying to figure out if using a smart forwarding technique will help do part of what I want to do (the link to the edit page). My problem is that I still don't know how to deal with the synchronization and iterating through the list of entries. The guys that wrote the back-end say that it must be inn a synchronized block to protect from multiple access/change.
Does anyone have any suggestions on how this may be accomplished or things to look into. Due to project requirements I can't use struts 1.1 (only released versions of libraries may be used).
The scriptlet that I am currently using to just dump the datastore is listed below.
<% /* Scriptlet source that lists the items w/o links to edit */
ServletContext servletContext = getServletContext();
MessageSizeCalculator messageSizeCalculator =
(MessageSizeCalculator) servletContext.getAttribute(
ProjectServletContextAttributeNames.REWRITE_RULE_DB);
synchronized(messageSizeCalculator)
{
Iterator i = messageSizeCalculator.getRulesIterator();
while (i.hasNext())
{
String profile = (String)i.next();
out.print("<tr>");
out.print("<td>" + profile + "</td>");
out.print("<td>"
+ messageSizeCalculator.getRule(profile).getMinMsgSize()
+ "</td>");
out.print("<td>"
+ messageSizeCalculator.getRule(profile).getMaxMsgSize()
+ "</td>");
out.print("<td>"
+ messageSizeCalculator.getRule(profile).getMsgSize()
+ "</td>");
out.print("<td>"
+ messageSizeCalculator.getRule(profile).isEnabled()
+ "</td>");
out.print("</tr>");
}
}
%>
Thanks for any help.
Paul
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org