rodgers tang

Greenhorn
+ Follow
since Mar 11, 2005
Merit badge: grant badges
For More
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 rodgers tang

Hi ann,

Following is some code:

jsp page:
<display:table name="requestScope.rowSet.rows" id="testit"
requestURI="SubmitFISReportForm.do" sort="list" pagesize="12" defaultsort="3" align="center" width="945" decorator="rain.TableLink" >
<display:column sortable="true" property="server" title="Server" headerClass="sortable" />
<display:column sortable="true" property="outage_type" title="Outage Type" headerClass="sortable" /> // outage_type is database col name.
<display:column sortable="true" property="outage_start" title="Outage start" />
</display:table>

TableLink java Code:
public class TableLink extends TableDecorator {

/** Creates a new instance of TableLink */
public TableLink() {
super();
}
RowSetDynaClass obj=null;
public String getOutage_type(){

UserDAOBean map1 = (UserDAOBean)getCurrentRowObject();
String aa=map1.getOutageType();

return "<a href=\"tableLinks.jsp?id= "+ aa + "&action=view\" /a>";
}

}

Action form code:
public class SubmitFISReportFormAction extends Action {

public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws Exception {

try {
String outageType=(String)PropertyUtils.getSimpleProperty(form,"outageType"); //get form value
String serverName=(String)PropertyUtils.getSimpleProperty(form,"serverName");
String startDate=(String)PropertyUtils.getSimpleProperty(form,"startDate");
String endDate=(String)PropertyUtils.getSimpleProperty(form,"endDate");

UserDAOBean bean = new UserDAOBean(serverName,outageType,startDate,endDate);
RowSetDynaClass rowSet= bean.getUsersRowSet();
request.setAttribute("rowSet", rowSet);
}
catch(Exception ex) {

}

return mapping.findForward("success");
}
}

If I do not use decorator, outputing table is fine.

Thanks for help.

H tang
18 years ago
Hi all,

I use displaytag decorator to link table. After creating getLink() class, I start this web page. But this page become blank.I do not why.

Thanks for help.

H Tang
18 years ago
Hello all,

I am developing Report Application Form using Struts.I have set everything right, web.xml,struts-config.xml,struts-validation.xml.But the application is giving problem while displaying the empty item (should output validation errors).

Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

java.lang.IllegalArgumentException: Resources cannot be null.
at org.apache.commons.validator.Validator.(Validator.java:188)
at org.apache.struts.validator.Resources.initValidator(Resources.java:299)
at org.apache.struts.validator.ValidatorForm.validate(ValidatorForm.java:106)

and some more lines

This is jsp page:

<html> ...
<table width="765" border="0" align="center">
<tr>
<th align="left">
<logic:messagesPresent>
<ul>
<font color="red">
<html:messages id="error">
<li><%=error %></li>
</html:messages>
</font>
</ul>
</logic:messagesPresent>

</th>
</tr>
</table>
<html:form method="post" action="/submitFISReport" >
...
<table border="0" cellpadding="2" cellspacing="2" width="100%">
<tr>
<th><bean:message key="fisOutageReport.jsp.outageType" /></th>

<td>

<html:select property="outageType">
<html ption value="ALL">ALL</html ption>
<html ption value="Planned">Planned</html ption>
<html ption value="Unplanned">Unplaned</html ption>
</html:select>
</td>
<html:select property="serverName"> ...
...
<table border="0" cellpadding="2" cellspacing="2" width="100%">
<tr >
<th><bean:message key="fisOutageReport.jsp.startDate" /> </th>
<td><html:text name="SubmitFISReportForm" property="startDate" value="03/01/2005" size="10" />
</td>
<th><bean:message key="fisOutageReport.jsp.endDate" />
</th>
<td><html:text name="SubmitFISReportForm" property="endDate" size="10" />
</td>
</tr>
</table>
..
<table>
<html:submit> <bean:message key="fisOutageReport.jsp.submit" /> </html:submit>
<html:reset> <bean:message key="fisOutageReport.jsp.reset" /> </html:reset>
</table>
...
</html>


struts-config.xml:
<struts-config>

<!-- ======================================== Form Bean Definitions -->

<form-beans>
<form-bean name="SubmitFISReportForm" type="rain.SubmitFISReportForm">
</form-bean>
<form-bean name="SubmitFISReportForm"
type="org.apache.struts.validator.DynaValidatorForm">
<form-property name="startDate" type="java.lang.String" />
<form-property name="endDate" type="java.lang.String" />
<form-property name="outageType" type="java.lang.String" />
<form-property name="serverName" type="java.lang.String" />

</form-bean>

<form-bean name="EndDateAction"
type="org.apache.struts.action.DynaActionForm">
<form-property name="outageType" type="java.lang.String" />
</form-bean>

<form-bean name="StartDateAction"
type="org.apache.struts.action.DynaActionForm">
<form-property name="serverName" type="java.lang.String" />
</form-bean>

</form-beans>

<!-- ======= Action Mapping Definitions ======= -->

<action-mappings>

<action path="/submitFISReport" forward="/FISOutageReport1.jsp"/>


<action path="/submitFISReport"
type="rain.SubmitFISReportActionForm"
name="SubmitFISReportForm"
scope="session"
validate="true"
input="/FISOutageReport1.jsp"
parameter="action">
<forward name="success" path="/FISOutageReport1.jsp"/>

</action>

</action-mappings>

<!-- ======= Message Resources ======= -->
<message-resources parameter="rain.FISReportResources" />
<!--
<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
<set-property property="pathnames" value="/WEB-INF/validator-rules.xml, /WEB-INF/validation.xml"/>
</plug-in> -->
</struts-config>
...

struts-validation.xml:

<form-validation>

<formset>

<form name="SubmitFISReportForm">
<field property="startDate" depends="required">
<arg0 key="fisOutageReport.jsp.startDate"/>
</field>
<field property="endDate" depends="required">
<arg0 key="fisOutageReport.jsp.endDate"/>
</field>
<field property="outageType" depends="required">
<arg0 key="fisOutageReport.jsp.outageType"/>
</field>
<field property="serverName" depends="required">
<arg0 key="fisOutageReport.jsp.serverName"/>
</field>
</form>
</formset>


</form-validation>



Thanks help,

Rodgers Tang
19 years ago
Hello all,

I am developing Report Application Form using Struts.I have set everything right, web.xml,struts-config.xml,struts-validation.xml.But the application is giving problem while displaying the empty item (should output validation errors).

Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

java.lang.IllegalArgumentException: Resources cannot be null.
at org.apache.commons.validator.Validator.(Validator.java:188)
at org.apache.struts.validator.Resources.initValidator(Resources.java:299)
at org.apache.struts.validator.ValidatorForm.validate(ValidatorForm.java:106)

and some more lines
19 years ago
When I start tomcat server and run sample code.
I find error:

The requested resource (/servlet/donow.RecordingServlet) is not available.

web.xml:
<?xml version="1.0" encoding="ISO-8859-1"?>

<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">

<display-name> RainForest App</display-name>
<description>Basic web application </description>





<!-- STRUTS SUPPORT -->
<!-- Struts: Standard Action Servlet Configuration -->
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>3</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>



<!-- ================ -->
<!-- SERVLET MAPPINGS -->
<!-- ================ -->

<!-- STRUTS SUPPORT -->
<!-- Struts: Standard Action Servlet Mapping -->


<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>




<!-- ===================== -->
<!-- SESSION CONFIGURATION -->
<!-- ===================== -->

<session-config>
<session-timeout>30</session-timeout>
</session-config>


<mime-mapping>
<extension>xml</extension>
<mime-type>text/xml</mime-type>
</mime-mapping>

<!-- ============= -->
<!-- WELCOME FILES -->
<!-- ============= -->

<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>

<!-- =============== -->
<!-- TAGLIB MAPPINGS -->
<!-- =============== -->

<taglib>
<taglib-uri>/tags/struts-bean</taglib-uri>
<taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
</taglib>

<taglib>
<taglib-uri>/tags/struts-logic</taglib-uri>
<taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
</taglib>

<taglib>
<taglib-uri>/tags/struts-html</taglib-uri>
<taglib-location>/WEB-INF/struts-html.tld</taglib-location>
</taglib>

<taglib>
<taglib-uri>/tags/struts-tiles</taglib-uri>
<taglib-location>/WEB-INF/struts-tiles.tld</taglib-location>
</taglib>

<taglib>
<taglib-uri>/tags/struts-nested</taglib-uri>
<taglib-location>/WEB-INF/struts-nested.tld</taglib-location>
</taglib>

<!-- =========================== -->
<!-- RESOURCE REFERENCES -->
<!-- =========================== -->
<!-- The resource-ref element contains a declaration of a web
application's reference to an external resource. It consists of an
option description, the resource manager connection factory
reference name, the indications of the resource manager connection
factory type expected by the web application code, the type of
authentication (Application or Container).
-->
<resource-ref>
<description>RainForest DB Connection</description>
<res-ref-name>jdbc/RainForestDB</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>


<!-- =========================== -->
<!-- SECURITY CONSTRAINTS -->
<!-- =========================== -->


<!-- =========================== -->
<!-- LOGIN CONFIGS -->
<!-- =========================== -->


<!-- =========================== -->
<!-- SECURITY ROLES -->
<!-- =========================== -->


</web-app>
19 years ago
JSP
When I start tomcat server and run sample code.
I find error:

The requested resource (/servlet/donow.RecordingServlet) is not available.

web.xml:
<?xml version="1.0" encoding="ISO-8859-1"?>

<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">

<display-name> RainForest App</display-name>
<description>Basic web application </description>





<!-- STRUTS SUPPORT -->
<!-- Struts: Standard Action Servlet Configuration -->
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>3</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>



<!-- ================ -->
<!-- SERVLET MAPPINGS -->
<!-- ================ -->

<!-- STRUTS SUPPORT -->
<!-- Struts: Standard Action Servlet Mapping -->


<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>




<!-- ===================== -->
<!-- SESSION CONFIGURATION -->
<!-- ===================== -->

<session-config>
<session-timeout>30</session-timeout>
</session-config>


<mime-mapping>
<extension>xml</extension>
<mime-type>text/xml</mime-type>
</mime-mapping>

<!-- ============= -->
<!-- WELCOME FILES -->
<!-- ============= -->

<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>

<!-- =============== -->
<!-- TAGLIB MAPPINGS -->
<!-- =============== -->

<taglib>
<taglib-uri>/tags/struts-bean</taglib-uri>
<taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
</taglib>

<taglib>
<taglib-uri>/tags/struts-logic</taglib-uri>
<taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
</taglib>

<taglib>
<taglib-uri>/tags/struts-html</taglib-uri>
<taglib-location>/WEB-INF/struts-html.tld</taglib-location>
</taglib>

<taglib>
<taglib-uri>/tags/struts-tiles</taglib-uri>
<taglib-location>/WEB-INF/struts-tiles.tld</taglib-location>
</taglib>

<taglib>
<taglib-uri>/tags/struts-nested</taglib-uri>
<taglib-location>/WEB-INF/struts-nested.tld</taglib-location>
</taglib>

<!-- =========================== -->
<!-- RESOURCE REFERENCES -->
<!-- =========================== -->
<!-- The resource-ref element contains a declaration of a web
application's reference to an external resource. It consists of an
option description, the resource manager connection factory
reference name, the indications of the resource manager connection
factory type expected by the web application code, the type of
authentication (Application or Container).
-->
<resource-ref>
<description>RainForest DB Connection</description>
<res-ref-name>jdbc/RainForestDB</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>


<!-- =========================== -->
<!-- SECURITY CONSTRAINTS -->
<!-- =========================== -->


<!-- =========================== -->
<!-- LOGIN CONFIGS -->
<!-- =========================== -->


<!-- =========================== -->
<!-- SECURITY ROLES -->
<!-- =========================== -->


</web-app>
19 years ago
I run server side validation.This is error:
ex51/rain/CustomerDetailsValidatedForm.java [8:1] package org.apache.struts.validator does not exist
import org.apache.struts.validator.ValidatorForm;
^
ex51/rain/CustomerDetailsValidatedForm.java [16:1] cannot resolve symbol
symbol : class ValidatorForm
location: class rain.CustomerDetailsValidatedForm
public class CustomerDetailsValidatedForm extends ValidatorForm {
^
2 errors

Thanks

rodges T
19 years ago