2009/5/28 Christopher Schultz <[email protected]>:
>> May I put the code here? (i think it's very little and simple to read)
>
> Sure. Post what you've got and we'll take a look.
>
<!--BEGIN CODE
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<%...@page import="java.util.*"%>
<%...@page import="net.our.util.*"%>
<%...@page import="net.our.content.bean.*"%>
<script language="JavaScript1.2"
src="js/scroller/JSFX_Layer.js"></script>
<script language="JavaScript1.2"
src="js/scroller/JSFX_VerticalScroller.js"></script>
<script language="JavaScript1.2">
var myScroller = new JSFX.VerticalScroller();
myScroller.setStyle("font-family: Verdana, Arial, Helvetica,
sans-serif;");
myScroller.setShowTime(3);
<%
java.util.ArrayList limitNewsList = null;
java.sql.Connection conn = null;
try{
javax.sql.DataSource dataSource =
DatabaseUtil.getDataSource( application, request);
conn = dataSource.getConnection();
String lang_iso = request.getLocale().getISO3Language();
if( null == lang_iso || lang_iso.length()==0 ){
lang_iso = Constants.DEFAULT_LANG;
}
if (null != conn) {
limitNewsList =
net.our.content.dao.ContentDAO.getLimitedContent(conn, 6,
lang_iso,"news");
System.out.println( "<!-- debug: news found "
+ limitNewsList.size() + "-->" );
System.out.println( "show news:" + limitNewsList + "" );
//this is working! i can see the arraylist populated
}
//conn.close();
} catch ( java.sql.SQLException sqle ){
throw new java.sql.SQLException(sqle.getMessage());
} finally{
if (conn!=null)
conn.close();
}
// if the next line is commented, then the page is shown in he right way!
request.setAttribute("limitNewsList" , limitNewsList );
%>
<logic:empty name="limitNewsList">
myScroller.addMessage("Prossimamente news");
</logic:empty>
<logic:notEmpty name="limitNewsList">
//the problem should be in the bean:define
myScroller.addMessage('<logic:iterate scope="request"
id="nzews" name="limitNewsList" length="2"
offset="0"><b>»</b><bean:define id="abst" name="news"
property="abstr" /><bean:define id="title" name="news"
property="title"/><html:link action="/newsDetail" paramId="id"
paramName="news" paramProperty="id"><font color="#A90000"><%=
((String)title).replaceAll("\'", "’")
%></font></html:link><br><html:link action="/newsDetail" paramId="id"
paramName="news" paramProperty="id"><%= StringUtil.getFirstNChar(
(String)abst, 30 ).replaceAll("\'", "’") %></html:link><span
style="font-size:4px;"><br><br></span></logic:iterate>');
</script>
I SKIP THE REST OF THE CODE-->
the error from catalina.out is:
"ERROR [TP-Processor40] - Servlet.service() for servlet jsp threw exception
javax.servlet.jsp.JspException: Define tag cannot set a null value
at org.apache.struts.taglib.bean.DefineTag.doEndTag(DefineTag.java:272)
etc. etc."
if i comment this line "request.setAttribute("limitNewsList" ,
limitNewsList );", the page is shown without errors.
--
mr
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]