cancel
Showing results for 
Search instead for 
Did you mean: 

Display of date& day and image and image as being link to other iView

Former Member
0 Kudos

Hi

As I stated the Subject,

I want to display the system date in View in the following format.

"Wednesday, September 21st, 2005"

Is there any way I can get this in the view.

I have an application in which the an image is shown in the Image Area. Thae image has to be picked and displayed randomly from a set of images in the image area. How do we achieve this?? is this possible in Web Dynpro.

And I have to provide Image as link to other View. Is this possible??

I would be too happy if some one can suggest some thing in this regard.

Thanks a million in advance

Srikant

View Entire Topic
Former Member
0 Kudos

Hi Srikant,

1) Use these lines of code to diplay the system date in the required format:

String day = (new SimpleDateFormat("EEEEEE, MMMMMM dd , yyyy").format(new Date()));

wdComponentAPI.getMessageManager().reportSuccess("Date::"+day);

2) Store your images in your components folder. Bind the 'source' attribute of your image to a string attribute say for eg: 'src'. Now create a simple type of string and in it's enumeration, store you image names as key-value pair. For eg : '0 pic1.jpeg', '1 pic2.jpeg' etc. Then create an attribute of that type in your view context.

Let the total no: of images be n;

then write these lines of code to populate the image randomly:

int a = (int)((Math.random()*100)%(n-1));

String attributeName = IPrivate<your_view>View.IContextElement.<your_simpletype_attribute>;

IWDAttributeInfo attributeInfo = wdThis.wdGetContext().getNodeInfo().getAttribute(attributeName);

ISimpleType simpleType = attributeInfo.getSimpleType();

ISimpleValueSet valueset = simpleType.getSVServices().getValues();

Object key = valueset.getKey(a);

String val = valueset.getText(Integer.parseInt((String)key));

wdContext.currentContextElement().setSrc(val);

This will show images randomly on each execution

3) Store the image that you want to display as the link in your components folder.create a LinkToAction UI element and give the 'imageSource' as your image name. Now in the action you create for LinkToAction, you can write the code for firing the plug to your second view.

Hope this helps,

Best regards,

Nibu.