wood burning stoves 2.0*
The moose likes JSP and the fly likes Please solve the problem. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Please solve the problem." Watch "Please solve the problem." New topic
Author

Please solve the problem.

Ahmed Shaikh
Ranch Hand

Joined: Jul 25, 2005
Posts: 51
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.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

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 ]

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Please solve the problem.