Felix Thomas

Greenhorn
+ Follow
since Jun 06, 2007
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 Felix Thomas

hi,

I want to know about books for Enterprise service bus which is good for beginner to expert level.
13 years ago
hi,

I have a query , i want to print a jsp which has many sections in it. At the time of displaying i am showing the whole section in one page itself, But when i want to print it, i want to specify which section comes in which page .

I mean Sections 1-5 in first page , 6-10 2nd page so on.....


Is there any way to do it in Jsp or using any tags.

Hi,

I want to know if there any Basic level books in web flow .

What books are good to learn spring right from bascis.


Regards,
Felix T
hi,

Thanks for your suggestion but won't the function will become specific for Employee class which you have used in your example. Then i will have to write a function for every class object to be set.

:shocked: :p
hi,

I want to know if there is any better approach to setting java objects whith the values returned from DATABASE using jdbc.

For example i have written a generic function which returns a collection of Vector objects which i use and pass back in an array list.

Below is the function i have written



My problem is that i have a A class named person which contains attributes like name,sex,age etc etc.

Now for setting the values in an object i have to know which object is in the vector (column) then accordingly set the property which is quite un ethical.

Currently i am keeping the order of the columns which where added in the vector and setting them in the same order.

Does anyone have a better approach to get around this problem ??. So that i can set the corresponding property depending upon the value in the vector.








[ Edited to use code tags - Paul Sturrock ]
[ June 11, 2007: Message edited by: Paul Sturrock ]
hi,

got the problem it was in the class which was implementing the method, it has a class memeber aaraylist. But i have a different problem,

i am executing a flow i.e.e adding a module after which it goes back to the list of modules.

exactly the flow is
list of mod ->add module ->list of modules.

the problem is after adding a module which i come back to list of modules and select the add button there

the text box shows the previous added values , it does not show blank.

[<code>]
module flow beans.xml

<beans xmlns="http://www.springframework.org/schema/beans";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">

<!-- Search form action that setups the form and processes form submissions -->
<bean id="formAction" class="org.springframework.webflow.action.FormActi on">

<property name="formObjectClass" value="com.mastek.sb.common.to.CustomModTO"/>
<property name="formObjectName" value="customModTO"/>
<property name="formObjectScope" value="FLOW"/>
<!--
<property name="validator">
<bean class="org.springframework.webflow.samples.phonebo ok.SearchCriteriaValidator"/>
</property>
-->
</bean>

</beans>


module-flow.xml

<?xml version="1.0" encoding="UTF-8"?>
<flow xmlns="http://www.springframework.org/schema/webflow";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:schemaLocation="http://www.springframework.org/schema/webflow
http://www.springframework.org/schema/webflow/spring-webflow-1.0.xsd">

<start-state idref="listCriteria"/>

<view-state id="listCriteria" view="listModule">
<render-actions>

<bean-action bean="custommod" method="customModLists">
<!--
<method-arguments>
<argument expression="requestParameters.userid" parameter-type="int"/>
</method-arguments>
-->
<method-result name="results"/>
</bean-action>
</render-actions>
<transition on="add" to="addModule"/>
</view-state>

<view-state id="addModule" view="moduleadd1">
<render-actions>
<action bean="formAction" method="setupForm"/>
</render-actions>
<!--
<render-actions>
<bean-action bean="phonebook" method="search">
<method-arguments>
<argument expression="flowScope.searchCriteria"/>
</method-arguments>
<method-result name="results"/>
</bean-action>
</render-actions>
-->

<transition on="save" to="savemod">
<action bean="formAction" method="bindAndValidate"/>
</transition>
</view-state>

<action-state id="savemod">
<bean-action bean="custommod" method="insertCustomMod">
<method-arguments>
<argument expression="flowScope.customModTO"/>
</method-arguments>
</bean-action>
<transition on="*" to="listCriteria" />
</action-state>



<!--
<subflow-state id="browseDetails" flow="detail-flow">
<attribute-mapper>
<input-mapper>
<mapping source="requestParameters.id" target="id" from="string" to="long"/>
</input-mapper>
</attribute-mapper>
<transition on="finish" to="displayResults"/>
</subflow-state>
-->
<import resource="module-flow-beans.xml"/>

</flow>

moduleadd.jsp

<%@ page contentType="text/html" %>
<%@ page session="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"; %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"; %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"; %>

<html>
<head>
<title>Add Module</title>
</head>

<body>


<div id="content">
<h2>Add a new Module</h2>
<hr>
<!-- Tell webflow what executing flow we are participating in -->
<form action="sbdemo.htm" method="post" id="moduleForm">
<fieldset>

<table>
<tr>
<tr>
<spring:bind path="customModTO.label">
<td>Label</td>
<td>
<input type="text" name="${status.expression}" value="${status.value}">
</td>
</spring:bind>
</tr>
<spring:bind path="customModTO.name">
<tr>
<td>Name</td>
<td>
<input type="text" name="${status.expression}" value="${status.value}">
</td>
</tr>
</spring:bind>
</tr>
<tr>
<td colspan="2" class="buttonBar">


<input type="hidden" name="_flowExecutionKey" value="${flowExecutionKey}">

<input type="submit" class="button" name="_eventId_save" value="Save">
</td>
</tr>
</table>
</form>
</div>
</body>
</html>

weblow-config.xml

?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xmlns:flow="http://www.springframework.org/schema/webflow-config";
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schem...-beans-2.0.xsd
http://www.springframework.org/schema/webflow-config
http://www.springframework.org/schema/webflow-config/spring-webflow-config-1.0.xsd">

<!-- Launches new flow executions and resumes existing executions. -->
<flow:executor id="flowExecutor" registry-ref="flowRegistry"/>

<!-- Creates the registry of flow definitions for this application -->
<flow:registry id="flowRegistry">
<flow:location path="/WEB-INF/flows/**-flow.xml"/>
</flow:registry>

</beans>

servlet-config.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">

<!--
Exposes web flows for execution at a single request URL.
The id of a flow to launch should be passed in by clients using
the "_flowId" request parameter:
e.g. /phonebook.htm?_flowId=search
-->
<bean name="/sbdemo.htm" class="org.springframework.webflow.executor.mvc.Fl owController">
<property name="flowExecutor" ref="flowExecutor"/>
</bean>

<!-- Resolves flow view names to .jsp templates -->
<bean id="viewResolver" class="org.springframework.web.servlet.view.Intern alResourceViewResolver">
<property name="prefix" value="/WEB-INF/jsp/"/>
<property name="suffix" value=".jsp"/>
</bean>

</beans>




[</code>]

hope you ppl are getting my problem
hi,

I am iterating a arraylist which is returned from a bean. But when everytime i refresh the page it arraylist gets duplicated with existing values.
I am using spring webflow 2.1.

what could be the problem.
[<CODE>]
c:forEach var="alist" items="${results}">


<tr>

<td><cut value='${alist.moduleID}'/></td>
<td><cut value='${alist.name}'/></td>
<td><cut value='${alist.createdbyID}'/></td>
<td></td>


</tr>

</c:forEach>

[</CODE>]


The flow XML contains these entries.
view-state id="listCriteria" view="listModule">
<render-actions>
<bean-action bean="custommod" method="customModLists">
<method-result name="results"/>
</bean-action>
</render-actions>
<transition on="add" to="addModule" />
</view-state>

The method returns a arraylist containing objects . But after refreshing the page the $results gets added again i see, all entries in the database are getting added again. How do i stop this unwanted behaviour from happening.



Can anyone help