agsingh
asked on
Taglibs increasing the size of JSP.
Hi,
For my internaionalization project i have used taglibs for conversion of property file keys.
Since there is lot of data to be converted, i have to use lot of tags. Excess use of Tag (50-60 in number) has increased the size of my jsp when its parsed to java. And i am getting java.lang.VerifyError: Illegal Jump or branch start
How can i use my tag class effectively so that its not overhead to the JSP
For my internaionalization project i have used taglibs for conversion of property file keys.
Since there is lot of data to be converted, i have to use lot of tags. Excess use of Tag (50-60 in number) has increased the size of my jsp when its parsed to java. And i am getting java.lang.VerifyError: Illegal Jump or branch start
How can i use my tag class effectively so that its not overhead to the JSP
ASKER
Here is my Tag Class
========================
import java.io.IOException;
import java.text.MessageFormat;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.ResourceBundle;
import javax.servlet.ServletConte xt;
import javax.servlet.jsp.JspExcep tion;
import javax.servlet.jsp.JspTagEx ception;
import javax.servlet.jsp.PageCont ext;
import javax.servlet.jsp.tagext.B odyTag;
import javax.servlet.jsp.tagext.B odyTagSupp ort;
public class MessageTag extends BodyTagSupport
{
// instance variables used during processing
private String _key = null;
private String _value = null;
private ResourceBundle _bundle = null;
private boolean _debug = false;
// these are reused for each message tag; luckily tags are thread-safe
private MessageFormat _messageFormat = new MessageFormat("");
private List _arguments = new ArrayList();
/**
* sets the key to use when looking up the value in the bundle
*/
public final void setKey(String key)
{
_key = key;
}
/**
* sets the bundle to an actual ResourceBundle object<br>
* defined on the page by the i18n:bundle tag
*/
public final void setBundle(ResourceBundle aBundle)
{
_bundle = aBundle;
}
/**
* @return the bundle to use
*/
private ResourceBundle getBundle() throws JspException
{
if(_bundle == null)
{
BundleTag bundleTag = (BundleTag)this.findAncest orWithClas s(this,Bun dleTag.cla ss);
if (bundleTag != null)
{
System.out.println("from bundle if");
return bundleTag.getBundle();
}
}
return _bundle;
}
/**
* Turn debugging log messages on or off
*/
public final void setDebug(boolean value)
{
_debug = value;
}
/**
* clears the argument list so that sub tags can call addArgument
* clears out any previous key and value in case key is not provided,
* or the value is null
*/
public final void release()
{
super.release();
_key = null;
_value = null;
_bundle = null;
}
/**
* To Print debug statements when _debug is true
*/
private void debugLog(String message)
{
if(_debug)
{
ServletContext sc = pageContext.getServletCont ext();
sc.log(message);
}
}
/**
* locates the bundle and gets the value
*/
public final int doStartTag() throws JspException
{
// Reset value for resource bundle key
_value = null;
// ensure we have a key
if ( _key == null ) {
throw new JspTagException("i18n:mess age tag requires a key attribute.");
}
ResourceBundle bundle = this.getBundle();
if ( bundle == null ) {
throw new JspTagException(
"i18n:message tag, no bundle available for use.");
}
// see if the bundle has a value, if not, we default to the tag contents
try {
_value = bundle.getString(_key);
debugLog("i18n:message tag: template for " + _key + " is: " + _value);
} catch (java.util.MissingResource Exception e) {
ServletContext sc = pageContext.getServletCont ext();
sc.log("i18n:message tag, value not found for key:" + _key);
}
return EVAL_BODY_TAG;
}
/**
* Performs the proper runtime substitution. If an id attribute was
* specified, then it is assumed that this tag is merely defining a
* string variable; otherwise output is provided.
*/
public final int doEndTag() throws JspException
{
try {
// if the value is null, use the body content
if ( _value == null ) {
_value = bodyContent.getString();
bodyContent.clear();
}
// print the value to the JspWriter
this.pageContext.getOut(). print(_val ue);
} catch (java.io.IOException e)
{
throw new JspTagException("i18n:mess age tag IO Error: " + e.getMessage());
}
// only process the body once
return EVAL_PAGE;
}
}
========================
import java.io.IOException;
import java.text.MessageFormat;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.ResourceBundle;
import javax.servlet.ServletConte
import javax.servlet.jsp.JspExcep
import javax.servlet.jsp.JspTagEx
import javax.servlet.jsp.PageCont
import javax.servlet.jsp.tagext.B
import javax.servlet.jsp.tagext.B
public class MessageTag extends BodyTagSupport
{
// instance variables used during processing
private String _key = null;
private String _value = null;
private ResourceBundle _bundle = null;
private boolean _debug = false;
// these are reused for each message tag; luckily tags are thread-safe
private MessageFormat _messageFormat = new MessageFormat("");
private List _arguments = new ArrayList();
/**
* sets the key to use when looking up the value in the bundle
*/
public final void setKey(String key)
{
_key = key;
}
/**
* sets the bundle to an actual ResourceBundle object<br>
* defined on the page by the i18n:bundle tag
*/
public final void setBundle(ResourceBundle aBundle)
{
_bundle = aBundle;
}
/**
* @return the bundle to use
*/
private ResourceBundle getBundle() throws JspException
{
if(_bundle == null)
{
BundleTag bundleTag = (BundleTag)this.findAncest
if (bundleTag != null)
{
System.out.println("from bundle if");
return bundleTag.getBundle();
}
}
return _bundle;
}
/**
* Turn debugging log messages on or off
*/
public final void setDebug(boolean value)
{
_debug = value;
}
/**
* clears the argument list so that sub tags can call addArgument
* clears out any previous key and value in case key is not provided,
* or the value is null
*/
public final void release()
{
super.release();
_key = null;
_value = null;
_bundle = null;
}
/**
* To Print debug statements when _debug is true
*/
private void debugLog(String message)
{
if(_debug)
{
ServletContext sc = pageContext.getServletCont
sc.log(message);
}
}
/**
* locates the bundle and gets the value
*/
public final int doStartTag() throws JspException
{
// Reset value for resource bundle key
_value = null;
// ensure we have a key
if ( _key == null ) {
throw new JspTagException("i18n:mess
}
ResourceBundle bundle = this.getBundle();
if ( bundle == null ) {
throw new JspTagException(
"i18n:message tag, no bundle available for use.");
}
// see if the bundle has a value, if not, we default to the tag contents
try {
_value = bundle.getString(_key);
debugLog("i18n:message tag: template for " + _key + " is: " + _value);
} catch (java.util.MissingResource
ServletContext sc = pageContext.getServletCont
sc.log("i18n:message tag, value not found for key:" + _key);
}
return EVAL_BODY_TAG;
}
/**
* Performs the proper runtime substitution. If an id attribute was
* specified, then it is assumed that this tag is merely defining a
* string variable; otherwise output is provided.
*/
public final int doEndTag() throws JspException
{
try {
// if the value is null, use the body content
if ( _value == null ) {
_value = bodyContent.getString();
bodyContent.clear();
}
// print the value to the JspWriter
this.pageContext.getOut().
} catch (java.io.IOException e)
{
throw new JspTagException("i18n:mess
}
// only process the body once
return EVAL_PAGE;
}
}
what does your jsp look like?
ASKER
pasting a portion of my JSP ..if it help
========================== ========== ======
<span id="alert"><center><font size=4 color="red">
<%if(msg!=null && !msg.equals("")) { %>
<i18n:message key='<%="tops.text." + ((String)(cc_abObj.getPara ms("uc15Er rMsg")))%> ' debug="true" ></i18n:message><br>
<%}%>
<%if(msg1!=null && !msg1.equals("")) { %>
<i18n:message key='<%="tops.text." + ((String)(cc_abObj.getPara ms("SuccMs g")))%>' debug="true" ></i18n:message>
<i18n:message key='<%="tops.listbox." + ((String)vecCollectShift.g et(vecColl ectShift.i ndexOf(str ShiftName) +1))%>' debug="true" ></i18n:message>
<i18n:message key='tops.text.Successfull y' debug="true" ></i18n:message>
<!--%=(cc_abObj.getParams( "excludeDa ys"))%-->
<i18n:message key='tops.text.From' debug="true" ></i18n:message> <i18n:formatDate value='<%=((String)(cc_abO bj.getPara ms("startD ate")))%>' />
<i18n:message key='tops.text.To' debug="true" ></i18n:message> <i18n:formatDate value='<%=((String)(cc_abO bj.getPara ms("endDat e")))%>' /><br>
<%}%>
<%if(msg2!=null && !msg2.equals("")) {
out.println(msg2+"<br>");
}%>
</font></center></span>
<table id="tableRow" border="1" cellspacing="2" cellpadding="2" align="center">
<tr>
<td><b><i18n:message key="tops.text.SupervisorN ame" debug="true" ></i18n:message></b></td>
<td>
<select multiple size="3" name="strlSupervisor">
<option value = "ALL"><i18n:message key="tops.listbox.SelectAl l" debug="true" ></i18n:message></option>
<%
if(vecSupverisorList != null)
{
for(int i=0;i<vecSupverisorList.si ze();i++)
{
strEmpNo=(String)vecSupver isorList.e lementAt(i );
strEmpName=(String)vecSupv erisorList .elementAt (++i);
%>
<option value="<%=strEmpNo%>"
<%
if(strlSupervisor != null)
{
for(int k=0;k<strlSupervisor.lengt h;k++)
{
if(strEmpNo.equalsIgnoreCa se(strlSup ervisor[k] ))
{
out.println("selected");
}
}
}
%>>
<%=strEmpName%></option>
<%
}
}
%>
</select>
</td>
<td>
<input type="button" id="topsButton" name="collectEmp" value="<i18n:message key="tops.button.GetEmploy ee" debug="true" >Get Employees</i18n:message>" onClick="callSuperVisor(th is.form)"; >
</td>
</tr>
</table>
<%
Vector vecWorkerList = (Vector)cc_abObj.getObject ("vecWorke rList");
if(vecWorkerList != null)
{
if(vecWorkerList.size() != 0)
{
%>
<table id="tableRow" border="1" cellspacing="2" cellpadding="2" align="center">
<tr>
<td align="left" >
<table id="tableRow" border="1" cellspacing="2" cellpadding="2" align="center">
<tr valign = "top">
<td valign = "top"><b><i18n:message key="tops.text.EmployeeNam eNumber" debug="true" >Employee Name/Number</i18n:message> </b></td>
</tr>
========================== ==========
==========================
<span id="alert"><center><font size=4 color="red">
<%if(msg!=null && !msg.equals("")) { %>
<i18n:message key='<%="tops.text." + ((String)(cc_abObj.getPara
<%}%>
<%if(msg1!=null && !msg1.equals("")) { %>
<i18n:message key='<%="tops.text." + ((String)(cc_abObj.getPara
<i18n:message key='<%="tops.listbox." + ((String)vecCollectShift.g
<i18n:message key='tops.text.Successfull
<!--%=(cc_abObj.getParams(
<i18n:message key='tops.text.From' debug="true" ></i18n:message> <i18n:formatDate value='<%=((String)(cc_abO
<i18n:message key='tops.text.To' debug="true" ></i18n:message> <i18n:formatDate value='<%=((String)(cc_abO
<%}%>
<%if(msg2!=null && !msg2.equals("")) {
out.println(msg2+"<br>");
}%>
</font></center></span>
<table id="tableRow" border="1" cellspacing="2" cellpadding="2" align="center">
<tr>
<td><b><i18n:message key="tops.text.SupervisorN
<td>
<select multiple size="3" name="strlSupervisor">
<option value = "ALL"><i18n:message key="tops.listbox.SelectAl
<%
if(vecSupverisorList != null)
{
for(int i=0;i<vecSupverisorList.si
{
strEmpNo=(String)vecSupver
strEmpName=(String)vecSupv
%>
<option value="<%=strEmpNo%>"
<%
if(strlSupervisor != null)
{
for(int k=0;k<strlSupervisor.lengt
{
if(strEmpNo.equalsIgnoreCa
{
out.println("selected");
}
}
}
%>>
<%=strEmpName%></option>
<%
}
}
%>
</select>
</td>
<td>
<input type="button" id="topsButton" name="collectEmp" value="<i18n:message key="tops.button.GetEmploy
</td>
</tr>
</table>
<%
Vector vecWorkerList = (Vector)cc_abObj.getObject
if(vecWorkerList != null)
{
if(vecWorkerList.size() != 0)
{
%>
<table id="tableRow" border="1" cellspacing="2" cellpadding="2" align="center">
<tr>
<td align="left" >
<table id="tableRow" border="1" cellspacing="2" cellpadding="2" align="center">
<tr valign = "top">
<td valign = "top"><b><i18n:message key="tops.text.EmployeeNam
</tr>
==========================
Have a look at the generated Java to see what is causing the exception.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
as a workaround i am using <%=myBundle.getString( "myKey" )%>... But i am getting error in a very unexpected fashion. Same file which is working fine, if it changed a bit and happen to recompile gives me Verify error.
I am pasting converted java file for tag
++++++++++++++++++++++++++ +++++++
release() is called for every invocation, apparently its not recycling
========================== =======
// begin message custom tag block... //[ /tops3/tnl/jsp/tops3Assign Shift.jsp; Line: 69]
com.gepower.gees.tops.i18n .MessageTa g _com_gepower_gees_tops_i18 n_MessageT ag_0 = null; //[ /tops3/tnl/jsp/tops3Assign Shift.jsp; Line: 69]
/*** declare AT_BEGIN TagExtra Vars here ***/ //[ /tops3/tnl/jsp/tops3Assign Shift.jsp; Line: 69]
try { // begin instantiate/release try/catch/finally block... //[ /tops3/tnl/jsp/tops3Assign Shift.jsp; Line: 69]
_com_gepower_gees_tops_i18 n_MessageT ag_0 = new com.gepower.gees.tops.i18n .MessageTa g(); //[ /tops3/tnl/jsp/tops3Assign Shift.jsp; Line: 69]
_com_gepower_gees_tops_i18 n_MessageT ag_0.setPa geContext( pageContex t); //[ /tops3/tnl/jsp/tops3Assign Shift.jsp; Line: 69]
_com_gepower_gees_tops_i18 n_MessageT ag_0.setPa rent(_com_ gepower_ge es_tops_i1 8n_BundleT ag_0); //[ /tops3/tnl/jsp/tops3Assign Shift.jsp; Line: 69]
_com_gepower_gees_tops_i18 n_MessageT ag_0.setDe bug(Boolea n.valueOf( weblogic.u tils.Strin gUtils.val ueOf("true ")).boolea nValue()); //[ /tops3/tnl/jsp/tops3Assign Shift.jsp; Line: 69]
_com_gepower_gees_tops_i18 n_MessageT ag_0.setKe y(weblogic .utils.Str ingUtils.v alueOf("to ps.text.As signShift" )); //[ /tops3/tnl/jsp/tops3Assign Shift.jsp; Line: 69]
int _int_1 = _com_gepower_gees_tops_i18 n_MessageT ag_0.doSta rtTag(); //[ /tops3/tnl/jsp/tops3Assign Shift.jsp; Line: 69]
if (_int_1 == Tag.EVAL_BODY_INCLUDE) { //[ /tops3/tnl/jsp/tops3Assign Shift.jsp; Line: 69]
throw new JspTagException("Since tag class com.gepower.gees.tops.i18n .MessageTa g implements BodyTag, it cannot return Tag.EVAL_BODY_INCLUDE"); //[ /tops3/tnl/jsp/tops3Assign Shift.jsp; Line: 69]
} //[ /tops3/tnl/jsp/tops3Assign Shift.jsp; Line: 69]
/*** sync AT_BEGIN TagExtra Vars here ***/ //[ /tops3/tnl/jsp/tops3Assign Shift.jsp; Line: 69]
if (_int_1 != Tag.SKIP_BODY) { // begin !SKIP_BODY... //[ /tops3/tnl/jsp/tops3Assign Shift.jsp; Line: 69]
if (_int_1 != Tag.EVAL_BODY_INCLUDE) { //[ /tops3/tnl/jsp/tops3Assign Shift.jsp; Line: 69]
out = pageContext.pushBody(); //[ /tops3/tnl/jsp/tops3Assign Shift.jsp; Line: 69]
_com_gepower_gees_tops_i18 n_MessageT ag_0.setBo dyContent( (BodyConte nt)out); //[ /tops3/tnl/jsp/tops3Assign Shift.jsp; Line: 69]
} //[ /tops3/tnl/jsp/tops3Assign Shift.jsp; Line: 69]
try { // begin pushBody try/finally //[ /tops3/tnl/jsp/tops3Assign Shift.jsp; Line: 69]
_com_gepower_gees_tops_i18 n_MessageT ag_0.doIni tBody(); //[ /tops3/tnl/jsp/tops3Assign Shift.jsp; Line: 69]
do { //[ /tops3/tnl/jsp/tops3Assign Shift.jsp; Line: 69]
/*** declare & sync NESTED TagExtra Vars here ***/ //[ /tops3/tnl/jsp/tops3Assign Shift.jsp; Line: 69]
//[ /tops3/tnl/jsp/tops3Assign Shift.jsp; Line: 69]
out.print("Assign Shift");
//[ /tops3/tnl/jsp/tops3Assign Shift.jsp; Line: 69]
} while (_com_gepower_gees_tops_i1 8n_Message Tag_0.doAf terBody() == BodyTag.EVAL_BODY_TAG); //[ /tops3/tnl/jsp/tops3Assign Shift.jsp; Line: 69]
} finally { // end pushBody try/finally //[ /tops3/tnl/jsp/tops3Assign Shift.jsp; Line: 69]
if (_int_1 != Tag.EVAL_BODY_INCLUDE) //[ /tops3/tnl/jsp/tops3Assign Shift.jsp; Line: 69]
out = pageContext.popBody(); //[ /tops3/tnl/jsp/tops3Assign Shift.jsp; Line: 69]
} //[ /tops3/tnl/jsp/tops3Assign Shift.jsp; Line: 69]
} // end !SKIP_BODY //[ /tops3/tnl/jsp/tops3Assign Shift.jsp; Line: 69]
if (_com_gepower_gees_tops_i1 8n_Message Tag_0.doEn dTag() == Tag.SKIP_PAGE) return; //[ /tops3/tnl/jsp/tops3Assign Shift.jsp; Line: 69]
} catch (java.lang.Exception _java_lang_Exception_0) { // instantiate/release try/catch/finally //[ /tops3/tnl/jsp/tops3Assign Shift.jsp; Line: 69]
throw new ServletException("runtime failure in custom tag 'message'", _java_lang_Exception_0); //[ /tops3/tnl/jsp/tops3Assign Shift.jsp; Line: 69]
} finally { // instantiate/release try/catch/finally block... //[ /tops3/tnl/jsp/tops3Assign Shift.jsp; Line: 69]
if (_com_gepower_gees_tops_i1 8n_Message Tag_0 != null) _com_gepower_gees_tops_i18 n_MessageT ag_0.relea se(); //[ /tops3/tnl/jsp/tops3Assign Shift.jsp; Line: 69]
} //[ /tops3/tnl/jsp/tops3Assign Shift.jsp; Line: 69]
//end message custom.... //[ /tops3/tnl/jsp/tops3Assign Shift.jsp; Line: 69]
/*** declare & sync AT_END TagExtra Vars here ***/ //[ /tops3/tnl/jsp/tops3Assign Shift.jsp; Line: 69]
/*** sync AT_BEGIN TagExtra Vars here ***/ //[ /tops3/tnl/jsp/tops3Assign Shift.jsp; Line: 69]
I am pasting converted java file for tag
++++++++++++++++++++++++++
release() is called for every invocation, apparently its not recycling
==========================
// begin message custom tag block... //[ /tops3/tnl/jsp/tops3Assign
com.gepower.gees.tops.i18n
/*** declare AT_BEGIN TagExtra Vars here ***/ //[ /tops3/tnl/jsp/tops3Assign
try { // begin instantiate/release try/catch/finally block... //[ /tops3/tnl/jsp/tops3Assign
_com_gepower_gees_tops_i18
_com_gepower_gees_tops_i18
_com_gepower_gees_tops_i18
_com_gepower_gees_tops_i18
_com_gepower_gees_tops_i18
int _int_1 = _com_gepower_gees_tops_i18
if (_int_1 == Tag.EVAL_BODY_INCLUDE) { //[ /tops3/tnl/jsp/tops3Assign
throw new JspTagException("Since tag class com.gepower.gees.tops.i18n
} //[ /tops3/tnl/jsp/tops3Assign
/*** sync AT_BEGIN TagExtra Vars here ***/ //[ /tops3/tnl/jsp/tops3Assign
if (_int_1 != Tag.SKIP_BODY) { // begin !SKIP_BODY... //[ /tops3/tnl/jsp/tops3Assign
if (_int_1 != Tag.EVAL_BODY_INCLUDE) { //[ /tops3/tnl/jsp/tops3Assign
out = pageContext.pushBody(); //[ /tops3/tnl/jsp/tops3Assign
_com_gepower_gees_tops_i18
} //[ /tops3/tnl/jsp/tops3Assign
try { // begin pushBody try/finally //[ /tops3/tnl/jsp/tops3Assign
_com_gepower_gees_tops_i18
do { //[ /tops3/tnl/jsp/tops3Assign
/*** declare & sync NESTED TagExtra Vars here ***/ //[ /tops3/tnl/jsp/tops3Assign
//[ /tops3/tnl/jsp/tops3Assign
out.print("Assign Shift");
//[ /tops3/tnl/jsp/tops3Assign
} while (_com_gepower_gees_tops_i1
} finally { // end pushBody try/finally //[ /tops3/tnl/jsp/tops3Assign
if (_int_1 != Tag.EVAL_BODY_INCLUDE) //[ /tops3/tnl/jsp/tops3Assign
out = pageContext.popBody(); //[ /tops3/tnl/jsp/tops3Assign
} //[ /tops3/tnl/jsp/tops3Assign
} // end !SKIP_BODY //[ /tops3/tnl/jsp/tops3Assign
if (_com_gepower_gees_tops_i1
} catch (java.lang.Exception _java_lang_Exception_0) { // instantiate/release try/catch/finally //[ /tops3/tnl/jsp/tops3Assign
throw new ServletException("runtime failure in custom tag 'message'", _java_lang_Exception_0); //[ /tops3/tnl/jsp/tops3Assign
} finally { // instantiate/release try/catch/finally block... //[ /tops3/tnl/jsp/tops3Assign
if (_com_gepower_gees_tops_i1
} //[ /tops3/tnl/jsp/tops3Assign
//end message custom.... //[ /tops3/tnl/jsp/tops3Assign
/*** declare & sync AT_END TagExtra Vars here ***/ //[ /tops3/tnl/jsp/tops3Assign
/*** sync AT_BEGIN TagExtra Vars here ***/ //[ /tops3/tnl/jsp/tops3Assign
ASKER
I m using weblogic 510 SP 8
The other approach you could use would be to contextualize your i18n lookups, e.g.
<i18n:bundle>
<i18n:lookup key="myKey"/>
<i18n:whatever/>
</i18n:bundle>
Your child tags get the loaded bundle from the parent.
As an aside, many people have written i18n libraries, so why not use one?
http://jakarta.apache.org/taglibs/doc/i18n-doc/intro.html
ASKER
This is what i am doing..
<%@ taglib uri="tops-i18n.tld" prefix="i18n" %>
<i18n:bundle id="_bundle" debug="true" baseName="properties.tops3 .i18n.lang uage">
.
.
.
<i18n:message key="myKey" debug="true" >Assign Shift</i18n:message>
.
.
</i18n:bundle>
message tag is getting bundle from the bundle tag
I am using jakarta taglibs, with minor modification
-Ag
<%@ taglib uri="tops-i18n.tld" prefix="i18n" %>
<i18n:bundle id="_bundle" debug="true" baseName="properties.tops3
.
.
.
<i18n:message key="myKey" debug="true" >Assign Shift</i18n:message>
.
.
</i18n:bundle>
message tag is getting bundle from the bundle tag
I am using jakarta taglibs, with minor modification
-Ag
Ah, sorry. I thought you were writing your own.
The verify error must be being caused by a fault in weblogic's jsp compiler. BEA do make reference to this problem..
"-noTryBlocks
If a JSP file has numerous or deeply nested custom JSP tags and you receive a java.lang.VerifyError exception when compiling, use this flag to allow the JSPs to compile correctly."
According to what I've read on the net, you should be able to configure weblogic.xml to supply this parameter to the compiler:
<jsp-param>
<param-name>compileFlags</
<param-value>"-noTryBlocks
</jsp-param>
ASKER
thats a relief..!!
I have not deployed my app as a webapplication so not using web.xml, using weblogic.properties
Any idea how to pass -noTryBlocks through it,
Also can u give me a ref where u found this fault in weblogic JSP compiler.
Thanks,
I have not deployed my app as a webapplication so not using web.xml, using weblogic.properties
Any idea how to pass -noTryBlocks through it,
Also can u give me a ref where u found this fault in weblogic JSP compiler.
Thanks,
Hmm.. That option won't work with a WL5.1 jspc (need WL6.0+). They didn't address the problem with a compiler option until 6.0.
http://www.weblogic.com/docs51/classdocs/API_jsp.html#compiler
http://edocs.bea.com/wls/docs60/jsp/reference.html#57794
You could also try finding a different jsp compiler and configuring WL to use that instead. Maybe it'll produce more efficient code.
The root problem seems to be that your generated class files are too big. The elimination of all the try/catch blocks generated by the jsp compiler would help (if you could do it with WL5.1, which you don't seem to be able to :-( ), but failing that you're just going to have to slim down or refactor your JSP into more manageable chunks and <jsp:include/> bits and bobs here and there.
http://www.caucho.com/support/resin-interest/0005/0251.html
ASKER
getting lots of problems when compiling using java weblogic.jspc
[jspc] parsed .\tnl\jsp\calledbackreport .jsp in 661 ms.
[jspc] generated java file c:\abhi\jsp_servlet\__46_\ _tnl\_jsp\ _calledbac kreport.ja va, invoking java compiler:
Exec failed .. exiting
:(
[jspc] parsed .\tnl\jsp\calledbackreport
[jspc] generated java file c:\abhi\jsp_servlet\__46_\
Exec failed .. exiting
:(
ASKER
didnt get my answer..perhaps it was a wrong implementation of Taglibs.
There is lot behind the scenes. Thanks James for clearing out some of them..!!
There is lot behind the scenes. Thanks James for clearing out some of them..!!
ASKER
========================
import java.io.IOException;
import java.text.MessageFormat;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.ResourceBundle;
import javax.servlet.ServletConte
import javax.servlet.jsp.JspExcep
import javax.servlet.jsp.JspTagEx
import javax.servlet.jsp.PageCont
import javax.servlet.jsp.tagext.B
import javax.servlet.jsp.tagext.B
public class MessageTag extends BodyTagSupport
{
// instance variables used during processing
private String _key = null;
private String _value = null;
private ResourceBundle _bundle = null;
private boolean _debug = false;
// these are reused for each message tag; luckily tags are thread-safe
private MessageFormat _messageFormat = new MessageFormat("");
private List _arguments = new ArrayList();
/**
* sets the key to use when looking up the value in the bundle
*/
public final void setKey(String key)
{
_key = key;
}
/**
* sets the bundle to an actual ResourceBundle object<br>
* defined on the page by the i18n:bundle tag
*/
public final void setBundle(ResourceBundle aBundle)
{
_bundle = aBundle;
}
/**
* @return the bundle to use
*/
private ResourceBundle getBundle() throws JspException
{
if(_bundle == null)
{
BundleTag bundleTag = (BundleTag)this.findAncest
if (bundleTag != null)
{
System.out.println("from bundle if");
return bundleTag.getBundle();
}
}
return _bundle;
}
/**
* Turn debugging log messages on or off
*/
public final void setDebug(boolean value)
{
_debug = value;
}
/**
* clears the argument list so that sub tags can call addArgument
* clears out any previous key and value in case key is not provided,
* or the value is null
*/
public final void release()
{
super.release();
_key = null;
_value = null;
_bundle = null;
}
/**
* To Print debug statements when _debug is true
*/
private void debugLog(String message)
{
if(_debug)
{
ServletContext sc = pageContext.getServletCont
sc.log(message);
}
}
/**
* locates the bundle and gets the value
*/
public final int doStartTag() throws JspException
{
// Reset value for resource bundle key
_value = null;
// ensure we have a key
if ( _key == null ) {
throw new JspTagException("i18n:mess
}
ResourceBundle bundle = this.getBundle();
if ( bundle == null ) {
throw new JspTagException(
"i18n:message tag, no bundle available for use.");
}
// see if the bundle has a value, if not, we default to the tag contents
try {
_value = bundle.getString(_key);
debugLog("i18n:message tag: template for " + _key + " is: " + _value);
} catch (java.util.MissingResource
ServletContext sc = pageContext.getServletCont
sc.log("i18n:message tag, value not found for key:" + _key);
}
return EVAL_BODY_TAG;
}
/**
* Performs the proper runtime substitution. If an id attribute was
* specified, then it is assumed that this tag is merely defining a
* string variable; otherwise output is provided.
*/
public final int doEndTag() throws JspException
{
try {
// if the value is null, use the body content
if ( _value == null ) {
_value = bodyContent.getString();
bodyContent.clear();
}
// print the value to the JspWriter
this.pageContext.getOut().
} catch (java.io.IOException e)
{
throw new JspTagException("i18n:mess
}
// only process the body once
return EVAL_PAGE;
}
}