Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Linking JSP Files From Different Sources

Status
Not open for further replies.

Tr0

Programmer
Jul 12, 2007
24
0
0
US
I am working on a web page that will require me to create an html/jsp template that will import information from other jsp files from another computer.

The web page will be hosted on a different server than the one with the jsp files that I would need to access to display the information.

The jsp files I need to access are retrieving information from a database through mySQL.

My questions are:

Is creating an HTML template that incorporates jsp the easiest way to display the information?

and

What code would I need to import the information from the "jsp" server to the web server?

Any help would be much appreciated.

Thanks.
 
Let call the another server "server A" and "page B" is the page you want on server A.
You cannot include a page B from another server.
If you want use the data in page B, you can use one of the methods
1) read page B, extract the data you want and display them on your jsp. (You have to parse the page yourself with the methods
in java.lang.String and xslt techniuqe can be used. Be careful, xslt in Java can process utf8 encoding)
2) write another simple jsp page on server A to display very simple data without html tags.
The content may look like this:
Student,score,Mary,100,Tom,70,Sam,60
Then you have to process this page, extract the data you need and display in your jsp.
(You can extract the data with methods in java.lang.String, xslt is not necessary)
The new simple jsp should not contain secured data or need user to login.
 
I'm not sure that we are on the same page so let me explain my problem a little more clearly:

There are 2 servers (we'll call them servers A & B)
On server A I want to put an html file that will access a .jsp file on server B.

If I put in this address in my web browser on server A:

It accesses the tomcat mobiledoc database and displays a SOAP envelope file from server B.

I need to know how to parse the data from the SOAP file so that I can pull the data that I need from it to be able to display the appropriate fields on a html page.

Maybe this explains my situation a little better...

Any more suggestions would be appreciated.

Thanks.
 
Here is the .jsp file that creates the SOAP envelope also:

<%
int doctorId = 0;
String strFacilityId = null;
String strFacilityGrpId = null;
String strApptTime = null;
String strCheckStatus = null;
String strDate = null;
String strDoctorId = null;
String strXml = null;
String sortBy = "";
int nFacilityId = 0;
int nFacilityGrpId = 0;
int nApptTime = 0;;
int nCheckStatus = 0;;
int nCounter =0;
int nMaxCount =0;
catalog.PatientSchedule obj = null;


try
{
strXml = catalog.CwXmlHelper.CreateXmlStatus("failed");
obj = new catalog.PatientSchedule();

strDate = request.getParameter("eDate");

sortBy = request.getParameter("sortBy");
if(sortBy == null)
sortBy = "name"; // Synchronization Change

nFacilityId = 0;
strFacilityId = request.getParameter("facilityId");
if(strFacilityId != null && strFacilityId.length() > 0)
nFacilityId = Integer.parseInt(strFacilityId);

nFacilityGrpId = 0;
strFacilityId = request.getParameter("FacilityGrpId");
if(strFacilityId != null && strFacilityId.length() > 0)
nFacilityGrpId = Integer.parseInt(strFacilityId);

strDoctorId = request.getParameter("doctorId");
if (strDoctorId ==null)
{
strDoctorId ="0";
}
//doctorId = Integer.parseInt(strDoctorId);

nApptTime = 0;
strApptTime = request.getParameter("apptTime");
if(strApptTime != null && strApptTime.length() > 0)
nApptTime = Integer.parseInt(strApptTime);

nCheckStatus = 0;
strCheckStatus = request.getParameter("checkinstatus");
if(strCheckStatus != null && strCheckStatus.length() > 0)
nCheckStatus = Integer.parseInt(strCheckStatus);

String strCounter= request.getParameter( "nCounter" );
if( strCounter != null && strCounter.length() > 0 )
nCounter = Integer.parseInt( strCounter );

String strMaxCount= request.getParameter( "maxCount" );
if( strMaxCount != null && strMaxCount.length() > 0 )
nMaxCount = Integer.parseInt( strMaxCount );


strXml = obj.getDoctorsScheduleList(null, strDate, strDoctorId, sortBy, nFacilityId, nApptTime, nCheckStatus,nFacilityGrpId, nCounter, nMaxCount);
}
catch(Exception ex)
{
System.err.println(ex);
ex.printStackTrace();
}
%><%=strXml%>
 
xpath is used to select the nodes you want in the process of xml transformation (xslt).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top