CIPL-Senthil
asked on
JSTL <c:import> Problem
Dear Experts,
Our application is based on struts and we are using JSP and JSTL in presentation layer.In one of our files we need to use <c:import>.I will provide the code for you for your reference
<c:import url="http://localhost:Bizpiper/flashdb.do?method=ContactInfo">
<c:param name="proid" value="<%=p%>"></c:param>
<c:param name="contactinfo" value="<%=a%>"></c:param>
<c:param name="loginid" value="<%=loginid%>"></c:p aram>
<c:param name="eName" value="<%=eName%>"></c:par am>
</c:import>
Here we are executing the URL called "http://localhost:Bizpiper/flashdb.do?method=ContactInfo" with the mentioned parameters.after execution got completed i need to get status whether the execution is success or not.
Can you please suggest how i can do that.
Thanks
Malathi
Our application is based on struts and we are using JSP and JSTL in presentation layer.In one of our files we need to use <c:import>.I will provide the code for you for your reference
<c:import url="http://localhost:Bizpiper/flashdb.do?method=ContactInfo">
<c:param name="proid" value="<%=p%>"></c:param>
<c:param name="contactinfo" value="<%=a%>"></c:param>
<c:param name="loginid" value="<%=loginid%>"></c:p
<c:param name="eName" value="<%=eName%>"></c:par
</c:import>
Here we are executing the URL called "http://localhost:Bizpiper/flashdb.do?method=ContactInfo" with the mentioned parameters.after execution got completed i need to get status whether the execution is success or not.
Can you please suggest how i can do that.
Thanks
Malathi
you can check the status in the ContactInfo Method.
ASKER
ya i have done the same by setting some status value in request scope.but it has not worked and i can not use session scope variable for maintaning the single status variable.
Please advice
Please advice
Why not use HttpURLConnection ? uses it behind the scenes anyway. For testing try this JSP. If you don't want scriptlet on your page, then you can create tag file.
<%@ page import="java.util.*,java.n et.*,java. io.*" %>
<%
response.setContentType("t ext/plain" );
String url = "your_url_here_and_append_ params";
HttpURLConnection urlConnection = (HttpURLConnection)(new URL(url).openConnection()) ;
urlConnection.setDoInput(t rue);
urlConnection.connect();
BufferedReader reader = null;
if(urlConnection.getRespon seCode() == HttpURLConnection.HTTP_OK) {
reader = new BufferedReader(new InputStreamReader(urlConne ction.getI nputStream ()));
} else {
reader = new BufferedReader(new InputStreamReader(urlConne ction.getE rrorStream ()));
}
String line = null;
while((line = reader.readLine()) != null)out.print(line);
%>
<%@ page import="java.util.*,java.n
<%
response.setContentType("t
String url = "your_url_here_and_append_
HttpURLConnection urlConnection = (HttpURLConnection)(new URL(url).openConnection())
urlConnection.setDoInput(t
urlConnection.connect();
BufferedReader reader = null;
if(urlConnection.getRespon
reader = new BufferedReader(new InputStreamReader(urlConne
} else {
reader = new BufferedReader(new InputStreamReader(urlConne
}
String line = null;
while((line = reader.readLine()) != null)out.print(line);
%>
ASKER
Thanks for your suggestion.
I need some clarifications regarding URLConnection.According to my assumption the URL length will be restricted to some particular length.If we go on adding the parameters to that URL and if it is exceeding the restricted length of URL then can i know what kind of error i will get.
I need some clarifications regarding URLConnection.According to my assumption the URL length will be restricted to some particular length.If we go on adding the parameters to that URL and if it is exceeding the restricted length of URL then can i know what kind of error i will get.
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
Thanks a lot.your comment is very helpful to us.