Results 1 to 1 of 1
- 08-18-2010, 08:05 AM #1
Member
- Join Date
- Aug 2010
- Posts
- 3
- Rep Power
- 0
Please help java programmers please!!!
I have a jsp page with a custom tag which greets the person in language based on the type of country selected from a drop down list. For example, if country is US the greet in english.
So, I have made a custom tag with a language attribute that will be dynamiclly upgraded with the values selected from the user.
Please tell me how to use EL(expression language) in the attribute to provide the value on run time of the country selected. Also how to use objects of my own made classes in EL.
Custom tag
<myTag:tagLibrary language="put dynamic value here from CustomTagLibraryClass" />
CustomTagLibrary Class
package tagLibrary;
import java.io.*;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
public class CustomTagLibrary implements Tag {
private PageContext pc = null;
private Tag parent = null;
private String language = "english";
public void setPageContext(PageContext p) {
pc = p;
}
public void setParent(Tag t) {
parent = t;
}
public Tag getParent() {
return parent;
}
public void setLanguage(String s) {
language = s;
}
public String getLanguage() {
return language;
}
public int doStartTag() throws JspException {
try {
if(language.equals("english")) {
pc.getOut().write("Hi there");
}
else if(language.equals("german")){
pc.getOut().write("Gutten Tag");
}
else if(language.equals("hindi")){
pc.getOut().write("Namashkar");
}
else if(language.equals("Irani")){
pc.getOut().write("Salam");
}
} catch(IOException e) {
throw new JspTagException("An IOException occurred.");
}
return SKIP_BODY;
}
public int doEndTag() throws JspException {
return EVAL_PAGE;
}
public void release() {
pc = null;
parent = null;
language = null;
}
}
Please also tell me how to give value to this custom tag based on value selected by user from drop down.
Similar Threads
-
Java Programmers needed - Lansing MI
By Joaquin in forum Jobs OfferedReplies: 6Last Post: 08-11-2009, 03:59 PM -
We need Java Programmers to interview
By jayson_sabale in forum Forum LobbyReplies: 4Last Post: 05-05-2008, 09:34 AM -
Looking for JAVA Programmers!
By offshoring in forum Jobs OfferedReplies: 0Last Post: 02-05-2008, 06:52 AM -
Hello java programmers...
By coder_ in forum IntroductionsReplies: 2Last Post: 01-23-2008, 05:23 AM -
New Search engine for Java Programmers
By coolgeek in forum Java SoftwareReplies: 0Last Post: 07-02-2007, 07:41 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks