Win a copy of Rust Web Development this week in the Other Languages forum!

Saman Perera

Ranch Hand
+ Follow
since Jul 15, 2003
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 Saman Perera

Hi all

i need to send a whole jsf rendered page as a html page.... . say theres a page which hav few links , images etc & theres a send email button at the end of the page. once the user clicks on the button the whole page should appear in another window which hav from,to, subject line + the html body of tht earlier page & once he clicks the send button it should send to the sender & the receiver should see the email a s a html email.where you can click on the links,images showin etc...


Thanks
Saman
14 years ago
JSF
Thansk, it is correct,

your solution is work properly
15 years ago
Thansk, it is correct,

your solution is work properly
15 years ago
Hi Higginson and all

thanks you very much for the answer

i used some ajax call for set of combos , it is not working because if i used struts html tag , that why i used simple html tag , then i this proble occure , please help how to solve this prob.


thanks
Saman
15 years ago
hi all

pls ans my problem

thans
Saman
15 years ago
select box value not select after submit and render tha page
15 years ago
hi all

when i submit a page after select a combo box value , when it return then select one i not select at that time , i load all the combo box value from struts action when i submit all then values are load again to that combo also , otherwise there are not any value
this is the combo code in struts jsp page



thanks
saman
15 years ago
hi all

I am working on Spring / hibernate / struts , i want to solve following problem

What is the mechanism to inset and update Audit column in spring together with hibernate


thanks all
Saman
Hi all

Pls tell me any one how to use struts validation framework in the spring context , i did samething which i did in the struts web project , validation frame work with LookupDispatchAction and DynaValidatorForm , it is not work properly , pls tell me how to do this

Thanks

Saman

ERROR
---------------------
There is a error callled Messages are not found

i put all the keys correctly


following are some of resources


Struts Config
----------------
<!-- Form Bean -->

<form-bean name="createSellRateForm" type="org.apache.struts.validator.DynaValidatorForm">
<form-property name="customer" type="java.lang.String" />
<form-property name="accountNo" type="java.lang.String" />
<form-property name="logisticService" type="java.lang.String" />
<form-property name="transportService" type="java.lang.String" />
<form-property name="buyRateCard" type="java.lang.String" />
<form-property name="sellRateCard" type="java.lang.String" />
<form-property name="currency" type="java.lang.String" />
<form-property name="dispatch" type="java.lang.String" />
<form-property name="adjustmentCriteria" type="java.lang.String" initial="P" />
<form-property name="adjustment" type="java.lang.String" initial="I" />
<form-property name="adjustmentAmount" type="java.lang.Double" initial="0.0" />
</form-bean>




<!-- properties -->

<message-resources key="settlements" parameter="com.parcelhouse.settlements.web.messages" null="false"/>

<!-- plugins -->

<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
<set-property property="pathnames" value="/WEB-INF/validator-rules.xml,
/WEB-INF/validator.xml" />
<set-property property="stopOnFirstError" value="true" />
</plug-in>

<plug-in className="org.apache.struts.tiles.TilesPlugin">
<set-property property="definitions-config" value="/WEB-INF/settlements-tiles-defs.xml"/>
</plug-in>

part of web XML
---------------
<context-param>
<param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
<param-value>com.parcelhouse.settlements.web.messages</param-value>
</context-param>


validator.xml
-----------------------


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

<!DOCTYPE form-validation PUBLIC
"-//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.1.3//EN"
"http://jakarta.apache.org/commons/dtds/validator_1_1_3.dtd">

<form-validation>
<formset>
<form name="createSellRateForm">
<field property="adjustmentAmount"
depends="required,integer">
<arg0 key="createSellRate.adjustmentAmount"/>
</field>
</form>
</formset>
</form-validation>


JSP
---------------

<logic:messagesPresent message="false">
<div class="error">
Errors
<ul>
<html:messages id="error" message="false">
<li><c ut value="${error}"/></li>
</html:messages>
</ul>
</div>
</logic:messagesPresent>



Application context
---------------------------
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<!--
- Application context definition for settlements on Hibernate.
-->
<beans>
<!-- ========================= RESOURCE DEFINITIONS ========================= -->
<!-- Configurer that replaces ${...} placeholders with values from a properties file -->
<!-- (in this case, JDBC-related settings for the dataSource definition below) -->
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location" value="/WEB-INF/jdbc.properties"/>
</bean>
<!-- Local DataSource that works in any environment -->
<!-- Note that DriverManagerDataSource does not pool; it is not intended for production -->
<!-- See JPetStore for an example of using Commons DBCP BasicDataSource as alternative -->
<!-- See Image Database for an example of using C3P0 ComboPooledDataSource as alternative -->
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="${jdbc.driverClassName}"/>
<property name="url" value="${jdbc.url}"/>
<property name="username" value="${jdbc.username}"/>
<property name="password" value="${jdbc.password}"/>
</bean>
<!-- JNDI DataSource for J2EE environments -->
<!--
<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="java:comp/env/jdbc/petclinic"/>
</bean>
-->
<!-- Hibernate SessionFactory -->
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource"/>
<property name="mappingResources">
<value>com/parcelhouse/settlements/entity/hbm/mappings/all.hbm.xml</value>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">${hibernate.dialect}</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.generate_statistics">true</prop>

<!-- <prop key="hibernate.hbm2ddl.auto">create</prop> -->
<prop key="hibernate.hbm2ddl.auto">update</prop>

</props>
</property>
<property name="eventListeners">
<map>
<entry key="merge">
<bean class="org.springframework.orm.hibernate3.support.IdTransferringMergeEventListener"/>
</entry>
</map>
</property>
</bean>

<bean id="methodInvokingJobDetail" class="org.springframework.scheduling.timer.MethodInvokingTimerTaskFactoryBean">
<property name="targetObject"><ref bean="folderListener"/></property>
<property name="targetMethod"><value>init</value></property>
</bean>

<bean id="folderListener" class="com.parcelhouse.settlements.listener.FolderListener"/>

<bean id="scheduledTask" class="org.springframework.scheduling.timer.ScheduledTimerTask">

<property name="delay">
<value>10000</value>
</property>

<property name="period">
<value>-1</value>
</property>
<property name="timerTask">
<ref local="methodInvokingJobDetail"/>
</property>
</bean>


<bean id="timerFactory" class="org.springframework.scheduling.timer.TimerFactoryBean">
<property name="scheduledTimerTasks">
<list>

<ref local="scheduledTask"/>
</list>
</property>
</bean>


<!-- Transaction manager for a single Hibernate SessionFactory (alternative to JTA) -->
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<!-- Transaction manager that delegates to JTA (for a transactional JNDI DataSource) -->
<!--
<bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager"/>
-->
<!-- ========================= BUSINESS OBJECT DEFINITIONS ========================= -->


<bean id="persistenceService" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="transactionManager" ref="transactionManager"/>
<property name="target" ref="poolPersistenceManagerHandler"/>
<property name="transactionAttributes">
<props>
<prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
<prop key="find*">PROPAGATION_REQUIRED,readOnly</prop>
<prop key="load*">PROPAGATION_REQUIRED,readOnly</prop>
<prop key="store*">PROPAGATION_REQUIRED</prop>
<prop key="save*">PROPAGATION_REQUIRED</prop>
<prop key="update*">PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean>
<bean id="poolPersistenceManagerHandler" class="org.springframework.aop.target.CommonsPoolTargetSource">
<property name="targetBeanName">
<value>persistenceManagerImpl</value>
</property>
<property name="maxSize">
<value>15</value>
</property>
</bean>

<bean id="businessService" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="transactionManager" ref="transactionManager"/>
<property name="target" ref="poolBusinessServiceHandler"/>
<property name="transactionAttributes">
<props>
<prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
<prop key="find*">PROPAGATION_REQUIRED,readOnly</prop>
<prop key="load*">PROPAGATION_REQUIRED,readOnly</prop>
<prop key="store*">PROPAGATION_REQUIRED</prop>
<prop key="save*">PROPAGATION_REQUIRED</prop>
<prop key="update*">PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean>
<bean id="poolBusinessServiceHandler" class="org.springframework.aop.target.CommonsPoolTargetSource">
<property name="targetBeanName">
<value>businessServiceManagerImpl</value>
</property>
<property name="maxSize">
<value>15</value>
</property>
</bean>

<!-- ################### BusinessServiceManager (end) ##################### -->

<!-- Hibernate 3.0's JMX statistics service -->
<!-- Implements the StatisticsServiceMBean management interface -->
<bean name="petclinic:type=HibernateStatistics" class="org.hibernate.jmx.StatisticsService">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<!-- ========================= JMX EXPORTER DEFINITION ========================= -->
<!--
- Exporter that exposes Hibernate 3.0's statistics service via JMX.
- Autodetects the statistics service, which is a standard MBean,
- using its bean name as JMX object name.
-
- By default, the standard MBeanServerFactory.findMBeanServer method will be used
- to determine the MBeanServer. Unfortunately, this does not work on WebLogic <= 8.1:
- you need to comment in the WebLogicMBeanServerFactoryBean definition on WebLogic,
- specifying appropriate configuration values there.
-->
<bean id="jmxExporter" class="org.springframework.jmx.export.MBeanExporter">
<property name="autodetect" value="true"/>
<!-- Comment the following in on WebLogic <= 8.1, which doesn't support -->
<!-- the standard MBeanServerFactory.findMBeanServer lookup mechanism. -->
<!--
<property name="server">
<bean class="org.springframework.jmx.support.WebLogicJndiMBeanServerFactoryBean"/>
</property>
-->
</bean>
</beans>
Hi all

Pls tell me any one how to use struts validation framework in the spring context , i did samething which i did in the struts web project , validation frame work with LookupDispatchAction and DynaValidatorForm , it is not work properly , pls tell me how to do this

Thanks

Saman
hi all

pls tell me what is the ideal exam for the business component ,
will the EJB 3.0 exam introduce soon or not ,

thnaks
Hi all

this pro is somewhat performance issuse

public class NewTest
{

public NewTest()
{
super();
// TODO Auto-generated constructor stub
}
// method 1
public ArrayList getArrayList(){

ArrayList arrayList = new ArrayList(0);
arrayList.add("A");
arrayList.add("B");
arrayList.add("C");
return arrayList;
}
// method 2
public ArrayList getArrayListWithPara(ArrayList arrayList){

arrayList.add("A");
arrayList.add("B");
arrayList.add("C");
return arrayList;
}


public static void main(String[] args)
{
NewTest newTest = new NewTest();
ArrayList arrayList = newTest.getArrayList();
// use arrayList
arrayList.clear();
ArrayList arrayListWithPara = new ArrayList(0);
arrayListWithPara =newTest.getArrayListWithPara(arrayListWithPara);
// use arrayListWithPara
arrayListWithPara.clear();
}
}


i want to know what is the best possible method " method 1" or "method 2", there is no diffreence


thanks all
saman
15 years ago
hi all

pls help

thanks all
saman
Dear All

Pls any one tell me how to implement database connection and connection pool in struts web app frame work (MySQL as sample DB)

Thanks
Saman
15 years ago