We help IT Professionals succeed at work.

JSTL <c:import> Problem

CIPL-Senthil
CIPL-Senthil asked
on
1,894 Views
Last Modified: 2013-11-24
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:param>
      <c:param name="eName" value="<%=eName%>"></c:param>
</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
Comment
Watch Question

you can check the status in the ContactInfo Method.

Author

Commented:
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
rrzstudent
CERTIFIED EXPERT

Commented:
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.net.*,java.io.*" %>
<%
  response.setContentType("text/plain");
  String url = "your_url_here_and_append_params";
  HttpURLConnection urlConnection = (HttpURLConnection)(new URL(url).openConnection());
  urlConnection.setDoInput(true);
  urlConnection.connect();
  BufferedReader reader = null;
  if(urlConnection.getResponseCode() ==  HttpURLConnection.HTTP_OK){
                reader = new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
  } else {
          reader = new BufferedReader(new InputStreamReader(urlConnection.getErrorStream()));
      }
  String line = null;
  while((line = reader.readLine()) != null)out.print(line);
%>

Author

Commented:
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.

student
CERTIFIED EXPERT
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
Thanks a lot.your comment is very helpful to us.

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.