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

Mohammed Niaz M.

Greenhorn
+ Follow
since Apr 28, 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 Mohammed Niaz M.

Hi Guys
Oops i did it..today i cleared scjp and thanks to K&B for their wonderful book and to Khalid as well.
14 years ago
Hi All,
I purchased the scjp1.4 voucher before june23 and now i planning to give the exam and its free to retake the exam and how to do this, whats the procedure register the retake scjp exam.


Thanks in Advance..
JSP

------Help.jsp----


-----------------------------
In this JSP page i have to add the table rows dynamically ....How can i do this ....?.


[BSouther: Added UBB CODE tags]
[ August 16, 2007: Message edited by: Ben Souther ]
14 years ago
JSP
Hi All,

I want to do pagination using jsp & struts. Im using my own taglib which is like

<inte ageindex
pageIndex='<%=new PageIndex(startIndex,records_per_page,total_records) %>'
url='<%="A.do?event=list&startIndex="%>'
submitFlag='<%=new Boolean(false)%>
</inte>


I have to get the values from the external file which is in *.csv format.

From class file,im storing all values in Collection and passing to JSP page.

In Jsp page
-----------
<%
Collection OBList = (Collection)request.getAttribute("request.OBAList");
int startIndex = 0;
if (OBList != null && OBList.size() > 0) {
pageContext.setAttribute("OBList",OBList);

}


%>

Using the OBList collection able to load all the records to the Jsp page and its working fine but here the problem is i have to disply it according to the pagination link.

the sample link looks like ===> pg 1 2 3 Next

If i use this PageIndex(0,5,15) the URL is
After click the number 2 the URL
The URL:http://localhost:7080/training/A.do?event=list&startIndex=5


Thanks in Advance.
14 years ago
Hi All,
How to convert String to Collection.

Example:

Collection c = null;
String str = "News";

c = (Collection)c.?();


Whether it is possible to convert the string to collection.
OR Is there some other procedures to get the collection from string.

Thanks in Advance.
Hi Merrill,
Im using struts based framework but some additional classes are added they are Mapper,Commands,Declared input parameters and output results � controlled scope.
Im using AAction n AForm.

The Action File
----------------

AForm
-----

AMapper Class
-------------


DeleteACommand Class
--------------------


AHelper Class
--------------


AProxy Class
------------


ListA.jsp
---------


AForm Class
-----------

---------------------------------------------------------------------------

Still im able to delete only one Name.

Can you help out..

Thanks in Advanced
-- Added UBB [ c o d e ] [ / c o d e ] tags to make code easier to read
[ July 06, 2007: Message edited by: Merrill Higginson ]
14 years ago
Hi Merrill,
still im not able to delete more than one name
Javascript:
-----------
var boxes = document.getElementsByName('name');
var uri = 'A.do?event=delete';
var atLeastOneBoxChecked = false;
for (var i=0;i<boxes.length;i++) {
if (boxes[i].checked) {
atLeastOneBoxChecked = true;
uri = uri + "&name=" + boxes[i].value;
deleteNameList[i] = boxes[i].value; //Added
}
}
if (atLeastOneBoxChecked) {
document.forms[0].action=uri+"&deleteNameList"+deleteNameList;
document.forms[0].submit();
}
------------------
<html:multibox property="name" value="<% OB.getName() %>" />
----------------------Whether i pass the value array instead of OB.getName() to bean

In Formbean
----------
i decalred

String[] deleteNameList;

public String[] getDeleteNameList(){
return deleteNameList;
}

public void setDeleteNameList(String[] deleteNameList){

this.deleteNameList = deleteNameList;
}


public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}


--------------------------------------
In the URL:
http://localhost:7080/training/A.do?event=delete&name=fds&name=hyg&deleteNameListfds,,hyg

The deleteNameList array is passing to bean but i cannt assign the multi-value to name field or deleteNameList

------------------------------------

Thanks In Advanced.
14 years ago
Hi Merrill,
Thanks for your reply and its working but i have to work in Action to perform the deleting more names.
I let you know the process.
14 years ago
Hi All,
Its a struts project.
Im using html:multibox tag and it use to select the multi boxes and delete the selected boxes.

In this im having fields like name,dob,age,height,country..

Im not cleared about how to use the multiboxes, below is the code.

In listA.jsp page
-----------------
<input name="submit3" type="button" value="Delete"
calling "deleteUsers()" /></td>

<logic resent name="OBList">
<% int count = 0; %>
<logic:iterate id="OB" name="OBList" type="com.integrosys.cms.ui.test.bus.OBA" scope="page">
<tr class="<%=count++%2==0?"even":"odd"%>">
<td class="index"><%=count%></td>
<td><%=OB.getName() %></td>
<td><%=OB.getDob() %></td>
<td><%=OB.getAge() %></td>
<td><%=OB.getGender() %></td>
<td><%=OB.getHeight() %></td>
<td><%=OB.getWeight() %></td>

<td><%=AHelper.getCountryName(OB.getCountry()) %></td>
<td style="text-align:center"><select name="select3" onChange="JumpOnSelectactive(this, '<%=OB.getName() %>')">
<option selected="selected" >Please Select</option>
<option value="edit">Edit</option>
<option value="view">View</option>
<!--option value="delete">Delete</option-->
</select>
</td>
<td><html:multibox property="name" value="<%=OB.getName()%" /></td>
</tr>
</logic:iterate>
</logic resent>

Scripting
----------
delete(){
document.forms[0].action="A.do?event=delete&name=";(how to pass the multi name )
document.forms[0].submit();
}

Thanks in Advanced
14 years ago
import static java.lang.System.out;
------

Im getting syntax error static 'Identifier ' expected.
package sam;

class A{
int a=1;
public void AA(){
System.out.println("AA");
}
}
class B extends A{
int a=2;
public void AA(){
System.out.println("BAA");
}
}


class Form{
public static void main(String args[]){

A sup = new B();
sup.AA();
System.out.println("A:"+sup.a);
}
}
--------------------------------------------------------------
output is : BAA A:1

Why it's printing A=1 instant of A:2
Because its calling the method in subclass.

Thanks in Advance.
--------------------------------------------
1.

String Str = "A";
String lStr = "A";

The Str n lStr are stored in the same Heap memory?

--------------------------------------------
2.
String Str = "A";
String lStr = new String("A");

The Str n lStr are Different means stored in different locations(Heap),
The new operator do the tricks here?

----------------------------------------------

3.

String Str = new String("A");
String lStr = new String("A");

These two strings are stored in same heap locations?

-------------------------------------------------------

Thanks in Advance.
String Str = "A";
String lStr = new String("A");

System.out.println(Str.equals(lStr));
System.out.println(Str == lStr); // line 1

output: true false

Code 2:
String Str = null; //Line 3
String lStr = new String();

Str = "A";
lStr = "A";
System.out.println(Str.equals(lStr));
System.out.println(Str == lStr); //line 2
----------------------------------
In code:1 the Str n lStr are differents string objects.
From your reply i understood that the String is reassign then the NEW reference to that String object will lost. Then it is same as the String Str?
Code 1:

String Str = "A";
String lStr = new String("A");

System.out.println(Str.equals(lStr));
System.out.println(Str == lStr);

output: true false

Code 2:
String Str = null;
String lStr = new String();

Str = "A";
lStr = "A";
System.out.println(Str.equals(lStr));
System.out.println(Str == lStr);

output : true true

------------------------
Why in code 1 while using '==' operator its giving "false"
and Why code 2 ==> true.
Code:1
String str = null; //Line 1
String lStr = new String();

str = "";
lStr = "";
if(lStr.equals(str)){
System.out.println(str.equals(lStr));
}else{
System.out.println("Else");
}
------------------------
Code:2
String str = new String;//Line 2

String lStr = new String();

str = "";
lStr = "";
if(lStr.equals(str)){
System.out.println(str.equals(lStr));
}else{
System.out.println("Else");
}
---------------
The outputs are true,true.
The line 1 and 2 are the same.

In code 1 str is set to null and its storage is differ from lStr?