JSP

JavaServer Pages (JSP) allow the development of dynamically generated web pages. It uses the Java programming language; JSP pages are translated into servlets at runtime, with each servlet being cached and reused until the JSP is modified. JSP allows Java code to be interleaved with static web markup content, so the resulting page can be compiled and executed on the server to deliver the content.

Share tech news, updates, or what's on your mind.

Sign up to Post

I think someone is using my gmail (domain name) smtp

because I am receiving emails from smtp servers that email@myDomain.com has sending error
I have godaddy for domain
using google email
and only use browser to send/receive email

should I set up spf
0
Hi Experts,
I'm looking for a example code, which I can use to upload files with showing the status in a progress bar like on Gmail.
Please refer the attached screen shot.FileUpload
0
hi i'm trying to use jquery .so i downloaded that plugin and added to webcontent/js folder add i added that plugin my jsp page

<script src="/js/jquery.js"></script>

but it not working can any one help how to solve this issue here is i'm attaching my files
webxml.PNG
jsppage.PNG
0
could you attach or show link for 3
'show original' (full headers) text of received email message that has an attachment

so I can compare what email looks like

please include the entire email message
0
I am developing a web application using jsp,ajax,extjs and java.. My database is postgresql..
What i want is that the application should work from other machines just by typing the IP address of my system and file name so that i dont have to install the application on other machines..
For example i have the following code in my application -
<jsp:include page="button.jsp"></jsp:include>
how to replace all such codes by -
<jsp:include page="myIPAddress/button.jsp"></jsp:include>

Please guide me to achieve this.. Thanks in advance..
0
could you attach or show link for 3
'show original' (full headers) text of received email message that has an attachment

so I can compare what email looks like
0
hi,

I was running following example
import java.util.*;

public class aaa {
   public static void main(String[] args) {
      List list = Arrays.asList("one Two three Four five six".split(" "));
      System.out.println("List :"+list);
      Collections.rotate(list, 3);
      System.out.println("rotate: " + list);
   }
}


from link
http://www.tutorialspoint.com/javaexamples/collection_rotate.htm
Iam getting output as
List :[one, Two, three, Four, five, six]
rotate: [Four, five, six, one, Two, three]



I have not understood meaning of output.
>>   Collections.rotate(list, 3);

what above line means.

I see it is not ordered or sorted as well

Any ideas, suggestions, sample code, links, source code highly appreciated. Thanks in advance
0
hi,

I was running following example

import java.util.*;

public class d {
   public static void main(String[] args) {
      List list = Arrays.asList("one Two three Four five six one three Four".split(" "));
      System.out.println("List :"+list);
      List sublist = Arrays.asList("three Four".split(" "));
      System.out.println("SubList :"+sublist);
      System.out.println("indexOfSubList: " + Collections.indexOfSubList(list, sublist));
      System.out.println("lastIndexOfSubList: "
      + Collections.lastIndexOfSubList(list, sublist));
   }
}


from link
http://www.tutorialspoint.com/javaexamples/collection_sublist.htm
Iam getting output as

List :[one-Two, three, Four, five, six, one, three, Four]
SubList :[three, Four]
indexOfSubList: 1
lastIndexOfSubList: 6



I have not understood meaning of sublist its index concept

>> List sublist = Arrays.asList("three Four".split(" "));

what above line do .

Why

indexOfSubList: 1
lastIndexOfSubList: 6

is getting printed.

Any ideas, suggestions, sample code, links, source code highly appreciated. Thanks in advance
0
hi,

I was running following example

import java.util.*;

public class a {
   public static void main(String[] args) {
      List list = Arrays.asList("one Two three Four five six one three Four".split(" "));
      System.out.println(list);
      System.out.println("max: " + Collections.max(list));
      System.out.println("min: " + Collections.min(list));
   }
}



from link

http://www.tutorialspoint.com/javaexamples/collection_minmax.htm

Iam getting output as

 [one, Two, three, Four, five, six, one, three, Four]
max: three
min: Four


I have not understood meaning of max and min also how split ("") is working.

Any ideas, suggestions, sample code, links, source code highly appreciated. Thanks in advance
0
hi,

I was running following example

import java.util.Enumeration;
import java.util.Hashtable;

public class sssssss {
   public static void main(String[] args) {
      Hashtable ht = new Hashtable();
      ht.put("1", "One");
      ht.put("2", "Two");
      ht.put("3", "Three");
      Enumeration e = ht.elements();
      While(e.hasMoreElements())
      {
         System.out.println(e.nextElement());
      }
   }
}


from link

http://www.tutorialspoint.com/javaexamples/collection_enumeration.htm

Iam getting compilation error at line

 While(e.hasMoreElements())

to insert ;

Why above error coming how to fix it

Any ideas, suggestions, sample code, links, source code highly appreciated. Thanks in advance
0
Hi,

I a m running following example

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class Shuffle {
   public static void main(String[] argv)
   throws Exception {
      String[] alpha = { "A", "E", "I", "O", "U" };
      List list = new ArrayList(alpha);
      Collections.shuffle(list);
      System.out.println("list");
   }  
}


from link

http://www.tutorialspoint.com/javaexamples/collection_shuffle.htm

I am getting compilation error at line

List list = new ArrayList(alpha);


Remove arguments to match ArrayList().

What that error means. How can I correct it

Any ideas, suggestions, sample code, links, source code highly appreciated. Thanks in advance
0
I read as

Good software always should adhere to "Loose coupling, tight Cohesion" .

I have not understood the meaning clearly.
Any ideas, suggestions, sample code, links, source code highly appreciated. Thanks in advance
0
Hi Experts,

I am trying to get drop down menu's option value after submission.
ex)
<select name="mydropdown">
<option value="Milk">Fresh Milk</option>
<option value="Cheese">Old Cheese</option>
<option value="Bread">Hot Bread</option>
</select>
...
submit

I need to get "Fresh Milk", "Old Cheese" or " Hot Bread"(not "Milk", "Cheese", " Bread") depends on the user selection in the next page.

How do I do that?

thx,
0
We are facing problem When we try to execute any Database Command, NULL is returned in Exception.
Issue with the way calling DAO method in Servlet class.

We are using Spring 3.0 and oracle. Please check the attached file as we have pasted all the code as per the structure.

Thanks
Rohan.
JAVA-Problem.docx
0
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

public class Main {
   public static void main(String[] argv)
   throws Exception {
      List stuff = Arrays.asList(new String[] { "a", "b" });
      List list = new ArrayList(stuff);
      list = Collections.unmodifiableList(list);
      try {
         list.set(0, "new value");
      }
        catch (UnsupportedOperationException e) {
      }
      Set set = new HashSet(stuff);
      set = Collections.unmodifiableSet(set);
      Map map = new HashMap();
      map = Collections.unmodifiableMap(map);
      System.out.println("Collection is read-only now.");
   }
}
 


I was runniong above program from link
http://www.tutorialspoint.com/javaexamples/collection_readonly.htm

How do I prove to myself that callection is read only now. I want to test it.

Any ideas, suggestions, sample code, links, source code highly appreciated. Thanks in advance
0
First of all, I would like to tell you that I am a project manager and managed some good sized projects (n-tier) in .NET technology. Now I have to manage a java project and the developer also does not have that much experience in java and sql so I am completely new to java so would like some help.

Our application will interact with another 2nd application. The 2nd application will call a Spring Servelet which we are building and will pass an xml file to our spring servelet.
How do we simulate this or test this? We know how to parse xml in Spring but how should we call this Servlet and pass an xml to test whether our servlet is processing the xml in the desired manner or not.

Just to tell you : our servelet have to parse that xml and then perform some database operations in oracle and then create a new xml and send the response back as xml back to 2nd application.

If you can send me some link or reference where I can read this whole procedure of performing this , that will be good.

Thanks

Rohan.
0
Hi.

I have a doubt. I know <%! is the shortcode to declare a variable on a JSP page, however, I tryied also this:
<% String a[]={"a","b","c"}; %>
<%=a[0]%>

Which works perfectly. I believed that when declaring a variable inside a scriptlet the scope was just for the scriptlet but code above shows variables declared on the scriptlet has a page scope. Then why to use <%! for declarations ?

Thanks.
0
Hi guys,

I am trying to create an auto pop myModal login form using Twitter bootstrap for my Magento store.

I am having difficulty getting the modal to activate both manually or automatically. Would anyone kindly point me in the right direction please?

<script>
jQuery.noConflict();
jQuery("document").ready(function (){ 

       // load the overlay
        if (document.cookie.indexOf('visited=true') == -1) {
			var fifteenDays = 1000*60*60*24*15;
			var expires = new Date((new Date()).valueOf() + fifteenDays);
			document.cookie = "visited=true;expires=" + expires.toUTCString();
			jQuery.bootstrap({width:"580px", inline:true, href:"#myModal"});
		}
		
		jQuery("Modal").bootstrap({width:"580px", inline:true, href:"#Modal"});

 });
</script>

Open in new window


Form code

<div class="modal hide" id="Modal">
  <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal">x</button>
    <h3>Login to MyWebsite.com</h3>
  </div>
  <div class="modal-body">
    <form method="post" action='' name="login_form">
      <p><input type="text" class="span3" name="eid" id="email" placeholder="Email"></p>
      <p><input type="password" class="span3" name="passwd" placeholder="Password"></p>
      <p><button type="submit" class="btn btn-primary">Sign in</button>
        <a href="#">Forgot Password?</a>
      </p>
    </form>
  </div>
  <div class="modal-footer">
    New To MyWebsite.com?
    <a href="#" class="btn btn-primary">Register</a>
  </div>
</div>

Open in new window


Magento Static Block

<a href="#" class="Modal">Click here to open the popup</a>
<div style='display:none'>
<div id='myModal' style='padding:10px;'>

{{block type="customer/form_login" name="customer_form_mini_modal_login" before="-" template="customer/form/mini.modal.login.phtml"}}

</div>
</div>

Open in new window


Really appreciate the help guys!
0
import java.util.Collections;
import java.util.Set;
import java.util.TreeSet;

class MainClass {
   public static void main(String[] args) {
      String[] coins = { "Penny", "nickel", "dime",
      "Quarter", "dollar" };
      Set set = new TreeSet();
      for (int i = 0; i < coins.length; i++)
         set.add(coins);
      System.out.println(Collections.min(set));
      System.out.println(Collections.min(set,
      String.CASE_INSENSITIVE_ORDER));
      for(int i=0;i< =10;i++)
         System.out.print(-);
      System.out.println(Collections.max(set));
      System.out.println(Collections.max(set,
      String.CASE_INSENSITIVE_ORDER));
   }
}


i tried above example from link

http://www.tutorialspoint.com/javaexamples/collection_compare.htm


I am getting compilation error at

 System.out.print(-);


Any ideas, suggestions, sample code, links, source code highly appreciated. Thanks in advance
0
import java.util.*;
import java.io.*;

public class ArrayToCollection{
   public static void main(String args[])
   throws IOException{
      BufferedReader in = new BufferedReader
      (new InputStreamReader(System.in));
      System.out.println("How many elements
      you want to add to the array: ");
      int n = Integer.parseInt(in.readLine());
      String[] name = new String[n];
      for(int i = 0; i < n; i++){
         name = in.readLine();
      }
      List list = Arrays.asList(name);
      System.out.println();
      for(String li: list){
         String str = li;
         System.out.print(str + " ");
      }
   }
}


i tried above example from link

http://www.tutorialspoint.com/javaexamples/collection_array.htm


I am getting error like


Exception in thread "main" java.lang.Error: Unresolved compilation problem:
      Type mismatch: cannot convert from element type Object to String

at the line

>>>  for(String li: list){


Any ideas, suggestions, sample code, links, source code highly appreciated. Thanks in advance

0
I am reading xls and populating xml by manipulating existing framework code. In existing framework code each sheet of the xls represent a city. They are looping based on the city count and setting the city name using setter method to a XML XSD element.  For all city names they are using enum to store all the values.

In my approach I am using apachi poi and checking number of sheets to loop all the cities. I did not create enum as well. How do I create enum to set the city name as the enum to pass to existing xml xsd framework to generate XML.

Any ideas, suggestions, sample code, links, source code highly appreciated. Thanks in advance
0
I have a string value coming from xls sheel cell. I need to convert it to string to set to one other xml tag element. How can I achieve it. Any ideas, suggestions, sample code, links, source code highly appreciated. Thanks in advance
0
call 1:      
aDataMap.put(city, adatalist);
call 2:      
aDataMap.put("city", adatalist);


I have above two ways of calling put method on the map.
call 1: worked fine

call 2:      did not work.


My map was declared as below.
Map<String, List<AData>> aDataMap = new HashMap<String, List<AData>>();

since first argument is String, I passed it as "city" which did not work for some reason.

I would like to know differences between calling above two ways.

Any ideas, suggestions, sample code, links, source code highly appreciated. Thanks in advance
0
I get the data like this from DB.

EmpId	doc_no	Type
4	1111	B
5	2222	C
6	1111	D
1	1111	sales
7	4444	E
8	3333	F
2	2222	warehouse
3	1111	warehouse

Open in new window


if the type is of sales type  having same doc_no then i want to put it under one group with  key as empid and value as empid of type other than sales or warehouse.

hashmap.put("4","1");
hashmap.put("6","1");

if the type is of warehouse type having same doc_no then i want to put it under onother group with key as empid and value as empid of type other than sales or warehouse.

hashmap.put("5","2");
hashmap.put("4","3");
hashmap.put("6","3");

what is the best way create hashmap like this?
0
In java we cannot extend more than one class i get that part, I also know that we extend classes to borrow functionality.

But I don't get the point of implementing an interface, to me interfaces don't give you anything (because the methods in them are empty), they only force you to implement every method in them so what is the point of implementing an interface class if it doesn't give us anything in return.
0

JSP

JavaServer Pages (JSP) allow the development of dynamically generated web pages. It uses the Java programming language; JSP pages are translated into servlets at runtime, with each servlet being cached and reused until the JSP is modified. JSP allows Java code to be interleaved with static web markup content, so the resulting page can be compiled and executed on the server to deliver the content.

Top Experts In
JSP
<
Monthly
>

No Top Experts for this time period. Answer questions to earn the title!