This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have David & Dawn Griffiths on-line!
See this thread for details.
Win a copy of Head First Android this week in the Android forum!

Diptee Bhakre

Greenhorn
+ Follow
since Apr 06, 2010
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 Diptee Bhakre

Hi All,

I am not able to retain drop down values after submitting form in my jsp.
My jsp is as follows.

<form name="branch" target="_top" action="" method="get">
<select name="searchDropDown" id="br">
<option value="Select Entity to search">Select Entity to search</option>

<option value="MN">main</option>
<option value="EX">examples</option>
<option value="TR">training</option>
<option value="IC">content</option>
<option value="EU">europe</option>
</select>
<input type="text" name="searchText" value="<%=searchText%>" />
<input type="submit" name="submit" value="submit" onClick="validate();"/>

I am able to retain my text box value. But unable to do so for dropdown "searchDropDown".

Thanks in advance.
11 years ago
JSP
I am facing problem in my jsp.
I am calling same jsp called a.jsp when I click my submit button. I want to call getList() to call once when jsp is calling for first time and when submit is click , no need to call getList(). I am doing some opreation on arraylist provided by getList(). Could any body help me how I can achieved it? My jsp and java code is posted here. My code is as follows.
<%@page import="Processor"%>
<%@ page import="java.util.*, java.sql.* ,java.io.*"%>
<jsp:useBean id="bean" class="Processor" scope="session">
</jsp:useBean>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<form name="branch" target="_top" action="" method="get">
<input type="submit" name="submit" value="submit"/>
</form>
<%! ArrayList list = new ArrayList(); %>
<%
if(!session.isNew())
{
list=bean.getList();

for (int i=0;i<list.size(); i++)
{

out.println("List is" + list.getList(i));

}
}
%>
</body>
</html>

Nd My bean class is as follows.
import java.io.*;
import java.util.*;

public class Processor
{
ArrayList allBranchList = new ArrayList();
public ArrayList getList()
{

try
{
String lineData = null;
File f = new File("C:/abc.txt");
FileReader fr = new FileReader(f);
BufferedReader bfr = new BufferedReader(fr);
while((lineData = bfr.readLine())!= null)
{
allBranchList.add(lineData);
}
}
catch( Exception e)
{
e.printStackTrace();
}
return allBranchList;
}


public static void main(String args[])
{


}

}


Thanks in advance.


11 years ago
JSP