Dynamically UI() Creation
HI All,
I am using Jdeveloper 11.1.2.4
USE Case- I am trying to create some UI(Tab) at runtime. I am able to create it. But the which i have created, only first tab is coming selected always. and rest of the tab is not allowing to select(May be it is disable). Help me to select these tab.
Here is my code---Example
public String cb1_action() {
RichShowDetailItem ui = new RichShowDetailItem();
ui.setId("rit1");
ui.setText("LabelA");
ui.setDisclosed(true);
addComponent(getPt1(), ui);
return null;
public void addComponent(UIComponent parentUIComponent, UIComponent childUIComponent){
parentUIComponent.getChildren().add(childUIComponent);
AdfFacesContext.getCurrentInstance().addPartialTarget(parentUIComponent);
Regards,
As Manish said you have to give a unique ids for the generated showDetailItems (or at least try to remove ui.setId("rit1"); and test if it is working fine you can give a unique ids) and you can remove ui.setDisclosed(true);
Similar Messages
-
Dynamic Table Creation & Fill Up
Hello,
Can anyone please guide where I can find examples for dynamic table creation (programmaticaly), with dynamic number of columns and rows, used to place inside text components (or whatever) to fill them with data.
All programmatic.
Using JSF, ADF BC
JDeveloper 10.1.3.1
Thanks
Message was edited by:
RJundiHi,
Meybe this article helps: http://technology.amis.nl/blog/?p=2306
Kuba -
Does Seeburger's SFTP adapter support dynamic filename creation
Hi all,
Does the SFTP adapter support dynamic filename creation.
If yes, then do we have to use UDF's and are there any specific settings that have to be done in the SFTP communication channel.
Please provide a blog which helps in the configuration process of the above case.
thanks,
younusDynamic Creation of File using counter in Seeburger Variable:
1. Configuration Needed in the Communication Channel:
The process of dynamic creation of files can be done we have to select the following checkbox in the receiver channel:
Dynamic Attribute in receiver Channel:
Import the following modules:
Localejbs/Seeburger/solution/sftp
Localejbs/Seeburger/AttribMapper
Localejbs/ModuleProcessorExitBean
Enter the desired file naming convention:
Use the Parameter GetCounter("ID") to the place where the counter is expected to come.
2. Configuration Needed in the SeeBurger Workbench:
If the J2EE server is listening on a port different from 50000 (which is the standard for the SAP client 000), the port number must be configured:
Login into the seeburger workbench using the URL
http://<localhost>:<port number>/seeburger/index.html
Select Property Store.
Create or edit the following property:
Parameter
Value
Namespace
http://seeburger.com/xi/SeeFunctions
Key
provider.servlet.server
Value
http://localhost:50000/ (where the port number 50000 must be set
accordingly to the J2EE server configuration).
Note: The configured value (server URL) has to end with a slash (/). Otherwise,
SeeFunctions will not work correctly.
If we need to start the counter from any specific value , it can be configured in the SeeBurger workbench, this value can be maintained in Mapping Variables : -
Does UCM support dynamic page creation on contributor mode.?
Hi All,
Does UCM support dynamic page creation on contributor mode.
We want to create new pages and link it into the existing pages
is that possible?
Thanks
~HariYou can create new secondary pages in contributor mode - you would normally do this via a dynamic list fragment though technically you could also achieve it by switching region content and creating new data files. You can then use the linz wizard to link between pages.
If you are talking about creating new primary pages and sections in your site then you would need to use something like Site Studio Manager fragment.
Tim -
RE: dynamic widget creation
This is a good tech note about this on the Forte website.
-----Original Message-----
From: Matthew Middleton [SMTP:[email protected]]
Sent: Friday, 25 June 1999 11:11
To: [email protected]
Subject: dynamic widget creation
I have done a few windows with dynamic widget creation. Sometimes it
seems I have to have done self.Open before, to get things to appear
properly, and sometimes not.
What I would like is a summation of the issues involved here so I can
write such code without resorting to trial and error.
with advance appreciation,
Matthew
To unsubscribe, email '[email protected]' with
'unsubscribe forte-users' as the body of the message.
Searchable thread archive
<URL:http://pinehurst.sageit.com/listarchive/>-
To unsubscribe, email '[email protected]' with
'unsubscribe forte-users' as the body of the message.
Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>Tech Note 5156, which I have attached for your information.
-----Original Message-----
From: Foster, Todd [SMTP:[email protected]]
Sent: Saturday, 26 June 1999 1:27
To: 'Jason de Cean'
Subject: RE: dynamic widget creation
? What technote ?
-----Original Message-----
From: Jason de Cean [SMTP:[email protected]]
Sent: Thursday, June 24, 1999 9:19 PM
To: 'Matthew Middleton'
Cc: 'Forte Users'
Subject: RE: dynamic widget creation
This is a good tech note about this on the Forte website.
-----Original Message-----
From: Matthew Middleton [SMTP:[email protected]]
Sent: Friday, 25 June 1999 11:11
To: [email protected]
Subject: dynamic widget creation
I have done a few windows with dynamic widget creation. Sometimes
it
seems I have to have done self.Open before, to get things toappear
properly, and sometimes not.
What I would like is a summation of the issues involved here so Ican
write such code without resorting to trial and error.
with advance appreciation,
Matthew
To unsubscribe, email '[email protected]' with
'unsubscribe forte-users' as the body of the message.
Searchable thread archive
<URL:http://pinehurst.sageit.com/listarchive/>-
To unsubscribe, email '[email protected]' with
'unsubscribe forte-users' as the body of the message.
Searchable thread archive<URL:http://pinehurst.sageit.com/listarchive/> -
Dynamic Event Creation and Handling the events
Hi All
I am using WAS 6.4.
I have two components say Component A and Component B in which Component A is a reusable component and is used by other components say for e.g the Component B.
The following is the requirement.
Component A should create buttons for other components dynamically.
As an example, Component B specifies to Component A the buttons required say button B1 and button B2.
Component B also contains methods M1 and M2 for the buttons created by the component A.
Now I would like to associate these buttons created by component A with the methods created in Component B
The number of buttons that are to be created may vary from component to component.
If any one as any suggestion or solution, help me out.
Thanks
Regards
NagaKishoreHi NagaKishore,
I'm not exactly sure why you want to do this, but it is pretty easy if I switch it up a bit. (Maybe you are trying to create a navigation page or something?)
Instead of your component B using component A, if you define a Web Dynpro interface in component A, then implement this interface in component B (or all component Bs), achieving your goal would not be too difficult. It could define a generic method (or event) with a "button key" as an argument that would tell component B which button was pressed and allow it to behave as desired. The Web Dynpro interface defined in A could also have an interface context that would allow the the button text to be passed along with (for the sake of simplicity) a "button key" that component that should be triggered when the button is pressed. (Note this could be a varying size list as required.)
The component B(s) need not be known until run-time. They can be created using something like:
wdThis.wdGet<Used Compontne Name>ComponentUsage().createComponent(<Component Name>,<Object Name (if in a different component)>)
Once the component is created, the context can be accessed giving the list of buttons to create and the values. The buttons can be created in the wdModifyView during the first pass of the creation of the view displaying the buttons (after the dynamic creation of the used components which can occur in the wdDoInit of the component controller).
If the user presses a chosen button on component A, then the generic method (most likely an event) of component Bs interface is called and passed the "button key", component B then takes over. Note this would also work if component B had a visualization component that must be displayed through an interface view that is defined on the web dynpro component interface that is implemented by B.
Hope this helps or at least triggers discussion that will answer your question,
--Greg -
AFAB dynamic variant creation for Posting period.
HI,
Business Requirement :
Business want to run AFAB transaction code every month automatically with schedule job.
system should pick present month period in posting period field.
i checked in variant creation against posting period there is no dynamic " D " in selection variable column.
how can i fix this.Hi Jani,
Check with abaper if TVARV table can Help you in this case, or create a z program from AFAB. And add date field to it, and schedule job based on that,
I think TVARV table will be a better approach.
Another point to consider here would be that dep should be run once business is ready to do so, and has its own hick ups in business if corrections are required to be made after executing AFAB by job
Regards
Pankaj B. -
I am trying to create datasources dynamically. Using an example from a previous
post,
mbeanHome = lookupMBeanHome();
JDBCDataSourceMBean dsMBean = (JDBCDataSourceMBean)mbeanHome.createAdminMBean(poolName,"JDBCDataSource",
mbeanHome.getDomainName());
dsMBean.setJNDIName(poolName);
dsMBean.setPoolName(poolName);
dsMBean.addTarget(tserverMBean);
dsMBean.setPersistenceEnabled(false);
How can I retrieve the proper TargetMBean reference to send to the addTarget method.
Does anyone know where I can find an entire class example of dynamically creating
datasources, or something similar.
Thanks in advance,
FahdHi Fahd,
Here is a sample I posted here some time ago
import java.sql.Connection;
import java.sql.SQLException;
import java.util.Iterator;
import java.util.Set;
import javax.naming.Context;
import javax.sql.DataSource;
import weblogic.jndi.Environment;
import weblogic.management.configuration.JDBCDataSourceMBean;
import weblogic.management.configuration.ServerMBean;
import weblogic.management.MBeanHome;
* This class demonstrates dymamic creation,
* using and deletion of DataSource via
* Weblogic management API.
public class DynamicDataSource {
private Context ctx = null;
private JDBCDataSourceMBean dsMBean = null;
private MBeanHome mbeanHome = null;
private ServerMBean serverMBean = null;
// DataSource attributes
private String cpName = "yourPoolName";
private String dsJNDIName = "dynamic-data-source";
private String dsName = "dynamic-data-source";
// Security credentials
private String password = "admPasword";
private String serverName = "yourServer";
private String url = "t3://localhost:7701";
private String userName = "system";
* Creates and starts up a DataSource using
* management API.
public void createDataSource() throws SQLException {
System.out.println("Creating DataSource...");
try {
// Get context
Environment env = new Environment();
env.setProviderUrl(url);
env.setSecurityPrincipal(userName);
env.setSecurityCredentials(password);
ctx = env.getInitialContext();
// Lookup for MBean home
mbeanHome = (MBeanHome)ctx.lookup(MBeanHome.ADMIN_JNDI_NAME);
serverMBean = (ServerMBean)mbeanHome.getAdminMBean(serverName,
"Server");
// Delete if DataSource MBean already exists in active domain
Set dsMBeanSet = mbeanHome.getMBeansByType("JDBCDataSource",
mbeanHome.getDomainName());
Iterator iter = dsMBeanSet.iterator();
while(iter.hasNext()) {
JDBCDataSourceMBean dsmb = (JDBCDataSourceMBean) iter.next();
if (dsmb.getJNDIName().equals(dsJNDIName)) {
dsMBean = dsmb;
deleteDataSource();
break;
// Create DataSource MBean
dsMBean = (JDBCDataSourceMBean)mbeanHome.createAdminMBean(
dsName, "JDBCDataSource",
mbeanHome.getDomainName());
// Set DataSource attributes
dsMBean.setJNDIName(dsJNDIName);
dsMBean.setPoolName(cpName);
// Startup datasource
dsMBean.addTarget(serverMBean);
} catch (Exception ex) {
throw new SQLException(ex.toString());
* Symply gets and closes a connection from dynamic
* DataSource. Will throw a SQLException if datasource
* does not exists.
public void createConnection() throws SQLException {
System.out.println("Getting Connection...");
try {
DataSource ds = (DataSource)ctx.lookup (dsName);
Connection conn = ds.getConnection();
conn.close();
} catch (Exception ex) {
throw new SQLException(ex.toString());
* Shuts down and deletes DataSource from configuratrion
* using management API.
public void deleteDataSource() throws SQLException {
System.out.println("Deleting DataSource...");
try {
// Remove dynamically created datasource from the server
dsMBean.removeTarget(serverMBean);
// Remove dynamically created datasource from the configuration
mbeanHome.deleteMBean(dsMBean);
} catch (Exception ex) {
throw new SQLException(ex.toString());
public static void main(String args[]) {
DynamicDataSource dds = new DynamicDataSource();
try {
dds.createDataSource();
dds.createConnection();
dds.deleteDataSource();
} catch (SQLException ex) {
ex.printStackTrace();
"Fahd" <[email protected]> wrote in message
news:[email protected]...
>
I am trying to create datasources dynamically. Using an example from aprevious
post,
mbeanHome = lookupMBeanHome();
JDBCDataSourceMBean dsMBean =(JDBCDataSourceMBean)mbeanHome.createAdminMBean(poolName,"JDBCDataSource",
mbeanHome.getDomainName());
dsMBean.setJNDIName(poolName);
dsMBean.setPoolName(poolName);
dsMBean.addTarget(tserverMBean);
dsMBean.setPersistenceEnabled(false);
How can I retrieve the proper TargetMBean reference to send to theaddTarget method.
>
>
Does anyone know where I can find an entire class example of dynamicallycreating
datasources, or something similar.
Thanks in advance,
Fahd -
Hi ,
Static Object Creation :
Eg:
<mx:Fade id="ViewStack_EffectStart" duration="500" alphaFrom="0.0" alphaTo="1.0"/>
<mx:Fade id="ViewStack_EffectEnd" duration="500" alphaFrom="1.0" alphaTo="0.0"/>
<comp:ErrorBox id="errorBox" active="{active}" showEffect="{ViewStack_EffectStart}" hideEffect="{ViewStack_EffectEnd}"/> .
The above static objects is working fine, but the problem is that we have lot of similiar static object which creates a memory issue.If we create dynamic objects, will it avoid the issue.Is dynamic objects advisible?.
Thanks in advance.Please reply ASAP.
Thanks ,
San.hmn.. I don't understand your questions fully.
What about create the fade object in "Model" and reference the same Fade object for all dynamic objects?
or r u asking to find out how to create fade in actionscript?
var fade:Fade = new Fade();
fade.target = this;
fade.alphaFrom = 0;
fade.alphaTo = 1;
fade.play();
hope this helps,
BaBo, -
Please help with dynamic menu creation needs to have 5 levels
Hi,
I have run into a Coldfusion problem that I was hoping you
could help me with.
What I am trying to solve is the dynamic creation of at least
5 levels of categories for a menu built with Coldfusion, and if
possible an infinite amount of levels.
Each of these also if it is at the end of the tree will have
to have products under it aswell the category will only show up if
there is products under it.
To acomplish this I have created a database table called
"Categories" which contains the fields shown in the linked
spreadsheet. I am using the "cat_parent" to hold the value of the
parent of the current record. When the parent is a top level menu
item I have assigned this a cat_parent id of "0". Using this method
I am able to do a self join on the table (where "cat_parent" =
"cat_id") to extract the relationship between parent and child
records throughout the table. This works fine. And I have created
output for 5 levels of display.
There are 3 issues left that I could not work out.
- Firstly my coding method loops through each node of the
tree with one query to create each category of the menu. This means
one query per menu category and as the client could have up to 200
categories in the menu and I am concerned that the solution that I
have come up with is too processor intensive.
- Secondly the way that I have created the category menu is
hard coding in the levels needed so there is only 5 not an infinite
amount which would be preferable but is not essential.
- Finally I could not work out how to not create "parents" in
the tree if there is no products for the end child category.
Meaning that if there is for example a category > subcategory
> subsubcategory but there is no products associated with the
end category - "subsubsubcategory" then it's parent and so on will
not display until one of them has products.
Here
is a link to a zip file that includes: the cfc that contains
the query function (categories.cfc), the page that is creating the
categories menu (lefnav.cfm), a simple cfc that contains a products
query just for testing (products.cfc) along with a spreadsheet of
the Categories table's fields.
I would greatly appreciate any suggestions.
Thanks for any time and help you can give me on thisThis should at least get you started in the right direction.
http://www.sitepoint.com/article/dynamic-menu-coldfusion
Bryan Ashcraft (remove brain to reply)
Web Application Developer
Wright Medical Technologies, Inc.
=============================
Macromedia Certified Dreamweaver Developer
Adobe Community Expert (DW) ::
http://www.macromedia.com/go/team
"shunnyboy" <[email protected]> wrote in
message
news:e2h9hs$kp5$[email protected]..
> Hi,
>
> I have run into a Coldfusion problem that I was hoping
you could help me
> with.
>
> What I am trying to solve is the dynamic creation of at
least 5 levels of
> categories for a menu built with Coldfusion, and if
possible an infinite
> amount
> of levels. -
Why dynamic table creation with struts working only for JDK1.3.1_02 version
Row
import java.util.Vector;
public class Row
private static int colsize;
private Column[] columns;
public void setColumns(Column[] columns)
System.out.println("SetColumns");
this.columns = columns;
public void setColumn(int i, Column column)
System.out.println("setting"+ i+"th column"+column);
public Column[] getColumns()
return null;
public Column getColumns(int i)
System.out.println("Column"+i);
System.out.println("Colsize"+colsize);
if(columns == null)
columns= new Column[colsize];
if(columns[i] == null)
columns[i] = new Column();
return columns;
public int getColsize()
return colsize;
public static void setColsize(int size)
colsize = size;
Column:
public class Column
private String value;
public void setValue(String value)
System.out.println("Value="+value);
this.value = value;
public String getValue()
return value;
ApplicationResources:
button.cancel=Cancel
button.confirm=Confirm
button.reset=Reset
button.save=Save
database.load=Cannot load database from {0}
error.database.missing=<li>User database is missing, cannot validate logon credentials</li>
error.fromAddress.format=<li>Invalid format for From Address</li>
error.fromAddress.required=<li>From Address is required</li>
error.fullName.required=<li>Full Name is required</li>
error.host.required=<li>Mail Server is required</li>
error.noSubscription=<li>No Subscription bean in user session</li>
error.password.required=<li>Password is required</li>
error.password2.required=<li>Confirmation password is required</li>
error.password.match=<li>Password and confirmation password must match</li>
error.password.mismatch=<li>Invalid username and/or password, please try again</li>
error.replyToAddress.format=<li>Invalid format for Reply To Address</li>
error.transaction.token=<li>Cannot submit this form out of order</li>
error.type.invalid=<li>Server Type must be 'imap' or 'pop3'</li>
error.type.required=<li>Server Type is required</li>
error.username.required=<li>Username is required</li>
error.username.unique=<li>That username is already in use - please select another</li>
errors.footer=</ul><hr>
errors.header=<h3><font color="red">Validation Error</font></h3>You must correct the following error(s) before proceeding:<ul>
errors.ioException=I/O exception rendering error messages: {0}
heading.autoConnect=Auto
heading.subscriptions=Current Subscriptions
heading.host=Host Name
heading.user=User Name
heading.type=Server Type
heading.action=Action
index.heading=MailReader Demonstration Application Options
index.logon=Log on to the MailReader Demonstration Application
index.registration=Register with the MailReader Demonstration Application
index.title=MailReader Demonstration Application (Struts 1.0-b1)
index.tour=A Walking Tour of the Example Application
linkSubscription.io=I/O Error: {0}
linkSubscription.noSubscription=No subscription under attribute {0}
linkUser.io=I/O Error: {0}
linkUser.noUser=No user under attribute {0}
logon.title=MailReader Demonstration Application - Logon
mainMenu.heading=Main Menu Options for
mainMenu.logoff=Log off MailReader Demonstration Application
mainMenu.registration=Edit your user registration profile
mainMenu.title=MailReader Demonstration Application - Main Menu
option.imap=IMAP Protocol
option.pop3=POP3 Protocol
prompt.autoConnect=Auto Connect:
prompt.fromAddress=From Address:
prompt.fullName=Full Name:
prompt.mailHostname=Mail Server:
prompt.mailPassword=Mail Password:
prompt.mailServerType=Server Type:
prompt.mailUsername=Mail Username:
prompt.password=Password:
prompt.password2=(Repeat) Password:
prompt.replyToAddress=Reply To Address:
prompt.username=Username:
registration.addSubscription=Add
registration.deleteSubscription=Delete
registration.editSubscription=Edit
registration.title.create=Register for the MailReader Demostration Application
registration.title.edit=Edit Registration for the MailReader Demonstration Application
subscription.title.create=Create New Mail Subscription
subscription.title.delete=Delete Existing Mail Subscription
subscription.title.edit=Edit Existing Mail Subscription
LogonForm
import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
public class LogonForm extends ActionForm
private String username;
private String password;
private String errors;
public String getUsername()
return username;
public void setUsername(String username)
this.username = username;
public void setPassword(String password)
this.password = password;
public String getPassword()
return password;
public String getErrors()
return errors;
public void setErrors(String errors)
this.errors = errors;
public ActionErrors validate(ActionMapping mapping,
HttpServletRequest request) {
ActionErrors errors = new ActionErrors();
if ((username == null) || (username.length() < 1))
errors.add("username", new ActionError("error.username.required"));
if ((password == null) || (password.length() < 1))
errors.add("password", new ActionError("error.password.required"));
return errors;
TableForm
import org.apache.struts.action.ActionForm;
import java.util.Vector;
public class TableForm extends ActionForm
private static int rowsize;
private Row[] rows;
public Row getRows(int i)
System.out.println("Row"+i);
System.out.println("Rowsize"+rowsize);
if(rows == null)
rows = new Row[rowsize];
if(rows[i] == null)
rows[i] = new Row();
return rows[i];
public Row[] getRows()
return null;
public void setRows(Row[] rows)
System.out.println("SetRows");
// this.rows=rows;
public static void setRowsize(int size)
rowsize = size;
public int getRowSize()
return rowsize;
LogonAction
import java.io.IOException;
import java.util.Hashtable;
import java.util.Locale;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionServlet;
import org.apache.struts.util.MessageResources;
public class LogonAction extends Action
public ActionForward execute(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException {
LogonForm logonForm = (LogonForm) form;
System.out.println(logonForm);
System.out.println(logonForm.getUsername());
System.out.println(logonForm.getPassword());
if(logonForm.getUsername().equals("test") && logonForm.getPassword().equals("test"))
//TableForm tform = new TableForm();
//tform.setRowsize(2);
//tform.getRows(0).setColsize(2);
//tform.getRows(1).setColsize(2);
//request.getSession().setAttribute("tableForm",tform);
System.out.println("Table Form setRowSize");
TableForm.setRowsize(2);
System.out.println("Table Form set ColSize");
Row.setColsize(2);
System.out.println("Returning success");
return mapping.findForward("success");
else
ActionErrors errors = new ActionErrors();
errors.add("password",
new ActionError("error.password.mismatch"));
saveErrors(request, errors);
//logonForm.setErrors("LoginError");
return mapping.findForward("failure");
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.0//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd">
<!--
This is the Struts configuration file for the example application,
using the proposed new syntax.
NOTE: You would only flesh out the details in the "form-bean"
declarations if you had a generator tool that used them to create
the corresponding Java classes for you. Otherwise, you would
need only the "form-bean" element itself, with the corresponding
"name" and "type" attributes.
-->
<struts-config>
<form-beans>
<!-- Logon form bean -->
<form-bean name="logonForm"
type="LogonForm"/>
<form-bean name="tableForm"
type="TableForm"/>
<form-bean name="profileForm"
type="ProfileForm"/>
</form-beans>
<global-forwards>
<forward name="success" path="/Profile.jsp"/>
</global-forwards>
<!-- ========== Action Mapping Definitions ============================== -->
<action-mappings>
<!-- Edit user registration -->
<action path="/logon"
type="LogonAction"
name="logonForm"
scope="request"
validate="false"
input="/Test.jsp">
<forward name="success" path="/Table.jsp"/>
<forward name="failure" path="/Test.jsp"/>
</action>
<action path="/table"
type="TableAction"
name="tableForm"
scope="request"
validate="false">
<forward name="success" path="/Bean.jsp"/>
<forward name="failure" path="/Table.jsp"/>
</action>
<action path="/profile"
type="ProfileAction"
name="profileForm"
scope="request"
validate="false"
parameter="method">
<forward name="edit" path="/EditProfile.jsp"/>
<forward name="show" path="/Profile.jsp"/>
</action>
</action-mappings>
</struts-config>
Test.jsp
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<html:html locale="true">
<html:form action="/logon" >
<center>
<table>
<tr>
<td> Username </td>
<td> <html:text property="username" size="16" maxlength="16"/> </td>
<td> <html:errors property="username" /> </td>
</tr>
<tr>
<td> Password </td>
<td> <html:password property="password" size="16" maxlength="16"
redisplay="false"/> </td>
<td><html:errors property="password" /> </td>
</tr>
</table>
</center>
<center> <html:submit property="submit" value="Submit"/> </center>
</html:form>
</html:html>
Table.jsp
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<html:html locale="true">
<html:form action="/table" >
<center>
<table>
<tr>
<td> <html:text property="rows[0].columns[0].value" /> </td>
<td> <html:text property="rows[0].columns[1].value" /></td>
</tr>
<tr>
<td> <html:text property="rows[1].columns[0].value" /> </td>
<td> <html:text property="rows[1].columns[1].value" /></td>
</tr>
</table>
</center>
<center> <html:submit property="submit" value="Submit"/> </center>
</html:form>
</html:html>The above application runs only with JDK1.3.1_02 and not with any other version. This application is creating dynamic table using struts.
Can anybody help me on the same
also appending web.xml contents:
<?xml version="1.0" ?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<!-- Action Servlet Configuration -->
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>application</param-name>
<param-value>ApplicationResources</param-value>
</init-param>
<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>2</param-value>
</init-param>
<init-param>
<param-name>detail</param-name>
<param-value>2</param-value>
</init-param>
<init-param>
<param-name>validate</param-name>
<param-value>true</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
<!-- Action Servlet Mapping -->
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<!--Welcome file list starts here -->
<welcome-file-list>
<welcome-file>
/test.jsp
</welcome-file>
</welcome-file-list>
<!-- Struts Tag Library Descriptors -->
<taglib>
<taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-html.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/WEB-INF/struts-logic.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
</taglib>
</web-app>
validate-rules.xml
<!DOCTYPE form-validation PUBLIC
"-//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.0//EN"
"http://jakarta.apache.org/commons/dtds/validator_1_0.dtd">
<!--
This file contains the default Struts Validator pluggable validator
definitions. It should be placed somewhere under /WEB-INF and
referenced in the struts-config.xml under the plug-in element
for the ValidatorPlugIn.
<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
<set-property property="pathnames" value="/WEB-INF/validator-rules.xml,
/WEB-INF/validation.xml"/>
</plug-in>
These are the default error messages associated with
each validator defined in this file. They should be
added to your projects ApplicationResources.properties
file or you can associate new ones by modifying the
pluggable validators msg attributes in this file.
# Struts Validator Error Messages
errors.required={0} is required.
errors.minlength={0} can not be less than {1} characters.
errors.maxlength={0} can not be greater than {1} characters.
errors.invalid={0} is invalid.
errors.byte={0} must be a byte.
errors.short={0} must be a short.
errors.integer={0} must be an integer.
errors.long={0} must be a long.
errors.float={0} must be a float.
errors.double={0} must be a double.
errors.date={0} is not a date.
errors.range={0} is not in the range {1} through {2}.
errors.creditcard={0} is an invalid credit card number.
errors.email={0} is an invalid e-mail address.
-->
<form-validation>
<global>
<validator name="required"
classname="org.apache.struts.validator.FieldChecks"
method="validateRequired"
methodParams="java.lang.Object,
org.apache.commons.validator.ValidatorAction,
org.apache.commons.validator.Field,
org.apache.struts.action.ActionErrors,
javax.servlet.http.HttpServletRequest"
msg="errors.required">
<javascript><![CDATA[
function validateRequired(form) {
var isValid = true;
var focusField = null;
var i = 0;
var fields = new Array();
oRequired = new required();
for (x in oRequired) {
var field = form[oRequired[x][0]];
if (field.type == 'text' ||
field.type == 'textarea' ||
field.type == 'file' ||
field.type == 'select-one' ||
field.type == 'radio' ||
field.type == 'password') {
var value = '';
// get field's value
if (field.type == "select-one") {
var si = field.selectedIndex;
if (si >= 0) {
value = field.options[si].value;
} else {
value = field.value;
if (trim(value).length == 0) {
if (i == 0) {
focusField = field;
fields[i++] = oRequired[x][1];
isValid = false;
if (fields.length > 0) {
focusField.focus();
alert(fields.join('\n'));
return isValid;
// Trim whitespace from left and right sides of s.
function trim(s) {
return s.replace( /^\s*/, "" ).replace( /\s*$/, "" );
]]>
</javascript>
</validator>
<validator name="requiredif"
classname="org.apache.struts.validator.FieldChecks"
method="validateRequiredIf"
methodParams="java.lang.Object,
org.apache.commons.validator.ValidatorAction,
org.apache.commons.validator.Field,
org.apache.struts.action.ActionErrors,
org.apache.commons.validator.Validator,
javax.servlet.http.HttpServletRequest"
msg="errors.required">
</validator>
<validator name="minlength"
classname="org.apache.struts.validator.FieldChecks"
method="validateMinLength"
methodParams="java.lang.Object,
org.apache.commons.validator.ValidatorAction,
org.apache.commons.validator.Field,
org.apache.struts.action.ActionErrors,
javax.servlet.http.HttpServletRequest"
depends=""
msg="errors.minlength">
<javascript><![CDATA[
function validateMinLength(form) {
var isValid = true;
var focusField = null;
var i = 0;
var fields = new Array();
oMinLength = new minlength();
for (x in oMinLength) {
var field = form[oMinLength[x][0]];
if (field.type == 'text' ||
field.type == 'textarea') {
var iMin = parseInt(oMinLength[x][2]("minlength"));
if ((trim(field.value).length > 0) && (field.value.length < iMin)) {
if (i == 0) {
focusField = field;
fields[i++] = oMinLength[x][1];
isValid = false;
if (fields.length > 0) {
focusField.focus();
alert(fields.join('\n'));
return isValid;
}]]>
</javascript>
</validator>
<validator name="maxlength"
classname="org.apache.struts.validator.FieldChecks"
method="validateMaxLength"
methodParams="java.lang.Object,
org.apache.commons.validator.ValidatorAction,
org.apache.commons.validator.Field,
org.apache.struts.action.ActionErrors,
javax.servlet.http.HttpServletRequest"
depends=""
msg="errors.maxlength">
<javascript><![CDATA[
function validateMaxLength(form) {
var isValid = true;
var focusField = null;
var i = 0;
var fields = new Array();
oMaxLength = new maxlength();
for (x in oMaxLength) {
var field = form[oMaxLength[x][0]];
if (field.type == 'text' ||
field.type == 'textarea') {
var iMax = parseInt(oMaxLength[x][2]("maxlength"));
if (field.value.length > iMax) {
if (i == 0) {
focusField = field;
fields[i++] = oMaxLength[x][1];
isValid = false;
if (fields.length > 0) {
focusField.focus();
alert(fields.join('\n'));
return isValid;
}]]>
</javascript>
</validator>
<validator name="mask"
classname="org.apache.struts.validator.FieldChecks"
method="validateMask"
methodParams="java.lang.Object,
org.apache.commons.validator.ValidatorAction,
org.apache.commons.validator.Field,
org.apache.struts.action.ActionErrors,
javax.servlet.http.HttpServletRequest"
depends=""
msg="errors.invalid">
<javascript><![CDATA[
function validateMask(form) {
var isValid = true;
var focusField = null;
var i = 0;
var fields = new Array();
oMasked = new mask();
for (x in oMasked) {
var field = form[oMasked[x][0]];
if ((field.type == 'text' ||
field.type == 'textarea') &&
(field.value.length > 0)) {
if (!matchPattern(field.value, oMasked[x][2]("mask"))) {
if (i == 0) {
focusField = field;
fields[i++] = oMasked[x][1];
isValid = false;
if (fields.length > 0) {
focusField.focus();
alert(fields.join('\n'));
return isValid;
function matchPattern(value, mask) {
return mask.exec(value);
}]]>
</javascript>
</validator>
<validator name="byte"
classname="org.apache.struts.validator.FieldChecks"
method="validateByte"
methodParams="java.lang.Object,
org.apache.commons.validator.ValidatorAction,
org.apache.commons.validator.Field,
org.apache.struts.action.ActionErrors,
javax.servlet.http.HttpServletRequest"
depends=""
msg="errors.byte"
jsFunctionName="ByteValidations">
<javascript><![CDATA[
function validateByte(form) {
var bValid = true;
var focusField = null;
var i = 0;
var fields = new Array();
oByte = new ByteValidations();
for (x in oByte) {
var field = form[oByte[x][0]];
if (field.type == 'text' ||
field.type == 'textarea' ||
field.type == 'select-one' ||
field.type == 'radio') {
var value = '';
// get field's value
if (field.type == "select-one") {
var si = field.selectedIndex;
if (si >= 0) {
value = field.options[si].value;
} else {
value = field.value;
if (value.length > 0) {
if (!isAllDigits(value)) {
bValid = false;
if (i == 0) {
focusField = field;
fields[i++] = oByte[x][1];
} else {
var iValue = parseInt(value);
if (isNaN(iValue) || !(iValue >= -128 && iValue <= 127)) {
if (i == 0) {
focusField = field;
fields[i++] = oByte[x][1];
bValid = false;
if (fields.length > 0) {
focusField.focus();
alert(fields.join('\n'));
return bValid;
}]]>
</javascript>
</validator>
<validator name="short"
classname="org.apache.struts.validator.FieldChecks"
method="validateShort"
methodParams="java.lang.Object,
org.apache.commons.validator.ValidatorAction,
org.apache.commons.validator.Field,
org.apache.struts.action.ActionErrors,
javax.servlet.http.HttpServletRequest"
depends=""
msg="errors.short"
jsFunctionName="ShortValidations">
<javascript><![CDATA[
function validateShort(form) {
var bValid = true;
var focusField = null;
var i = 0;
var fields = new Array();
oShort = new ShortValidations();
for (x in oShort) {
var field = form[oShort[x][0]];
if (field.type == 'text' ||
field.type == 'textarea' ||
field.type == 'select-one' ||
field.type == 'radio') {
var value = '';
// get field's value
if (field.type == "select-one") {
var si = field.selectedIndex;
if (si >= 0) {
value = field.options[si].value;
} else {
value = field.value;
if (value.length > 0) {
if (!isAllDigits(value)) {
bValid = false;
if (i == 0) {
focusField = field;
fields[i++] = oShort[x][1];
} else {
var iValue = parseInt(value);
if (isNaN(iValue) || !(iValue >= -32768 && iValue <= 32767)) {
if (i == 0) {
focusField = field;
fields[i++] = oShort[x][1];
bValid = false;
if (fields.length > 0) {
focusField.focus();
alert(fields.join('\n'));
return bValid;
}]]>
</javascript>
</validator>
<validator name="integer"
classname="org.apache.struts.validator.FieldChecks"
method="validateInteger"
methodParams="java.lang.Object,
org.apache.commons.validator.ValidatorAction,
org.apache.commons.validator.Field,
org.apache.struts.action.ActionErrors,
javax.servlet.http.HttpServletRequest"
depends=""
msg="errors.integer"
jsFunctionName="IntegerValidations">
<javascript><![CDATA[
function validateInteger(form) {
var bValid = true;
var focusField = null;
var i = 0;
var fields = new Array();
oInteger = new IntegerValidations();
for (x in oInteger) {
var field = form[oInteger[x][0]];
if (field.type == 'text' ||
field.type == 'textarea' ||
field.type == 'select-one' ||
field.type == 'radio') {
var value = '';
// get field's value
if (field.type == "select-one") {
var si = field.selectedIndex;
if (si >= 0) {
value = field.options[si].value;
} else {
value = field.value;
if (value.length > 0) {
if (!isAllDigits(value)) {
bValid = false;
if (i == 0) {
focusField = field;
fields[i++] = oInteger[x][1];
} else {
var iValue = parseInt(value);
if (isNaN(iValue) || !(iValue >= -2147483648 && iValue <= 2147483647)) {
if (i == 0) {
focusField = field;
fields[i++] = oInteger[x][1];
bValid = false;
if (fields.length > 0) {
focusField.focus();
alert(fields.join('\n'));
return bValid;
function isAllDigits(argvalue) {
argvalue = argvalue.toString();
var validChars = "0123456789";
var startFrom = 0;
if (argvalue.substring(0, 2) == "0x") {
validChars = "0123456789abcdefABCDEF";
startFrom = 2;
} else if (argvalue.charAt(0) == "0") {
validChars = "01234567";
startFrom = 1;
} else if (argvalue.charAt(0) == "-") {
startFrom = 1;
for (var n = startFrom; n < argvalue.length; n++) {
if (validChars.indexOf(argvalue.substring(n, n+1)) == -1) return false;
return true;
}]]>
</javascript>
</validator>
<validator name="long"
classname="org.apache.struts.validator.FieldChecks"
method="validateLong"
methodParams="java.lang.Object,
org.apache.commons.validator.ValidatorAction,
org.apache.commons.validator.Field,
org.apache.struts.action.ActionErrors,
javax.servlet.http.HttpServletRequest"
depends=""
msg="errors.long"/>
<validator name="float"
classname="org.apache.struts.validator.FieldChecks"
method="validateFloat"
methodParams="java.lang.Object,
org.apache.commons.validator.ValidatorAction,
org.apache.commons.validator.Field,
org.apache.struts.action.ActionErrors,
javax.servlet.http.HttpServletRequest"
depends=""
msg="errors.float"
jsFunctionName="FloatValidations">
<javascript><![CDATA[
function validateFloat(form) {
var bValid = true;
var focusField = null;
var i = 0;
var fields = new Array();
oFloat = new FloatValidations();
for (x in oFloat) {
var field = form[oFloat[x][0]];
if (field.type == 'text' ||
field.type == 'textarea' ||
field.type == 'select-one' ||
field.type == 'radio') {
var value = '';
// get field's value
if (field.type == "select-one") {
var si = field.selectedIndex;
if (si >= 0) {
value = field.options[si].value;
} else {
value = field.value;
if (value.length > 0) {
// remove '.' before checking digits
var tempArray = value.split('.');
var joinedString= tempArray.join('');
if (!isAllDigits(joinedString)) {
bValid = false;
if (i == 0) {
focusField = field;
fields[i++] = oFloat[x][1];
} else {
var iValue = parseFloat(value);
if (isNaN(iValue)) {
if (i == 0) {
focusField = field;
fields[i++] = oFloat[x][1];
bValid = false;
if (fields.length > 0) {
focusField.focus();
alert(fields.join('\n'));
return bValid;
}]]>
</javascript>
</validator>
<validator name="double"
classname="org.apache.struts.validator.FieldChecks"
method="validateDouble"
methodParams="java.lang.Object,
org.apache.commons.validator.ValidatorAction,
org.apache.commons.validator.Field,
org.apache.struts.action.ActionErrors,
javax.servlet.http.HttpServletRequest"
depends=""
msg="errors.double"/>
<validator name="date"
classname="org.apache.struts.validator.FieldChecks"
method="validateDate"
methodParams="java.lang.Object,
org.apache.commons.validator.ValidatorAction,
org.apache.commons.validator.Field,
org.apache.struts.action.ActionErrors,
javax.servlet.http.HttpServletRequest"
depends=""
msg="errors.date"
jsFunctionName="DateValidations">
<javascript><![CDATA[
function validateDate(form) {
var bValid = true;
var focusField = null;
var i = 0;
var fields = new Array();
oDate = new DateValidations();
for (x in oDate) {
var value = form[oDate[x][0]].value;
var datePattern = oDate[x][2]("datePatternStrict");
if ((form[oDate[x][0]].type == 'text' ||
form[oDate[x][0]].type == 'textarea') &&
(value.length > 0) &&
(datePattern.length > 0)) {
var MONTH = "MM";
var DAY = "dd";
var YEAR = "yyyy";
var orderMonth = datePattern.indexOf(MONTH);
var orderDay = datePattern.indexOf(DAY);
var orderYear = datePattern.indexOf(YEAR);
if ((orderDay < orderYear && orderDay > orderMonth)) {
var iDelim1 = orderMonth + MONTH.length;
var iDelim2 = orderDay + DAY.length;
var delim1 = datePattern.substring(iDelim1, iDelim1 + 1);
var delim2 = datePattern.substring(iDelim2, iDelim2 + 1);
if (iDelim1 == orderDay && iDelim2 == orderYear) {
dateRegexp = new RegExp("^(\\d{2})(\\d{2})(\\d{4})$");
} else if (iDelim1 == orderDay) {
dateRegexp = new RegExp("^(\\d{2})(\\d{2})[" + delim2 + "](\\d{4})$");
} else if (iDelim2 == orderYear) {
dateRegexp = new RegExp("^(\\d{2})[" + delim1 + "](\\d{2})(\\d{4})$");
} else {
dateRegexp = new RegExp("^(\\d{2})[" + delim1 + "](\\d{2})[" + delim2 + "](\\d{4})$");
var matched = dateRegexp.exec(value);
if(matched != null) {
if (!isValidDate(matched[2], matched[1], matched[3])) {
if (i == 0) {
focusField = form[oDate[x][0]];
fields[i++] = oDate[x][1];
bValid = false;
} else {
if (i == 0) {
focusField = form[oDate[x][0]];
fields[i++] = oDate[x][1];
bValid = false;
} else if ((orderMonth < orderYear && orderMonth > orderDay)) {
var iDelim1 = orderDay + DAY.length;
var iDelim2 = orderMonth + MONTH.length;
var delim1 = datePattern.substring(iDelim1, iDelim1 + 1);
var delim2 = datePattern.substring(iDelim2, iDelim2 + 1);
if (iDelim1 == orderMonth && iDelim2 == orderYear) {
dateRegexp = new RegExp("^(\\d{2})(\\d{2})(\\d{4})$");
} else if (iDelim1 == orderMonth) {
dateRegexp = new RegExp("^(\\d{2})(\\d{2})[" + delim2 + "](\\d{4})$");
} else if (iDelim2 == orderYear) {
dateRegexp = new RegExp("^(\\d{2})[" + delim1 + "](\\d{2})(\\d{4})$");
} else {
dateRegexp = new RegExp("^(\\d{2})[" + delim1 + "](\\d{2})[" + delim2 + "](\\d{4})$");
var matched = dateRegexp.exec(value);
if(matched != null) {
if (!isValidDate(matched[1], matched[2], matched[3])) {
if (i == 0) {
focusField = form[oDate[x][0]];
fields[i++] = oDate[x][1];
bValid = false;
} else {
if (i == 0) {
focusField = form[oDate[x][0]];
fields[i++] = oDate[x][1];
bValid = false;
} else if ((orderMonth > orderYear && orderMonth < orderDay)) {
var iDelim1 = orderYear + YEAR.length;
var iDelim2 = orderMonth + MONTH.length;
var delim1 = datePattern.substring(iDelim1, iDelim1 + 1);
var delim2 = datePattern.substring(iDelim2, iDelim2 + 1);
if (iDelim1 == orderMonth && iDelim2 == orderDay) {
dateRegexp = new RegExp("^(\\d{4})(\\d{2})(\\d{2})$");
} else if (iDelim1 == orderMonth) {
dateRegexp = new RegExp("^(\\d{4})(\\d{2})[" + delim2 + "](\\d{2})$");
} else if (iDelim2 == orderDay) {
dateRegexp = new RegExp("^(\\d{4})[" + delim1 + "](\\d{2})(\\d{2})$");
} else {
dateRegexp = new Reg -
I am new to Flex web applications and I am doing research to see if functionality
contained in an existing web application can be replicated in a Flex web app.
We currently have a JSP / Struts based web application that creates a data entry
web view dynamically based on information that describes the different widgets and
their view locations as recieved from the application backend. We are looking at
migrating this application and this functionality to Flex.
When User X selects 1 of any number of data entry views, the Flex application would
receive data from the back end that contains information describing the different widgets
to display on the dynamic view: what type of widget to display ( text field,combo, line,
box, etc), the pixel specific positional information as to where each widget exists in the
view. These data entry views are not something the Flex developer designs or knows
what to expect from the backend. Flex has to generate the view on the fly based on the
information that describes the view.
The question: I fully expect there to be coding within the action scripts; before trying to
learn how to do this, is this something that Flex support.
Thanks,
BrianYep, we do something similar. We had to build out the infrastructure, but It works fine. E.g.,
var bDesc:XML = <button x="10" y="5" label="hello world" color="red"/>
var b:Button = new Button();
b.label = bDesc.@label;
b.x = bDesc.@x;
b.y = bDesc.@y;
b.setStyle('color', b.@color);
addChild(b);
In your app, the actual description (XML or other format) would be coming from the server. Then you just add it to the display list (and wire in any event handlers if necessary). In a real setting, you'll need error checking and a more formalized way of doing this, but it works reasonably well. No major snags. -
Dynamic Tray creation at runtime
hi experts,
we have a requirement where we are showing employee details in the tray UI element.
we have 1 tray at design time showing employee details obtained from a Bapi.
Now we need to display spouse details(if available) and children details(their number can be any~known at runtime) in seperate trays. eg each tray for 1 person..so if there are 6 children, there are 8 trays including one for employee and spouse...
Now what I need is the source code or method to dynamically generate tray at runtime along with the labels and textviews they contain..
thanks in advanceHI,
solved the problem....
i was doing some search here and there and finally got the code to do it. when i came back to the thread i found Ramesh suggested the same stuff which i had used.
thanks gurus.
I am writing my code here for other people looking for the same thing:
IWDTransparentContainer container =(IWDTransparentContainer)view.getElement("RootUIElementContainer");
wdContext.currentContextElement().setIpvalue("Demo Name"); //this is my context attribute.
for(int i=1;i<3;i++)
IWDTray tray=(IWDTray)view.createElement(IWDTray.class,null);
tray.setExpanded(false);
tray.setWidth("700px");
IWDLabel label=(IWDLabel)view.createElement(IWDLabel.class,null);
label.setText("your name is");
IWDTextView textview1=(IWDTextView)view.createElement(IWDTextView.class,null);
textview1.setText(wdContext.currentContextElement().getIpvalue());
IWDLabel label1=(IWDLabel)view.createElement(IWDLabel.class,null);
label1.setText("Employee age");
IWDCaption caption =(IWDCaption)view.createElement(IWDCaption.class,null);
caption.setText("WElcome to employee information");
tray.setHeader(caption);
IWDLayout layout=(IWDLayout)tray.createLayout(IWDMatrixLayout.class); //setting tray layout to matrix
IWDLayoutData layout1=(IWDLayoutData)label1.createLayoutData(IWDMatrixHeadData.class);
tray.addChild(label);
tray.addChild(textview1);
tray.addChild(label1);
container.addChild(tray);
P.S. Awarding points to Ramesh. -
Dynamic Report Creation At Runtime
I am trying to create a dynamic crystal report at run time from Visual Studio 2013 using C#. My back end database is SQL Server 2005. The source for my crystal report is a SQL Server stored procedure which takes two parameters, a year (smallint) and a quarter (tinyint). The stored procedure uses dynamic SQL and creates a dynamic temp table. It returns the result set from a select on the temp table. The number of columns in the result set will be determined at run time. Right now it returns 40 columns. It can return additional columns in multiples of 6. All of these columns will need to be displayed on the crystal report at run time. The C# application will run on 64 bit Windows 7 machines and the SQL Server database is on a 32 bit server.
I have been successful in designing a crystal report within the Visual Studio IDE using this stored procedure and running it and displaying it in the crystal reports viewer from within the C# application. So when the appropriate application's menu item is clicked, the form with the crystal viewer on it opens and displays the report. So I know that I can connect to the database and display the report. However as stated in the preceding paragraph, I need to create the crystal report at run time as the number of columns on the report will be variable.
I have looked at the CrystalDecisions SDK and API and tried without success to do this. I am getting errors when trying to connect to the DB through the API and am not able to retrieve the data. I have played with the code for about a week with no success. I have tried the code in the discussion forums without success. The documentation for the SDK API's does not provide the level of detail that I need. The CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfo class has an attributes property that needs to be set. I don't know what the proper settings should be.
I prefer to use the OLE DB native client for SQL Server.
Any help would be greatly appreciated.
MartinHi Ludek,
I have made some small progress. I can now login from work as well as get to links. But it seems I am still blocked for zip files.
I also have the utility working. But whenever I try to add my dummy crystal report (dummyreport.rpt) to the project, visual studio 2013 hangs up and I have to kill VS.
I added the following code to my form and ran it but I get the following error:
System.Runtime.InteropServices.COMException was unhandled
HResult=-2147352565
Message=Invalid index. (Exception from HRESULT: 0x8002000B (DISP_E_BADINDEX))
Source=CrystalDecisions.ReportAppServer.DataDefModel
ErrorCode=-2147352565
StackTrace:
at CrystalDecisions.ReportAppServer.DataDefModel.TablesClass.get_Item(Int32 Index)
at Retail_Incentive_Plan.ReportForm3..ctor() in u:\Incentive\Front_End\Visual_Studio_2013\Projects\Retail_Incentive_Plan - Copy\Retail_Incentive_Plan\ReportForm3.cs:line 123
at Retail_Incentive_Plan.MDIParent.ShowNewForm(Object sender, EventArgs e) in u:\Incentive\Front_End\Visual_Studio_2013\Projects\Retail_Incentive_Plan - Copy\Retail_Incentive_Plan\MDIParent.cs:line 27
at System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
at System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ToolStrip.WndProc(Message& m)
at System.Windows.Forms.ToolStripDropDown.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at Retail_Incentive_Plan.Program.Main() in u:\Incentive\Front_End\Visual_Studio_2013\Projects\Retail_Incentive_Plan - Copy\Retail_Incentive_Plan\Program.cs:line 18
InnerException:
The error occurs at this line of code:
boReportDocument.ReportClientDocument.DatabaseController.SetTableLocation(boTables[0], boTable);
I'm sure it must be something with the attributes that I am setting. But I'm not sure of what the correct values for some of these attributes should be. By the way, I am using the RCAPI approach rather than the formulas approach (for now).
Here is my code that is in the form:
public ReportForm3()
//************************** ChangeConnectionInfo ******************************************************************************************************************
ReportDocument boReportDocument = new ReportDocument();
//**EDIT** Change the path and report name to the report you want to change.
boReportDocument.Load(@"c:\Retail_Incentive_Plan\DummyReport.rpt", OpenReportMethod.OpenReportByTempCopy);
//Create a new Command Table to replace the reports current table.
CrystalDecisions.ReportAppServer.DataDefModel.CommandTable boTable =
new CrystalDecisions.ReportAppServer.DataDefModel.CommandTable();
//boMainPropertyBag: These hold the attributes of the tables ConnectionInfo object
PropertyBag boMainPropertyBag = new PropertyBag();
//boInnerPropertyBag: These hold the attributes for the QE_LogonProperties
//In the main property bag (boMainPropertyBag)
PropertyBag boInnerPropertyBag = new PropertyBag();
//Set the attributes for the boInnerPropertyBag
boInnerPropertyBag.Add("Auto Translate", "-1");
boInnerPropertyBag.Add("Server", "MyServerName");
boInnerPropertyBag.Add("Connect Timeout", "15");
boInnerPropertyBag.Add("Data Source", "vancsdb02");
boInnerPropertyBag.Add("General Timeout", "0");
boInnerPropertyBag.Add("Initial Catalog", "Retail_Incentive_Plan");
boInnerPropertyBag.Add("Integrated Security", "True");
boInnerPropertyBag.Add("Locale Identifier", "1033");
boInnerPropertyBag.Add("OLE DB Services", "-5");
boInnerPropertyBag.Add("Provider", "SQLOLEDB");
boInnerPropertyBag.Add("Tag with column collation when possible", "0");
boInnerPropertyBag.Add("Use DSN Default Properties", "False");
boInnerPropertyBag.Add("Use Encryption for Data", "0");
//Set the attributes for the boMainPropertyBag
boMainPropertyBag.Add("Database DLL", "crdb_ado.dll");
boMainPropertyBag.Add("QE_DatabaseName", "Initial Catalog=Retail_Incentive_Plan");
boMainPropertyBag.Add("QE_DatabaseType", "OLE DB (ADO)");
//Add the QE_LogonProperties we set in the boInnerPropertyBag Object
boMainPropertyBag.Add("QE_LogonProperties", boInnerPropertyBag);
boMainPropertyBag.Add("QE_ServerDescription", "MyServerName");
boMainPropertyBag.Add("QE_SQLDB", "True");
boMainPropertyBag.Add("SSO Enabled", "False");
//Create a new ConnectionInfo object
CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfo boConnectionInfo =
new CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfo();
//Pass the database properties to a connection info object
boConnectionInfo.Attributes = boMainPropertyBag;
//Set the connection kind
boConnectionInfo.Kind = CrConnectionInfoKindEnum.crConnectionInfoKindCRQE;
//**EDIT** Set the User Name and Password if required.
boConnectionInfo.UserName = "myUserName";
boConnectionInfo.Password = "MyPassword";
//Pass the connection information to the table
boTable.ConnectionInfo = boConnectionInfo;
//Get the Database Tables Collection for your report
CrystalDecisions.ReportAppServer.DataDefModel.Tables boTables;
boTables = boReportDocument.ReportClientDocument.DatabaseController.Database.Tables;
//For each table in the report:
// - Set the Table Name properties.
// - Set the Command table's command text.
// - Set the table location in the report to use the new modified table
boTable.Name = "Command";
boTable.QualifiedName = "Command";
boTable.Alias = "Command";
//boTable.CommandText = "select country, region, city from customer where country='usa'";
boTable.CommandText = "exec get_branch_ranking_data, 2015, 1";
boReportDocument.ReportClientDocument.DatabaseController.SetTableLocation(boTables[0], boTable);
//Verify the database after adding substituting the new table.
//To ensure that the table updates properly when adding Command tables or Stored Procedures.
boReportDocument.VerifyDatabase();
//return boReportDocument;
//************************** End ChangeConnectionInfo ***************************************************************************************************************
I'm sure that "vancsdb02" is incorrect in the Data Source in the code above but I'm not sure what goes there.
All of my assemblies are set in my project as well as in the top of my code. I just didn't show it here for brevity.
Will pick up again with this on Monday.
Martin -
Dynamic re-creation of Entity/View Objects
Does anybody know if the following is possible with JDeveloper/ADF, and if so, any suggestions on where to start?
My boss wants to be able to re-define a series of database views dynamically at any time, adding/removing columns. This will be handled by PL/SQL etc so it is not part of the JDeveloper question.
But he then wants the J2EE Swing GUI application to be able to "see" the changes to the view immediately e.g. to display new fields on the client form, without having to re-compile any code.
The Swing GUI appears to be a given, unfortunately as it would be easier to re-create at least the GUI dynamically using JSP etc.
Right now, I'm trying to figure out how to pass the database changes through the J2EE tiers e.g. how do I dynamically re-define the Entity Object based on the modified view, without re-compiling it? How do I reflect these changes in the corresponding View Object(s)?
Personally I think this requirement will be the death of the project, as it will absorb 95% of our limited intellectual/Java resources for 5% of the functionality: Welcome to Dilbertland!
But given this requirement, does anybody out there have any ideas?
Thanks,
ChrisHi Chris ,
well you can always create dynamic attribute in the view object using viewObject.addDynamicAttribute(DynamicAttributeName);
and you can store any serialazable object in this attribute like any other attribute. It should be serializable coz BC4J needs to send it to Database in case you are using spillover feture
to cache records.
you can also create Dynamic view object based on an entity or a SQL query.
AppModule.createViewObjectFromQueryStmt();
But of course dynamic view based on SQl Query
will not be updatable. I doubt , You can dynamically create attribute on Entity or dynamic Entities.
I have already posted one question for this ..and waiting for reply ..:-(
Updatable , Dynamic VIEW OBJECT ??
hope it'll help
Prasoon -
Dynamically (auto) creation of ODS based on a key or reaching a max size
BW 3.5 Receiving data from a RDBMS (likely dbconnect):
I am working for an aviation company where we are expecting to receive large number of records from flying aircrafts. Since the number of aircraft could be in thousands and data could reach 2 GB per flight, we must create ODSs dynamically. Firstly, a new ODS should be created for a new plane as the plane sends in first chunk of data. Secondly if an ODS reaches to a certain size, we would like to create a new one just so that the size wouldn't kill performance. Lastly we have to also store binary data in the ODS.
Any ideas? Clue or code for creating an ODS dynamically and not messing the BW system integrity. Also best way to deal with binary data in an ODS table.
I'll appreciate any ideas and examples of succesful implementations. Thanks a lot.Hi!
Actually, you can use the search feature in your guide. Just press Menu and go to search and you can search for a program by keywords there. Once you find the program you're looking for, you can click on it and set it to record either as a series recording or a one time recording instead. We hope that this helps you as for the search function.
Thanks,
CJ
Maybe you are looking for
-
Hi , APPLn users are getting the below 2 errors when executing a job ORA-02068: following severe error from CONNECT_TO_ERJ ORA-03113: end-of-file on communication channelUser-Defined Exception Any idea what could be the reason for this Thanks, Kr
-
What are the advantages to adding a server to my home/home office system?
What are the advantages to adding a server to my home/home office system?
-
I was browsing through the top charts and I found Pages, Numbers, iMovie and iPhoto in the free section so i clicked the buttons with the prices and clicked buy because I thought they were free but I'm not sure now if they really are. Can someone ple
-
I have not been able to activate spell checker in my new installation, help.
I have installed the newest available version of Thunderbird by automatic download. I cannot activate the spell checker. All the apparent steps have been completed; however, there are no flags as I write and no response when I ask for check at the en
-
I was browsing through 2 Day + Performance Tuning Guide documentation for 11g Release 2 (11.2) and found this: http://docs.oracle.com/cd/E11882_01/server.112/e10822/tdppt_transient.htm#CHDIHIEB From the Performance Home page, select the Performance m