Goutam Chowdhury

Ranch Hand
+ Follow
since Jan 20, 2009
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
3
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 Goutam Chowdhury

Jeff Verdegan wrote:

Goutam Chowdhury wrote:For your case n=5....



Please don't do that. This site is NotACodeMill. Doing the OP's work for him does not help him learn, and as it clearly states on the topic list page, "We're all here to learn, so when responding to others, please focus on helping them discover their own solutions, instead of simply providing answers."



Sorry Jeff...I thought It will help him with explanation
12 years ago
One thing is.....always you need to think as row and column .....one loop for row another loop for column...that should be the starting trick...

Like for yuor case..
Row1 numbers of columns 1
Row2 numbers of columns 3
Row3 numbers of columns 5.
...
...
....
Rown numbers of column n+2


12 years ago
First of all its a very good practice to think about coding logic...
Anyway as per my knowledge ..
null is a type of char[] as well as type of String ....so compiler not able to solve which overloaded method to call
Same thing happen below....
Little more


Thanks both of you ...Jeff and Winston....
I have some thing to share......

println(String ) calls print(String)

But println(Object ) ....... first take string value of this Object using String.valueOf() and then finally call print(String)

12 years ago
@Jeff
Actually I mean to say that whenever we pass only a ref to println,then its toString() method is called...

Thanks
12 years ago
Hey Guys,
I found my ans.
PrintSteam.println()-->print()

Thanks all of you
12 years ago
Please have look into below code


Op- null
NullPointerException
Now as per my knowledge when we try to print any object then its toString() method will be called.In this case I am trying to call manually ,but as ref is null its throws a NullPointerException.
If it is true ,then my question is ...How toString () metohd getting called when we try to print any object ???

12 years ago
Sorry This this


12 years ago
JSP
Please copy and paste this below code and let me know

<%@ page language="java" pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@ page import="java.io.*,java.sql.* ,ams.database.*,javax.servlet.http.*,javax.servlet.*"%>
<html>
<head>
<%
response.setHeader("Cache-Control","no-cache"); //HTTP 1.1
response.setHeader("Pragma","no-cache"); //HTTP 1.0
response.setDateHeader ("Expires", 0); //prevents caching at the proxy server
%>
<script language="JavaScript">
function loadPage(list)
{
document.checkbox.SelectedIndex.value=list.options[list.selectedIndex].text;
location.href=list.options[list.selectedIndex].value;
document.checkbox.submit();
}
</script>

</head>
<body style=" background-color:#FFFFCC;">
<form name="checkedbox" method="post" action="map.jsp">


<%
try
{
Connection connection =new database().getConnection();
Statement s=null;
Statement st =null;
Statement st1=null;

ResultSet rs =null;
ResultSet rst=null;
ResultSet rst1=null;

s=connection.createStatement();
st = connection.createStatement();
String SelectedIndex=request.getParameter("SelectedIndex");

int id=0;
%>
<%
rs=st.executeQuery("SELECT * from ams_division;"); //"SELECT * from ams_division;"
rst=s.executeQuery("Select * from sec_code ;"); //"Select * from sec_code;"
%>
<input type="hidden" name="SelectedIndex"/>
<select name="combo" id="" onchange="loadPage(this.form.elements[0])" >
<% while(rs.next()){

if(SelectedIndex!=null && SelectedIndex.trim().eualIgnoreCase(ars.getString(2)))
{%>
<option value="mapping.jsp" SELECTED ><%=rs.getString(2) %></option>
<%}else{
%><option value="mapping.jsp" ><%=rs.getString(2) %></option>
<%}%>
<option value="adddiv.jsp">Add New</option>
</select>



Check the Sections of above selected division





<% while(rst.next()) { %> <% }%>
Sec. No.Sec. NameLogin Id
<input type="checkbox" name="section" value="<%=rst.getString(2) %>"/><%=rst.getInt(1) %><%=rst.getString(2) %><%=rst.getString(3) %>

<%
}
catch(Exception e)
{
}
%>


<input type="submit" value="submit" />
</form>
</body>
</html>
12 years ago
JSP
1. What is your main jsp name ?is it "mapping.jsp"
2. Modify your Js function


Check whatever you are selected its showing in the alert message
3.If you select any option except last one which jsp page you are getting "mapping.jsp" or "map.jsp" or "adddiv.jsp"

12 years ago
JSP
Hi Aditi,
I made a static html from code and named it as 1.html
I think its working fine....
Please check my code and confirm me you are getting expected result or not...


12 years ago
JSP