Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS forum!

Rajaprabhu Aravindasamy

Greenhorn
+ Follow
since Dec 26, 2011
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 Rajaprabhu Aravindasamy

Hai.., Mohan Rao...

I know how to use iterator...! Please read my post fully and then reply for that..!
I am seeking a solution to pass array of arraylist into the value attribute..!
or pass dynamic values to the value attribute in iterator..!

The following code is working, if i set the array index as 0 but i need to pass the dynamic values from the loop (0,1..n)...,

<% for(some condition)
{ %>
<s:iterator value="display.arr[0]">
.
.
</s:iterator>

<% } %>

8 years ago
Hello guys...!

I am having a problem with assigning dynamic values with value attribute of ITERATOR..!
My problem is..,

I had added some details into an array of arraylist in action class.[ ArrayList[] arr=new ArrayList[cnt] ...... arr[i].add(somebean)]
So in the arraylist 'arr', each cell is containing an arraylist i.e) group of objects.
And i had written a getter in the action class.[ public ArrayList[] getDetails(){ .... } ]

My question is..,
how can i access that array of arraylist in jsp with ITERATOR..?
Is there any way to pass dynamic values(0,1,..n) to the value attribute in ITERATOR..?

please refer the following code to analyse my scenario..!

(display-> dto objecj.
arr-> array of arraylists.)



i want to change the value in the place of question mark dynamically..! please help..!
alternative ways will also be appreciated..!
8 years ago
Hello guys..!

I having a doubt regarding accessing an array of arraylist in jsp using iterator tag.

In my action class i used the following codes..,

ArrayList[] arr= new ArrayList[10];

for(int i=0;i<10;i++)
{
arr[i]=new ArrayList<bean>();
}
.
.
.
while(some conditions)
{
arr[i].add(new bean(some values));
i++;
}


My question is, how can i access the values of arr[0],arr[1]...a[10] in JSP page using iterator.

<s:iterator value=???> <s:property value=beanvalues /> </s:iterator>

In the place of question mark what i need to replace to access the values of arr[0]...a[10] present in arr..? please give me a solution soon...!
8 years ago
Hello guys..!

I got a problem while using display:table tag in my page.
Currently i am using the default style for the paging banner in my page.
And rather than that, i just added some properties to it. My problem is, to
change the appearance of the paging banner completely to the client's expected
format.please refer my attachments and just give me a possible solution to my problem soon.

8 years ago
Hello guys..!

Can we return any other string(for example, String val="hello"; ........ return val; ) from execute method rather than success,error,input,none and login..?
If possible.., then tell me how can we map it in struts.xml , whether in normal way or any specific way to achieve that..?

Thank you..!
8 years ago
Thank you..! Komal Renu..!

I have fixed my problem by using the similar way that you are saying..

My approach was,

I created a bean for the form datum(as you said..!).
and then i just used ModelDriven interface in my action class to get the values from bean..!

Any way thank you very much for your help..!
8 years ago
@ Komal Renu

Here is my JSP code snippet..,

<tr>
<th>
<div align="right">
メールアドレス(Mail Address)
</div>
</th>
<td>
<s:property value="MailAddress" />
<input type="hidden" name="MailAddress" value="<s:property value="MailAddress" />"/>
</td>
</tr>

actually the snippet is from a confirmation page that is proceeding to Insert action.
So i need the mail address in my action to set it in my DTO object.
the code is,

UserDTO obj=new UserDTO(); // In UserDTO.java, i had written the getters and setters for all the fields
obj.setMailADDRESS(?); // i need to pass the mail address in the place of question mark

UserDAO obj1=new UserDAO();
obj1.Insert(obj); // here i'm passing the object of DTO.., so that i can manipulate the mail address in DAO using the DTO object(obj.getMailAddress()).

This is my exact scenario.. Correct me if anything i did wrong..!

Thank you..!


8 years ago
You may use DTO objects to achieve your requirement..
8 years ago
@Komal Renu

Thank you very much for your reply..!

Generally we are using getters and setters in our action classes to get values from JSP pages
and pass values to JSP pages through OGNL.
But in order to minimize those complexity of writing getters and setters every time, we go for DTO..
So that i asked a doubt(getting value from JSP in action class with out getters and setters) like that..

I'm just a learner of Struts2 now. Please correct and guide me if my above thoughts are wrong and
give me the example code to set the values to DTO in action class from JSP..!

Thank you..!

8 years ago
Hello guys..!

I'm having a doubt in setting a value to the DTO object in my project.

we can set a value directly to DTO object like the below code..,

User user=new User();
user.setUserId(1);
user.setName("Jinoy P George");
user.setDesignation("Programmer");
user.setAge(35);

But my doubt is how can we set a value to DTO object from a JSP form with out using getters and setters...!

User user=new User();
user.setUserId(?);
user.setName(?);
user.setDesignation(?);
user.setAge(?);

What may come in the place of question mark..? please post me a reply soon..!
8 years ago
Hello guys..!
I'm a newbie to struts, just learning it from the beginning..!

my question is,

" <package name="someName" extends="struts-default"> tag is a must part in Struts.xml or not...?
If yes then tell me what is the reason or necessity behind that..? "

I know my question is very silly. But please post me the reply soon...!
8 years ago
You can use a hidden fields in a form to accommodate the values...!
and you can use it in the next jsp page/Action class by submitting that form by using Java script..!
8 years ago
Hello guys...!
Can we get the page number that is currently displaying in the screen..?
if this is possible.., please explain how to access the page number in jsp page with syntax..!


i meant the following as page number...
[ First / Prev] 1, 2 [Next / Last]

Thanks in advance..!
8 years ago
hello guys..!

Currently i'm using display tag to print data in the form of table with page limit.
It is working perfectly.., But my problem is i want to display more than one property with single <display:coloumn> tag..!

it is something like,,

<display: table name="test" pagesize="2" requestURI="/tester/hello">
<display:coloumn title="DETAILS">
<display:coloumn property="value1"/>
<display:coloumn property="value2"/>
</display:coloumn>
</display:table>

I know that, the above code is completely foolish..,
but i need to execute a code very similar to that in functionality.., Please help me to fix my prob soon...!

Thanks in Advance..!
8 years ago
Yeah its working but guys i need to access the whole array in the jsp page..!
something like..

<% String s[]=%><s:property value="#session.array[]"/><% ; %>

I know it is wrong, but i need a solution similar to this..!
please post it soon...!
8 years ago