This week's book giveaway is in the Java in General forum.
We're giving away four copies of Event Streams in Action and have Alexander Dean & Valentin Crettaz on-line!
See this thread for details.
Win a copy of Event Streams in Action this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

Please solve the problem.

 
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I have some problem in including a jsp file dynamically.
please help me in solving it....

here is Admin.jsp >>>>>>>>>>

<%
String action= (String)request.getAttribute("action");

%>

<HTML>
<HEAD>
<TITLE> Administrator</TITLE>

</HEAD>
<body>
<table width="100%" border="5" height="100%">
<tr>
<th>User Administrator Task</th>
</tr>
<tr> <td>
<table>
<tr><td>
<%
if(action.equals("addExe")){
%>
<jsp:include page="AddExe.jsp" flush="false"/>
<%
}%>
</TD> </TR>
</table>
</td></tr>
</table>
</BODY></HTML>

In this file when action=addExe then it will including AddExe.jsp using<jsp:include>
__________________________________

here is AddExe.jsp <<<<<<<<<<<<<<<<<<<


<%
String selectServer=(String)request.getParameter("server");
String selectService=(String)request.getParameter("service");
%>
<html>
<head>
<title>Add New Executable</title>
</head>

<body>
<table>
<tr><td>
<form method="get" action="AdminTask.jsp" name="serverForm" id="serverForm">
<table>
<tr><td>
Select Server :
</td><td>
<select name="server" onChange="document.serverForm.submit();" >
<%
if(selectServer!=null && !selectServer.equals("Select Server")){
%>
<option><%=selectServer%></option>
<%
}else
%>
<option>Select Server</option>
<%
Databaseservers=DataBaseFactory.getInstance();
ListserverList=servers.getServers();
Iterator iter=serverList.iterator();
while(iter.hasNext()){
String serverName=((Server)iter.next()).getName();
%>
<option value="<%=serverName%>"> <%=serverName%> </option>
<%
}
%>
</select>
</td></tr>
</form>
</tr></td>
<tr><td>
<form method="get" action="AdminTask.jsp" name="serviceForm" id="serviceForm">
<tr><td>
Select Service :
</td><td>
<select name="service" onChange="document.serviceForm.submit();" >
<%
if(selectService!=null && !selectService.equals("Select Service")){
%>
<option><%=selectService%></option>
<%
}else
%>
<option>Select Service</option>
<%
Database services = DataBaseFactory.getInstance();
ListserviceList=services.getServices(selectServer);
Iterator serviceIter=serviceList.iterator();
while(serviceIter.hasNext()){
String serviceName=(String)serviceIter.next();
%>
<option value="<%=serviceName%>"> <%=serviceName%> </option>
<%
}
%>
</select>
</td></tr>
</form>
</td></tr>
</table>
</td></tr>
<tr><td>
<form method="get" action="AddExecutable" name="addform">
<table>
<tr><td>
Select Resource :
</td><td>
<select name="resource">
<option>Select Resource</option>
<%
if(selectService!=null && !selectService.equals("Select Service")){
Databaseresources=DataBaseFactory.getInstance();
List resource=resources.getResource(selectService);
Iterator itr=resource.iterator();
while(itr.hasNext()){
String resourceName=(String)itr.next();
%>
<option value="<%=resourceName%>"> <%=resourceName%> </option>
<%
}
}
%>
</select>
</td></tr>
<tr><td>
<input type="Submit" name="Add" value="Add Executable">
</td></tr>
</table>
</form>
</td></tr>
</TABLE></body></html>

This is AddExe.jsp which is included in admin.jsp when user send request as action=addExe.
This jsp contains three form and each form contains comboBox.
When user select a value(server) from first comboBox then the related services will b display in second comboBox and when user select services from second comboBox then related resources will be display in third comboBox.
But the problem is that when I select a server from first comboBox then no problem but when I select service (means from second comboBox) then it again show "Select Server" in first comboBox.
please help me in solvong this problem ,I want to display only the selected values in comboBox.

Thanx in advance.
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Javaranch tip:

If you're going to post more than a line or two of your code, make sure to wrap the code in UBB Code tags. Doing so will preserve your indenting which makes your code much easier for others to read.

The easier it is for others to read it, the more they will and the more likely they are to help you.

Also, Please solve the problem is not a meaningful subject line. A lot of people will skip this thread altogether if they see a subject like this.
[ October 25, 2005: Message edited by: Ben Souther ]
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!