Cusctom tag with body

I have written a custom tag with body.
The intention is to process the body and
replace any periods with line breaks (in HTML)
before writing the BodyContent to the
enclosing JspWriter.
I find that replacing "." with ".<br>" does not
take any effect. The output HTML does not contain
the <br> tags (when viewed from the browser).
From the doAfterBody() I call the filter
to replace the periods with <br> as follows.
Pl let me know if my understanding of the
TAG lifecycle is wrong:
public int doAfterBody() throws JspException {
try {
String txt = getBodyContent().getString();
replaceDots(txt.toLowerCase()
getPreviousOut()
catch (java.io.IOException ioxc) {
throw new JspException(ioxc.toString());
return SKIP_BODY;
private void replaceDots(final String x, JspWriter w)
throws java.io.IOException
if (x == null) return ;
StringTokenizer st = new StringTokenizer(x, ".");
while (st.hasMoreTokens()) {
String f = (String)st.nextToken();
w.println( f.equals(".") ? ".<br>":f);

I think the problem might be in the use of StringTokenizer. Since the "." is not returned as a token, the code to add the "<BR>" is never executed. It looks as if your existing code should actually remove the periods.
Try:
StringTokenizer st = new StringTokenizer(x, ".", true);
while (st.hasMoreTokens()) {
  String f = (String)st.nextToken();
  w.println( f.equals(".") ? ".<br>":f);
} or
StringTokenizer st = new StringTokenizer(x, ".");
while (st.hasMoreTokens()) {
  String f = (String)st.nextToken();
  w.println( f + ".<br>");
}(The "& gt;" should be ">" - I wish they'd fix the formatting!)

Similar Messages

  • Tomcat 4.1.12 and custom tags with body

    Hi,
    I had deployed one application in tomcat 3.3.1 which used custom tags with body, and it worked fine, However recently I upgraded that application to tomcat-4.1.12
    and the tags with body stopped giving expected behaviour, however the tags without body are giving expected behaviour, I had a look at generated jsp file...
    I am pasting the generated output here
    jp.co.nttdata.sk._webtier.tagext.FormTag jspxth_sk_form_0 = (jp.co.nttdata.sk._webtier.tagext.FormTag) jspxtagPool_sk_form_action.get(jp.co.nttdata.sk._webtier.tagext.FormTag.class);
    jspxth_sk_form_0.setPageContext(pageContext);
    jspxth_sk_form_0.setParent(null);
    jspxth_sk_form_0.setAction(SKScreenDefinition.SK_I0100 );
    int jspxeval_sk_form_0 = jspxth_sk_form_0.doStartTag();
    if (_jspx_eval_sk_form_0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
    if (_jspx_eval_sk_form_0 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) {
    javax.servlet.jsp.tagext.BodyContent _bc = pageContext.pushBody();
    _bc.clear();
    out = _bc;
    jspxth_sk_form_0.setBodyContent(_bc);
    jspxth_sk_form_0.doInitBody();
    do {
    out.write("\r\n<input type=\"hidden\" name=\"rpt_no\" value=\"<%= rpt_no %>\">\r\n<input type=\"hidden\" name=\"optnOpen\" value=\"0\">\r\n<table border=0 cellspacing=0 cellpadding=0 class=\"bdsyl\">\r\n<tr>\r\n<td class=\"innframe\">\r\n\r\n\t<table border=0 cellspacing=0 cellpadding=5 class=\"bgcol_1\">\r\n\t<tr>\r\n\t<td class=\"fsyl_1\"><font class=\"fsyl_6\">���</font> ������������E/td>\r\n\t<td>\r\n\t\t\t<select name=\"rptDivCombo\">\r\n<%\r\n\tstrSelected = \"\";\r\n\tnLen = 0;\r\n\tif(arrOskCodeNameRptDiv != null) nLen = arrOskCodeNameRptDiv.length;\r\n%>\r\n<%\r\n\tfor(int i=0;i<nLen;i++) \r\n\t{\r\n\t\tString cd = arrOskCodeNameRptDiv.getCode();\r\n\t\tString nm = arrOskCodeNameRptDiv[i].getName();\r\n\t\tString value = cd + SKConstants.SEPARATOR + nm;\r\n\r\n\t\tstrSelected = \"\";\r\n\t\tif(cd.equals(rpt_div)) strSelected = \"selected\";\r\n%>\r\n\t\t\t\t<option <%= strSelected %> value=\"<%=value%>\"><%= nm%></option>\r\n<%\r\n\t}//for loop\r\n%>\r\n\t\t\t</select>\r\n\t</td>\r\n\t</tr>\r\n\t<tr>\r\n\t<td class=\"fsyl_1\"><font class=\"fsyl_6\">���</font> ��� ���E���</td>\r\n\t<td>\r\n\t\r\n\t\t\t<select name=\"prortyCombo\">\r\n<%\r\n\tstrSelected = \"\";\r\n\tnLen = 0;\r\n\tif(arrOskCodeNameProrty != null) nLen = arrOskCodeNameProrty.length;\r\n");
    out.write("%>\r\n<%\r\n\tfor(int i=0;i<nLen;i++) \r\n\t{\r\n\t\tString cd = arrOskCodeNameProrty[i].getCode();\r\n\t\tString nm = arrOskCodeNameProrty[i].getName();\r\n\t\tString value = cd + SKConstants.SEPARATOR + nm;\r\n\r\n\t\tstrSelected = \"\";\r\n\t\tif(cd.equals(prorty)) strSelected = \"selected\";\r\n%>\r\n\t\t\t\t<option <%= strSelected %> value=\"<%= value %>\"><%= nm %></option>\r\n<%\r\n\t}//for loop\r\n%>\r\n\t\t\t</select>\r\n\t\r\n\t</td>\r\n\t</tr>\r\n\t<tr>\r\n\t<td class=\"fsyl_1\"><font class=\"fsyl_6\">���</font> ������������E/td>\r\n\t<td><input type=\"text\" size=4 maxlength=4 name=\"rpt_dt_yyyy\" value=\"<%= rpt_dt_yyyy %>\">��� <input type=\"text\" size=2 maxlength=2 name=\"rpt_dt_mm\" value=\"<%= rpt_dt_mm %>\">���E<input type=\"text\" size=2 name=\"rpt_dt_dd\" maxlength=2 value=\"<%= rpt_dt_dd %>\">��� <input type=\"text\" maxlength=2 size=2 name=\"rpt_dt_hh\" value=\"<%= rpt_dt_hh %>\">���E<input type=\"text\" size=2 maxlength=2 name=\"rpt_dt_mi\" value=\"<%= rpt_dt_mi %>\">���E<span class=\"fsyl_2\">�E����������������E/span></td>\r\n\t</tr>\r\n\t<tr>\r\n\t<td class=\"fsyl_1\"><font class=\"fsyl_6\">���</font> ��� ���E���E</td>\r\n\t<td><input type=\"text\" size=20 name=\"rpt_user\" value=\"<%= Util.forHidden(rpt_user) %>\"></td>\r\n");
    out.write("\t</tr>\r\n\t<tr>\r\n\t<td class=\"fsyl_1\"><font class=\"fsyl_6\">���</font> ���������������E/td>\r\n\t<td>\r\n\t\r\n\t\t\t<select name=\"rptRegiUserCombo\">\r\n<%\r\n\tstrSelected = \"\";\r\n\tnLen = 0;\r\n\tif(arrOfUserName != null) nLen = arrOfUserName.length;\r\n\r\n\tfor(int i=0;i<nLen;i++){\r\n\t\tString[] arrTemp = UzUtil.extractTokens(arrOfUserName[i], SKConstants.SEPARATOR);\r\n\t\t\r\n\t\tstrSelected = \"\";\r\n\t\tif(arrTemp[0].equals(rpt_regi_user)) strSelected = \"selected\";\r\n%>\r\n\t\t\t\t<option <%= strSelected %> value=\"<%= arrOfUserName[i] %>\"><%= arrTemp[1] %></option>\r\n<%\r\n\t}//for loop\r\n%>\r\n\t\t\t</select>\r\n\r\n\t\r\n\t</td>\r\n\t</tr>\r\n\t<tr>\r\n\t<td class=\"fsyl_1\"><font class=\"fsyl_6\">���</font> ������������������</td>\r\n\t<td><input type=\"text\" size=70 name=\"rpt_title\" value=\"<%= UzString.forHidden(rpt_title)%>\"> <span class=\"fsyl_2\">�E�E00���E�����E/span></td>\r\n\t</tr>\r\n\t<tr>\r\n\t<td valign=top class=\"fsyl_1\"><font class=\"fsyl_6\">���</font> ��������E���</td>\r\n\t<td nowrap><textarea wrap=\"physical\" rows=10 cols=72 name=\"rpt_txt\"><%= UzString.htmlEncodeForHidden(rpt_txt) %></textarea> <span class=\"fsyl_2\">�E�E000���E�����E/span>      </td>\r\n");
    out.write("\t</tr>\r\n\t<tr>\r\n\t<td valign=top class=\"fsyl_1\"><font class=\"fsyl_6\">���</font> ���������E��</td>\r\n\t<td><textarea rows=5 cols=72 name=\"rpt_effct_lmt\"><%= UzString.htmlEncodeForHidden(rpt_effct_lmt) %></textarea> <span class=\"fsyl_2\">�E�E00���E�����E/span></td>\r\n\t</tr>\r\n\t<tr>\r\n\t<td valign=top class=\"fsyl_1\"><font class=\"fsyl_6\">���</font> ���E��� ���</td>\r\n\t<td><textarea rows=5 cols=72 name=\"reappr_cnd\"><%= UzString.htmlEncodeForHidden(reappr_cnd)%></textarea> <span class=\"fsyl_2\">�E�E00���E�����E/span></td>\r\n\t</tr>\r\n\t<tr>\r\n\t<td nowrap class=\"fsyl_1\"><font class=\"fsyl_6\">���</font> ������������������E/td>\r\n\t<td><input type=\"text\" size=4 name=\"rply_prf_dt_yyyy\" maxlength=4 value=\"<%= rply_prf_dt_yyyy %>\">��� <input type=\"text\" size=2 name=\"rply_prf_dt_mm\" maxlength=2 value=\"<%= rply_prf_dt_mm %>\">���E<input type=\"text\" maxlength=2 size=2 name=\"rply_prf_dt_dd\" value=\"<%= rply_prf_dt_dd %>\">��� <input type=\"text\" maxlength=2 size=2 name=\"rply_prf_dt_hh\" value=\"<%= rply_prf_dt_hh %>\">���E<input type=\"text\" maxlength=2 size=2 name=\"rply_prf_dt_mi\" value=\"<%= rply_prf_dt_mi %>\">���E<span class=\"fsyl_2\">�E����������������E/span></td>\r\n");
    out.write("\t</tr>\r\n\t<tr>\r\n\t<td>���</td>\r\n\t<td align=right><input type=\"button\" value=\"���������������\" onClick=\"openOptn()\"></td>\r\n\t</tr>\r\n<!---- ��������������������������������������� ----->\r\n\t<tr id=\"com\" style=\"display:none\">\r\n\t<td colspan=2>\r\n\t\t<table border=0 cellspacing=0 cellpadding=5>\r\n\t\t<tr>\r\n\t\t<td class=\"fsyl_1\"><font class=\"fsyl_6\">���</font> ���������������E/td>\r\n\t\t<td>\r\n\t\t\t<select name=\"crrspndUserCombo\">\r\n<%\r\n\tstrSelected = \"\";\r\n\tnLen = 0;\r\n\tif(arrOfUserName != null) nLen = arrOfUserName.length;\r\n\r\n\tif(crrspnd_user.equals(\"\")) strSelected = \"selected\";\r\n%>\r\n\t\t\t\t<option <%= strSelected %> value=\"<%= SKConstants.NOTSPECIFIED %>\">���������������������E/option>\r\n<%\r\n\tfor(int i=0;i<nLen;i++){\r\n\t\tString[] arrTemp = UzUtil.extractTokens(arrOfUserName[i], SKConstants.SEPARATOR);\r\n\t\t\r\n\t\tstrSelected = \"\";\r\n\t\tif(arrTemp[0].equals(crrspnd_user)) strSelected = \"selected\";\r\n%>\r\n\t\t\t\t<option <%= strSelected %> value=\"<%= arrOfUserName[i] %>\"><%= arrTemp[1] %></option>\r\n<%\r\n\t}//for loop\r\n%>\r\n\t\t\t</select>\r\n\t\t\r\n\t\t</td>\r\n\t\t</tr>\r\n\t\t<tr>\r\n\t\t<td class=\"fsyl_1\"><font class=\"fsyl_6\">���</font> ������������������E/td>\r\n");
    out.write("\t\t<td>\r\n\t\t\t<select name=\"fndngDivCombo\">\r\n<%\r\n\tstrSelected = \"\";\r\n\tnLen = 0;\r\n\tif(arrOskCodeNameFndngDiv != null) nLen = arrOskCodeNameFndngDiv.length;\r\n\r\n\tif(fndng_div.equals(\"\")) strSelected = \"selected\";\r\n%>\r\n\t\t\t\t<option <%= strSelected %> value=\"<%= SKConstants.NOTSPECIFIED %>\">���������������������E/option>\r\n<%\r\n\tfor(int i=0;i<nLen;i++) \r\n\t{\r\n\t\tString cd = arrOskCodeNameFndngDiv[i].getCode();\r\n\t\tString nm = arrOskCodeNameFndngDiv[i].getName();\r\n\t\tString value = cd + SKConstants.SEPARATOR + nm;\r\n\r\n\t\tstrSelected = \"\";\r\n\t\tif(cd.equals(fndng_div)) strSelected = \"selected\";\r\n%>\r\n\t\t\t\t<option <%= strSelected %> value=\"<%= value %>\"><%= nm %></option>\r\n<%\r\n\t}//for loop\r\n%>\r\n\t\t\t</select>\r\n\t\t\r\n\t\t</td>\r\n\t\t</tr>\r\n\t\t<tr>\r\n\t\t<td class=\"fsyl_1\"><font class=\"fsyl_6\">���</font> ������������E��������</td>\r\n\t\t<td><input type=\"text\" maxlength=4 size=4 name=\"crrspnd_fin_pln_dt_yyyy\" value=\"<%= crrspnd_fin_pln_dt_yyyy %>\">��� <input type=\"text\" maxlength=2 size=2 name=\"crrspnd_fin_pln_dt_mm\" value=\"<%= crrspnd_fin_pln_dt_mm %>\">���E<input maxlength=2 type=\"text\" size=2 name=\"crrspnd_fin_pln_dt_dd\" value=\"<%= crrspnd_fin_pln_dt_dd %>\">��� <span class=\"fsyl_2\">�E����������������E/span></td>\r\n");
    out.write("\t\t</tr>\r\n\t\t<tr>\r\n\t\t<td class=\"fsyl_1\"><font class=\"fsyl_6\">���</font> ������������E��</td>\r\n\t\t<td><input type=\"text\" maxlength=4 size=4 name=\"crrspnd_fin_dt_yyyy\" value=\"<%= crrspnd_fin_dt_yyyy %>\">��� <input type=\"text\" maxlength=2 size=2 name=\"crrspnd_fin_dt_mm\" value=\"<%= crrspnd_fin_dt_mm %>\">���E<input type=\"text\" size=2 maxlength=2 name=\"crrspnd_fin_dt_dd\" value=\"<%= crrspnd_fin_dt_dd %>\">��� <span class=\"fsyl_2\">�E����������������E/span></td>\r\n\t\t</tr>\r\n\t\t<tr>\r\n\t\t<td valign=top class=\"fsyl_1\"><font class=\"fsyl_6\">���</font> ������������</td>\r\n\t\t<td><textarea rows=8 cols=72 name=\"cause_txt\"><%= UzString.htmlEncodeForHidden(cause_txt) %></textarea> <span class=\"fsyl_2\">�E�E000���E�����E/span></td>\r\n\t\t</tr>\r\n\t\t<tr>\r\n\t\t<td valign=top class=\"fsyl_1\"><font class=\"fsyl_6\">���</font> ���������E��</td>\r\n\t\t<td><textarea rows=10 cols=72 name=\"crrspnd_txt\"><%= UzString.htmlEncodeForHidden(crrspnd_txt) %></textarea> <span class=\"fsyl_2\">�E�E000���E�����E/span></td>\r\n\t\t</tr>\r\n\t\t<tr>\r\n\t\t<td valign=top class=\"fsyl_1\"><font class=\"fsyl_6\">���</font> ���������������E/td>\r\n\t\t<td><textarea rows=8 cols=72 name=\"rlps_prvnt_schm\"><%= UzString.htmlEncodeForHidden(rlps_prvnt_schm) %></textarea> <span class=\"fsyl_2\">�E�E000���E�����E/span></td>\r\n");
    out.write("\t\t</tr>\r\n\t\t</table>\r\n\t</td>\r\n\t</tr>\r\n<!---- ��������������������������������������� ���E----->\r\n\t<tr>\r\n\t<td valign=top class=\"fsyl_1\"><font class=\"fsyl_6\">���</font> ������������������E/td>\r\n\t<td>\r\n\t\t<table border=0 cellspacing=0 cellpadding=0>\r\n\t\t<tr valign=top>\r\n\t\t<td><input type=\"radio\" name=\"mail_sendto_div_radio\" checked onClick=\"mailCheck(true)\" value=\"<%= SKConstants.CD_ONE + SKConstants.SEPARATOR + \"������\" %>\">��������������� <input type=\"radio\" name=\"mail_sendto_div_radio\" onClick=\"mailCheck(false)\" value=\"<%= SKConstants.CD_ZERO + SKConstants.SEPARATOR + \"���������E��\" %>\">���������E��Enbsp; </td>\r\n\t\t<td>\r\n<%\r\n\tstrSelected = \"\";\r\n\tnLen = 0;\r\n\tif(arrOskCodeNameGroup != null) nLen = arrOskCodeNameGroup.length;\r\n\tint nExtra = (nLen/2) + (nLen%2);\r\n%>\r\n<%\r\n\tfor(int i=0;i<nLen;i++) \r\n\t{\r\n\t\tString cd = arrOskCodeNameGroup[i].getCode();\r\n\t\tString nm = arrOskCodeNameGroup[i].getName();\r\n\t\tString value = cd + SKConstants.SEPARATOR + nm;\r\n%>\r\n\t\t\t\t<input type=\"checkbox\" name=\"send_mail\" value=\"<%= value %>\"><%= nm %><br>\r\n<%\r\n\t\tif((i+1) == nExtra)\r\n\t\t{\r\n%>\r\n\t\t\t</td>\r\n\t\t\t<td>    </td>\r\n");
    out.write("\t\t\t<td>\r\n<%\r\n\t\t}\r\n\t}//for loop\r\n%>\r\n\t\t</td>\r\n\t\t</tr>\r\n\t\t</table>\r\n\t</td>\r\n\t</tr>\r\n\t<td>���</td>\r\n\t<td align=right><br><input type=\"submit\" value=\"������������\" name=\"saveReport\">���<input type=\"submit\" value=\"���������������������\" name=\"regReport\"></td>\r\n\t</tr>\r\n\t</table>\r\n\r\n</td>\r\n</tr>\r\n</table>\r\n");
    int evalDoAfterBody = jspxth_sk_form_0.doAfterBody();
    if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
    break;
    } while (true);
    if (_jspx_eval_sk_form_0 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE)
    out = pageContext.popBody();
    What I found out that scriptlets are also encluded in string however they should not be enclosed.
    Is it a bug? or do I need to change my taghandler class...?
    Any suggestion, any help ll be really helpful
    Regards,
    Susheel

    Hi,
    I am able to resolve it,
    Actually I was using the body content as tagdependent instead of jsp.
    However the body content tagdependent works in Tomcat 3.3.1 and weblogic 5.1, 6.0.
    Anyway...

  • Tags with empty body can't work in WLS 7.0SP5

    Hi, I'm now using WLS 7.0 SP5. In my JSPs, I have the following tag with empty body:
              <jsp:setProperty name="xxxForm" property="style123" value="abc"/>
              It doesn't work. The script works if I change that into:
              <jsp:setProperty name="xxxForm" property="style123" value="abc"></jsp:setProperty>
              However I have found that this problem should be fixed in WLS 7.0 SP1 already. (http://support.bea.com/application?namespace=askbea&origin=ask_bea_answer.jsp&event=link.view_answer_page_solution&answerpage=solution&page=wls/S-13458.htm) Any hint about this strange problem? Thanks in advance!

    HI,
    I am using RangeTimeStep for displaying data in time range. I dont know understand whats wrong with this code as it displays graph with some other criteria that I donot specify in RangeTimeStep. The member of Day is like 02/16/2003 and member value is DAY_460. Although I passed both the values but still getting the same graph.
    Would you please tell me whats wrong in the code?
    Presentation graph1 = (Presentation)pageContext.findAttribute("ahb_country_pres1");
    ThinGraph bubbleGraph = (ThinGraph)graph1.getView();
    QueryClient query = (QueryClient) bubbleGraph.getDataSource();
    String strTimeDim = "MDM!D_RMI_RIM_OWNER.TIME";
    String strStandardHier = "MDM!D_RMI_RIM_OWNER.TIME.TIME_HIER";
    Vector vec = new Vector();
    vec.addElement("MDM!D_RMI_RIM_OWNER.TIME.TIME_HIER.L.DAY");
    Selection sel1 = query.findSelection(strTimeDim);
    RangeTimeStep rangeTimestep1 = new RangeTimeStep(strTimeDim,strStandardHier, vec, new Integer (2), RangeTimeStep.BEFORE,"DAY_460");
    rangeTimestep1.setAction(RangeTimeStep.KEEP);
    sel1.removeAllSteps();
    sel1.addStep (rangeTimestep1);
    query.applySelections(new Selection[]{sel1});
    query.refreshAll();
    Regards,
    Aamir

  • How to set an attribute of a HTML tag with a value in the Servlet

    I have a HTML page and a Servlet.
    The HTML page sends a request to the Servlet.
    The Servlet has to read the contents of the HTML page. When the Servlet encounters the body tag it should set the bgcolor attribute of the body tag with a string(For eg.a string called color with a value blue) in the servlet.
    After doing this the Servlet has to update the original HTML page with the changes (in the body tag).
    I need a help on this.

    Hi sangee,
    you could get what you want to do by using a Java Server Page instead of both a HTML page and a Servlet.
    I should code something like this:
    <%Strung color="yourColor"%>
    <html><head><title></title></head>
    <body bgcolor="<%=color%>
    </body>
    </html>

  • WS - "java.rmi.MarshalException: (1)Missing end tag for Body or Envelope"

    HI All,
    I'm new of this forum but I really hope you could help me solving the problem I have to connect Web Services and midlets.
    Somehow my configuration works with some services I've found online but when I invoke very simple services deployed on my server(s) I always have "java.rmi.MarshalException: (1)Missing end tag for Body or Envelope" exception"
    Let me add some more information to the problem:
    System Configuration:
    - JBoss (but I also tried axis) - standard installation (http/1.1)
    - WTK 2.5 (but I also tried 2.2) - standard installation
    - I tried "trusted" and "untrusted" security configuration of the servlet
    - Netbeans IDE 5.0 (to create both Midlets and WS)
    - WS uses document/literal as expected by JSR 172
    The midlet is created with no problems but at the time of invocation the server throws the above exception (which is part of rmi. remoteException)
    By monitoring the network both at client and server side I noticed that the information received is chuncked after 768 bytes. However, If the (soap) reponse is less than such value, I still have the error.
    Using Http/1.1. at the mobile side, the service does not return me anything (0kb) while if I set the mobile device to http/1.0, I get the above error.
    I really have to make the midlet running so any type of help will be really appreciated!!
    Thanks in advance

    Hi all,
    as many developers I have encountered the famous "java.rmi.MarshallException:(1)Missing end tag for Body or Envelope" during the development of my WS app for J2ME (JSR 172).
    It is correct that is the empty tag <soapenv:Header /> causing this error.
    To fix this error, it is necessary to stop the server to generate this empty header in the response stream.
    I have fixed this error for Axis2: unfortunaly it is necessary to modify a class in Axiom library. This library is used in Axis2 to produce the SOAP response, you can download the source code at http://ws.apache.org/commons/axiom/source-repository.html.
    Here the class to modify:
    axiom\modules\axiom-impl\src\main\java\org\apache\axiom\soap\impl\llom\soap11\SOAP11Factory.java
    by commenting the line 273 in the method called getDefaultEnvelope() to prevent the empty header insertion in SOAP response:
    public SOAPEnvelope getDefaultEnvelope() throws SOAPProcessingException {
            OMNamespace ns =
                    new OMNamespaceImpl(
                            SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI,
                            SOAP11Constants.SOAP_DEFAULT_NAMESPACE_PREFIX);
            SOAPEnvelopeImpl env = new SOAPEnvelopeImpl(ns, this);
            //createSOAPHeader(env); the line to be commented
            createSOAPBody(env);
            return env;
        }Finally you have to recompile Axiom using Maven to obtain the fixed package axiom-impl.jar and to replace this package on the lib repository of your Axis2 server.
    A little tricky to fix this bug but now my app runs perfectly ;)
    Enjoy!
    Romain Pellerin
    http://www.gasp-mobilegaming.org

  • Taglib problem: Cannot parse custom tag with short name table

    Hello!
    I am having problems deploying a jsp tag in web as. The same war file works fine on websphere, jboss. SAP web as seems to be complaining about the short name in the tld.
    Can any body me to any known web as issues with jsp tags?
    Thanks
    [code]
    Application error occurs during processing the request.
    Details: com.sap.engine.services.servlets_jsp.server.exceptions.WebIOException: Internal error while parsing JSP page /usr/sap/J2E/JC00/j2ee/cluster/server0/apps/sap.com/dispear/servlet_jsp/disp/root/test.jsp.
         at com.sap.engine.services.servlets_jsp.server.jsp.JSPParser.parse(JSPParser.java:85)
         at com.sap.engine.services.servlets_jsp.server.servlet.JSPServlet.getClassName(JSPServlet.java:207)
         at com.sap.engine.services.servlets_jsp.server.servlet.JSPServlet.compileAndGetClassName(JSPServlet.java:369)
         at com.sap.engine.services.servlets_jsp.server.servlet.JSPServlet.service(JSPServlet.java:164)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:385)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:263)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:340)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:318)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:821)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:239)
         at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)
         at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:147)
         at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:37)
         at com.sap.engine.core.cluster.impl6.session.UnorderedChannel$MessageRunner.run(UnorderedChannel.java:71)
         at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:94)
         at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:162)
    Caused by: com.sap.engine.services.servlets_jsp.lib.jspparser.exceptions.JspParseException: Cannot parse custom tag with short name table.
         at com.sap.engine.services.servlets_jsp.lib.jspparser.syntax.xmlsyntax.CustomJspTag.action(CustomJspTag.java:129)
         at com.sap.engine.services.servlets_jsp.lib.jspparser.syntax.ElementCollection.action(ElementCollection.java:52)
         at com.sap.engine.services.servlets_jsp.server.jsp.JSPParser.initParser(JSPParser.java:307)
         at com.sap.engine.services.servlets_jsp.server.jsp.JSPParser.parse(JSPParser.java:74)
         ... 18 more
    Caused by: com.sap.engine.services.servlets_jsp.lib.jspparser.exceptions.JspParseException: Unknown class name java.lang.Object.
         at com.sap.engine.services.servlets_jsp.lib.jspparser.taglib.TagBeginGenerator.convertString(TagBeginGenerator.java:365)
         at com.sap.engine.services.servlets_jsp.lib.jspparser.taglib.TagBeginGenerator.generateSetters(TagBeginGenerator.java:187)
         at com.sap.engine.services.servlets_jsp.lib.jspparser.taglib.TagBeginGenerator.generateServiceMethodStatements(TagBeginGenerator.java:212)
         at com.sap.engine.services.servlets_jsp.lib.jspparser.taglib.TagBeginGenerator.generate(TagBeginGenerator.java:269)
         at com.sap.engine.services.servlets_jsp.lib.jspparser.syntax.xmlsyntax.CustomJspTag.action(CustomJspTag.java:127)
         ... 21 more
    [/code]

    Hi Ray,
    I am facing similar kind of issue.
    Can you please help to resolve it?
    Thanks in advance.
    Logs are as below [Here I am using standard tag lib]::
    Caused by: com.sap.engine.services.servlets_jsp.jspparser_api.exception.JspParseException: Cannot parse custom tag with short name [out].
         at com.sap.engine.services.servlets_jsp.jspparser_api.jspparser.syntax.xmlsyntax.CustomJspTag.action(CustomJspTag.java:183)
         at com.sap.engine.services.servlets_jsp.jspparser_api.jspparser.syntax.ElementCollection.action(ElementCollection.java:59)
         at com.sap.engine.services.servlets_jsp.jspparser_api.jspparser.syntax.JspIncludeDirective.action(JspIncludeDirective.java:51)
         at com.sap.engine.services.servlets_jsp.jspparser_api.jspparser.syntax.ElementCollection.action(ElementCollection.java:59)
         at com.sap.engine.services.servlets_jsp.jspparser_api.jspparser.syntax.JspElement.customTagAction(JspElement.java:994)
         at com.sap.engine.services.servlets_jsp.jspparser_api.jspparser.syntax.JspElement.action(JspElement.java:228)
         at com.sap.engine.services.servlets_jsp.jspparser_api.jspparser.syntax.ElementCollection.action(ElementCollection.java:59)
         at com.sap.engine.services.servlets_jsp.jspparser_api.jspparser.syntax.ElementCollection.action(ElementCollection.java:69)
         at com.sap.engine.services.servlets_jsp.jspparser_api.jspparser.GenerateJavaFile.generateJavaFile(GenerateJavaFile.java:72)
         at com.sap.engine.services.servlets_jsp.server.jsp.JSPProcessor.parse(JSPProcessor.java:270)
         at com.sap.engine.services.servlets_jsp.server.jsp.JSPProcessor.generateJavaFile(JSPProcessor.java:194)
         at com.sap.engine.services.servlets_jsp.server.jsp.JSPProcessor.parse(JSPProcessor.java:126)
         at com.sap.engine.services.servlets_jsp.jspparser_api.JSPChecker.getClassName(JSPChecker.java:319)
         at com.sap.engine.services.servlets_jsp.jspparser_api.JSPChecker.compileAndGetClassName(JSPChecker.java:248)
         at com.sap.engine.services.servlets_jsp.jspparser_api.JSPChecker.getClassNameForProduction(JSPChecker.java:178)
         at com.sap.engine.services.servlets_jsp.jspparser_api.JSPChecker.processJSPRequest(JSPChecker.java:109)
         at com.sap.engine.services.servlets_jsp.jspparser_api.JspParser.generateJspClass(JspParser.java:154)
         at com.sap.engine.services.servlets_jsp.server.servlet.JSPServlet.service(JSPServlet.java:193)
         ... 47 more
    Caused by: com.sap.engine.services.servlets_jsp.jspparser_api.exception.JspParseException: Attribute [value] of [<c:out>] can accept only static values.
         at com.sap.engine.services.servlets_jsp.jspparser_api.jspparser.taglib.TagBeginGenerator.calculateAttributeValue(TagBeginGenerator.java:476)
         at com.sap.engine.services.servlets_jsp.jspparser_api.jspparser.taglib.TagBeginGenerator.generateSetters(TagBeginGenerator.java:394)
         at com.sap.engine.services.servlets_jsp.jspparser_api.jspparser.taglib.TagBeginGenerator.generateServiceMethodStatements(TagBeginGenerator.java:562)
         at com.sap.engine.services.servlets_jsp.jspparser_api.jspparser.taglib.TagBeginGenerator.generate(TagBeginGenerator.java:678)
         at com.sap.engine.services.servlets_jsp.jspparser_api.jspparser.syntax.xmlsyntax.CustomJspTag.action(CustomJspTag.java:181)
         ... 64 more
    Regards,
    Sankalp

  • Using a custom tag with a 2.3 servlet descriptor BUG?

    Hi,
    I just developed a Custom Tag and I'd like to use in my jsps.
    If I add the jsp in my JDev project with the custom tag when I try to build the project I got this error:
    Error(11): oracle.xml.parser.v2.XMLParseException: Invalid element 'listener' in content of 'web-app', expected elements '[context-param, servlet, servlet-mapping, session-config, mime-mapping, welcome-file-list, error-page, taglib, resource-ref, security-constraint, login-config, security-role, env-entry, ejb-ref]'.
    It seems like when the jsp parser encounters the line with taglib it tries to parse the web.xml against a 2.2 version of the dtd. My web.xml begins with the correct dtd version (2.3). Can anyone tell me if this is a bug and eventually tell me how to solve it?
    thanks,
    Giovanni

    I repost this issue again, now with a simple test case.
    If I wrote a simple custom tag:
    import java.io.IOException;
    import javax.servlet.jsp.tagext.TagSupport;
    public class MyCustomTag extends TagSupport {
    public int doStartTag() {
    try {
    pageContext.getOut().print("FOO");
    } catch (IOException ioe) {
    pageContext.getServletContext().log(ioe.getMessage(),ioe);
    return(SKIP_BODY);
    with the associated tld:
    <?xml version = '1.0' encoding = 'windows-1252'?>
    <taglib>
    <tlibversion>1.0</tlibversion>
    <jspversion>1.2</jspversion>
    <shortname>try</shortname>
    <uri>try</uri>
    <info>A short description...</info>
    <tag>
    <name>mytag</name>
    <tagclass>MyCustomTag</tagclass>
    <bodycontent>EMPTY</bodycontent>
    </tag>
    </taglib>
    and a jsp using the custom tag:
    <%@ page contentType="text/html;charset=windows-1252"%>
    <HTML>
    <HEAD>
    <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252">
    <TITLE>
    Hello World
    </TITLE>
    </HEAD>
    <BODY>
    <H2>
    The current time is:
    </H2>
    <P>
    <% out.println((new java.util.Date()).toString()); %>
    <%@ taglib uri="try.tld" prefix="try" %>
    <try:mytag />
    </P>
    </BODY>
    </HTML>
    all runs fine if I have a web.xml with the dtd version 2.2
    <?xml version = '1.0' encoding = 'windows-1252'?>
    <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
    <web-app>
    <description>Empty web.xml file for Web Application</description>
    <session-config>
    <session-timeout>30</session-timeout>
    </session-config>
    <mime-mapping>
    <extension>html</extension>
    <mime-type>text/html</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>txt</extension>
    <mime-type>text/plain</mime-type>
    </mime-mapping>
    <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>index.html</welcome-file>
    </welcome-file-list>
    </web-app>
    but if I use the version 2.3 because I want filters,context listeners and so on:
    <?xml version = '1.0' encoding = 'windows-1252'?>
    <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/j2ee/dtds/web-app_2_3.dtd">
    <web-app>
    <description>Empty web.xml file for Web Application</description>
    <filter>
    <filter-name>FilterRedirector</filter-name>
    <filter-class>org.apache.cactus.server.FilterTestRedirector</filter-class>
    </filter>
    <!-- Filter Redirector URL mapping -->
    <filter-mapping>
    <filter-name>FilterRedirector</filter-name>
    <url-pattern>/FilterRedirector/</url-pattern>
    </filter-mapping>
    <session-config>
    <session-timeout>30</session-timeout>
    </session-config>
    <mime-mapping>
    <extension>html</extension>
    <mime-type>text/html</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>txt</extension>
    <mime-type>text/plain</mime-type>
    </mime-mapping>
    <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>index.html</welcome-file>
    </welcome-file-list>
    </web-app>
    I get the error I report in my last post. (the jsp doesn't compile) If I remove the custom tag from my jsp all works fine (filters, listeners,etc). In my project settings I use the 2.3 version of servlet.jar instead of the ServletRuntime that comes with JDeveloper.
    Can anyone tell me how to resolve this issue (Using simple custom tag with a web application using the 2.3 servlet specs)?
    Thanks in advance,
    Giovanni
    If I remove the filter secion all

  • JasperException, calling tag with dynamic data

    Hello
    I want to call a tag which I have written with dynamic data.
    I can call the tag like this, and it works fine
    <cm:getCalendar year = "2" week = "51" />But I don't want the input to be hard coded.
    Therefor I have tried to insert GET data to the tag like this
    <cm:getCalendar year = "<%= request.getParameter("year")%>
    " week = "<%= request.getParameter("week")%>" />Or like this
    <cm:getCalendar year = "%{#request.yearNr}" week = "%{#request.weekNr}" />The %{#request.yearNr} should be struts 2 specific I think.
    In both this cases I get this exception
    org.apache.jasper.JasperException: /calendar.jsp(25,0) According to TLD or
    attribute directive in tag file, attribute week does not accept any expressions
    Is there a way which I could insert data dynamic to my own tag?
    Here is the TLD file
    <taglib>
      <tlib-version>1.0</tlib-version>
      <jsp-version>1.2</jsp-version>
      <short-name></short-name>
      <tag>
           <name>getCalendar</name>
           <tag-class>taglib.PrintCalendar</tag-class>
           <body-content>JSP</body-content>
           <attribute>
                <name>year</name>
                <required>true/false</required>
           </attribute>
           <attribute>
                <name>week</name>
                <required>true/false</required>
           </attribute>
      </tag>
    </taglib>

    I change the tld to
    <taglib>
    <tlib-version>1.0</tlib-version>
    <jsp-version>1.2</jsp-version>
    <short-name></short-name>
    <tag>
    <name>getCalendar</name>
    <tag-class>taglib.PrintCalendar</tag-class>
    <body-content>JSP</body-content>
    <attribute>
    <name>year</name>
    <required>true/false</required>
    <rtexprvalue>true</rtexprvalue>
    </attribute>
    <attribute>
    <name>week</name>
    <required>true/false</required>
    <rtexprvalue>true</rtexprvalue>
    </attribute>
    </tag>
    </taglib>

  • Netui:repeater tags with ranges (aka prev/next)

    Is there some way to implement ranges using the <netui:data-repeater> tags? By
    ranges, I mean where you have 123 items in a list and you only display numbers
    1-50. Clicking NEXT would give you items 51-100. When you're there, clicking PREV
    would take you back to 1-50.
    Sample code would be nice. I think it could be done with the <netui:data-choiceMethod>
    tags, but what I am envisioning would be pretty ugly

    I am still stuck. I have the pager working fine. But, I have a checkbox that needs
    to be bound with the recordid. When the form is submitted after selecting records
    on multilple pages, I want to retrieve the recordids of records that were checked.
    How do I do that? A chckbox datasource can only be a one-value String property
    of a form. But, I need to save an array of ids that were checked. I am so lost.
    Please help.
    "bindu" <[email protected]> wrote:
    >
    So sorry Eddie,
    My bad I dint scroll down all the way. Thanks so much.
    Bindu
    Eddie O'Neil <[email protected]> wrote:
    John--
    Here's an example of implementing a paged repeater.
    Briefly, here's how it works:
    The entire data set (a Product[]) is stored in the JPF. When paging
    through this data set, a
    sliding window (also stored as a Product[]) is used to contain the "current"
    set of products to
    render in the page. The sliding window Product[] is of size PAGE_SIZE.
    When transitioning between
    pages, this window is recalculated for each page.
    Also calculated are the "currentPage", "lastPage", "prevPage", and
    "nextPage", which are used to
    render a pager like this:
    Page <currentPage> of <lastPage> <anchor to prevPage> <anchor to
    nextPage>
    The JPF and JSP are pretty well documented. To run the Page Flow,
    drop the JPF and JSP into a
    directory called "repeaterPaging" in an 8.1 SP2 webapp.
    There are lots of other ways this could be done (and certainly some
    that are more efficient :),
    but hopefully this helps get you started.
    Eddie
    Eddie O'Neil wrote:
    John--
    Yep, I did promise that, and nope, it hasn't been done yet. :)
    But, thanks for calling me on it.
    Will try to do that and distribute it to the list in the next fewdays.
    Eddie
    John H wrote:
    Eddie,
    You mentioned putting together an example of paging a repeater in
    this
    thread.
    Did you ever get a chance to put one together? Would really loveto
    see it if
    you did.
    Thanks,
    John
    Eddie O'Neil <[email protected]> wrote:
    Jan--
    We're talking about adding a pager to the repeater in a future
    release of Workshop, but I don't believe that it will appear inan
    8.1
    service pack.
    Additionally in 8.1, we are not exposing a NetUI tag SDK.
    That being said, it isn't that difficult ot build a pager from
    scratch with the <netu:anchor> / <netui:parameter> tags and a little
    code in a JPF.
    You'd want to have "prev" and "next" actions in the JPF to which
    anchors in the JSP are bound. Then, you can keep track of the "current"
    page in the URL and build the previous and next page indices fromthe
    value that is availble in the request. Finally, create an intermediate
    data structure that contains the data to display in the "current"page
    and bind the repeater to this data structure. You'd build the contents
    depending on whether the prev or next links were clicked. For example,
    if your data set has 100 items in it and you only want to displayitems
    20-29, you'd be on page 2 (depending on whether you start countingat
    0 :) and the intermediate list would contain exactly these items.
    Might sound complicated, but I think this would work out prettywell.
    Hope that helps...
    Eddie
    Jan Noppen wrote:
    Are there any plans to include the pager tag with the repeater
    in
    the
    next service packs or releases of WebLogic?
    If not, is there a way to build on the netui:taglibs to extend
    their
    functionality?
    I know the grid has paging functionality but it ties you to rowsetsfor input, whereas the repeater is much more flexible.
    <%@ page language="java" contentType="text/html;charset=UTF-8"%>
    <%@ taglib uri="netui-tags-databinding.tld" prefix="netui-data"%>
    <%@ taglib uri="netui-tags-html.tld" prefix="netui"%>
    <%@ taglib uri="netui-tags-template.tld" prefix="netui-template"%>
    <netui-data:declarePageInput name="displayProducts" type="repeaterPaging.Controller.Product[]"/>
    <netui:html>
    <head>
    <title>Paging with the Repeater</title>
    </head>
    <body>
    <p>
    <b>Paging with the Repeater</b>
    >>
    >> <!-- Pager Text -->
    <netui:label value="Page {request.currentPage} of {request.lastPage}"/>
    <!-- Previous page anchor -->
    <%if(request.getAttribute("prevPage") != null) { %>
    <netui:anchor action="page">
    Previous
    <netui:parameter name="_page" value="{request.prevPage}"/>
    </netui:anchor>
    <% } else {%>
    <!-- don't render the anchor when there is no previous
    page -->
    <netui:label value="Previous"/>
    <% } %>
    <!-- Next page anchor -->
    <% if(request.getAttribute("nextPage") != null) { %>
    <netui:anchor action="page">
    Next
    <netui:parameter name="_page" value="{request.nextPage}"/>
    </netui:anchor>
    <% } else {%>
    <!-- don't render the anchor when there is no next page
    -->
    <netui:label value="Next"/>
    <% } %>
    >> <!-- display the current window into the data set -->
    <netui-data:repeater dataSource="{pageInput.displayProducts}"
    ignoreNulls="true">
    <netui-data:repeaterHeader>
    <table class="tablebody" border="1" width="60%">
    <tr class="tablehead" valign="top">
    <th width="30%">Product ID</th>
    <th>Name</th>
    </tr>
    </netui-data:repeaterHeader>
    <netui-data:repeaterItem>
    <tr valign="top">
    <td align="center"><netui:label value="{container.item.id}"
    defaultValue=" "></netui:label></td>
    <td><netui:label value="{container.item.name}"
    defaultValue=" "></netui:label></td>
    </tr>
    </netui-data:repeaterItem>
    <netui-data:repeaterFooter></table></netui-data:repeaterFooter>
    </netui-data:repeater>
    </p>
    </body>
    </netui:html>
    package repeaterPaging;
    import com.bea.wlw.netui.pageflow.Forward;
    import com.bea.wlw.netui.pageflow.PageFlowController;
    * @jpf:controller
    * @jpf:forward name="success" path="index.jsp"
    * @jpf:forward name="page" path="page.do"
    * @jpf:view-properties view-properties::
    * <!-- This data is auto-generated. Hand-editing this section is not
    recommended. -->
    * <view-properties>
    * <pageflow-object id="pageflow:/repeaterPaging/Controller.jpf"/>
    * <pageflow-object id="action:begin.do">
    * <property value="80" name="x"/>
    * <property value="100" name="y"/>
    * </pageflow-object>
    * <pageflow-object id="action:page.do">
    * <property value="120" name="x"/>
    * <property value="100" name="y"/>
    * </pageflow-object>
    * <pageflow-object id="action-call:@page:index.jsp@#@action:page.do@">
    * <property value="204,180,180,156" name="elbowsX"/>
    * <property value="81,81,92,92" name="elbowsY"/>
    * <property value="West_0" name="fromPort"/>
    * <property value="East_1" name="toPort"/>
    * </pageflow-object>
    * <pageflow-object id="page:index.jsp">
    * <property value="240" name="x"/>
    * <property value="100" name="y"/>
    * </pageflow-object>
    * <pageflow-object id="forward:path#success#index.jsp"/>
    * <pageflow-object id="forward:path#page#page.do"/>
    * </view-properties>
    public class Controller extends PageFlowController
    // number of items to show on a single page
    private static final int PAGE_SIZE = 5;
    // URL parameter key for the value that will store the current page
    private static final String PAGE_PARAM_KEY = "_page";
    // Array to hold the entire data set
    private Product[] products = null;
    * Forward to the "page" action to set-up the first page of
    * data to display in index.jsp.
    * @jpf:action
    protected Forward begin()
    return new Forward("page");
    * Change the page of data that is displayed in index.jsp. This
    action
    * is used if paging to either the previous or to the next page.
    * @jpf:action
    protected Forward page()
    Forward f = new Forward("success");
    page(f);
    return f;
    * Implement data set paging. This method uses a simple _page paramater
    on the URL
    * to indicate the correct "page" to display when "Prev" or "Next"
    are clicked
    * in the JSP. The key principle at work here is a sliding window
    of size PAGE_SIZE
    * that is moved forward and backward through the complete dataset.
    This window
    * contains the set of items to render for a single "page" in the
    repeater. As
    * the current page changes, this window (an array of size PAGE_SIZE)
    is
    * reconstructed.
    * The pager consists of three parts:
    * - a simple "Page # of #" label
    * - a previous anchor that is enabled when there is a previouspage
    * - a next anchor that is enabled when there is a next page
    * To render a "page" of data, the _page parameter is convertedfrom
    a String
    * to an int. Using the page integer, the start and end of a window
    into the
    * complete data set is calculated. This windows slides back and
    forth along the
    * data set in PAGE_SIZE increments depending on the value of the
    current page.
    * In this case, with a PAGE_SIZE of 5 and data set size of 17,the
    possible windows
    * are:
    * products[0] -> products[4]
    * products[5] -> products[9]
    * products[10] -> products[14]
    * products[15] -> products[16]
    * Thus, the lastPage value is 4, which is calculated with the Math.ceil(...)
    * call below.
    * Given the start and end of this window, a temporary array ofsize
    PAGE_SIZE
    * is created to hold references to the items that should render
    from the complete
    * data set. This array is passed to the page as a JPF page input
    and is rendered
    * with the <netui-data:repeater/>.
    * Finally, four additional values are made available to the page
    in the request
    * and are used to render "Page # of #" and to provide parameters
    to anchors that
    * will display the previous and next pages:
    * - Page # of # -- the first # is "currentPage" and the second#
    is "lastPage"
    * - prevPage -- the int value of the previous page. If there is
    no previous page,
    * this value is null in the request
    * - nextPage -- the int value of the next page. If there is no
    next page, this value
    * is null in the request.
    * Notes:
    * - In order to have multiple repeaters on a page operating independently,
    * the "_page" parameter would need to change to include a namespace
    that
    * would be used when finding the current page for a data set.
    * - This JPF is implemented with a single "page" action that performs
    both
    * next and previous paging. This could also be implemented with
    "prevPage" and
    * "nextPage" actions that implement additional logic that runs
    on the previous
    * and next transitions.
    * - No real error checking is done to ensure that the PAGE_SIZE
    is greater than 0.
    * Handling errors:
    * - If parsing _page from the request fails to convert to an int,
    a NumberFormatException
    * is shown in the console and the first page will is used.
    * - If the current page value is greater than the number of pages,
    the last page will
    * be displayed.
    private void page(Forward f)
    assert PAGE_SIZE > 0;
    // calculate the last page
    int lastPage = (int)Math.ceil((float)products.length / (float)PAGE_SIZE);
    int currentPage = 1; // default page is page 1
    Product[] displayProducts = new Product[PAGE_SIZE];
    String currentPageStr = getRequest().getParameter(PAGE_PARAM_KEY);
    if(currentPageStr != null)
    try
    currentPage = Integer.parseInt(currentPageStr);
    catch(NumberFormatException nfe)
    nfe.printStackTrace();
    // continue with a current page of 1
    // ensure the current page is not greater than the number
    of pages
    if(currentPage > lastPage)
    currentPage = lastPage;
    // index into the entire data set at which the window starts
    // page indices are 1 based, adjust to be 0 based for accessing
    // the Product[]
    int start = (currentPage-1) * PAGE_SIZE;
    // index into the entire data set at which the window ends or
    the index
    // of the last item when rendering the last page
    int end = (currentPage != lastPage ? start + PAGE_SIZE : products.length);
    // fill-up the set of Product objects to render up to PAGE_SIZE
    // but don't run off the end of the products array
    for(int i = 0; i < PAGE_SIZE && (start+i < products.length);
    i++)
    displayProducts[i] = products[start + i];
    // set the previous page
    int prevPage = currentPage-1;
    if(prevPage > 0)
    getRequest().setAttribute("prevPage", new Integer(prevPage));
    // set the next page
    int nextPage = currentPage+1;
    if(nextPage <= lastPage)
    getRequest().setAttribute("nextPage", new Integer(nextPage));
    // set the current and last pages in the request in order to
    show "Page # of #"
    getRequest().setAttribute("currentPage", new Integer(currentPage));
    getRequest().setAttribute("lastPage", new Integer(lastPage));
    // set the current window in to the data set as a page input
    f.addPageInput("displayProducts", displayProducts);
    return;
    * Initialize a simple, sample data set that contains
    * 17 products with IDs running from 1-17 and text "Widget 1" to
    * "Widget 17".
    public void onCreate()
    int size = 17;
    products = new Product[size];
    for(int i = 1; i <= size; i++)
    products[i-1] = new Product("Widget " + i, i);
    * Simple JavaBean that contains production information.
    public static class Product
    implements java.io.Serializable
    private String name;
    private int id;
    public Product(String name, int id)
    this.name = name;
    this.id = id;
    public String getName() {return name;}
    public int getId() {return id;}

  • Custom tag with rendered attribute

    Is it possible to create a custom tag that operates similar to a JSF tag with the rendered attribute? Wrapping output with c:if test="..." is not as nice as the JSF rendered option, but I don't want to use JSF for this particular project.
    Edited by: black_lotus on Nov 23, 2007 12:13 PM

    TLD File, per your previous recommendation:
    <attribute>
         <name>disabled</name>
         <required>false</required>
         <rtexprvalue>true</rtexprvalue>
         <type>boolean</type>
    </attribute>My Tag class (snippet):
    public class ButtonTag extends TagSupport
      private boolean disabled;
      public ButtonTag() {}
      public boolean isDisabled()
         return disabled;
      public void setDisabled(boolean b)
        disabled = b;
    }A sample of the jsp file invoking it:
    <c:set var="result" value="${computedValue}"/>
    <ltm:button disabled="${result}"/>Regardless of the value of result, ("true" or "false") it always passes false to the setDisabled method of the button tag class.

  • Control 'ctl00_SPWebPartManager1_g_d4fb972b_26ec_4065_9c89_80b51b384492_gvwikireport' of type 'GridView' must be placed inside a form tag with runat=server.

    Hi,
    I have written code for 'Export To Excel' in the visual web part as below
    //ascx file    
    <table>
        <tr>
            <td>From Date:</td>
            <td><SharePoint:DateTimeControl ID="dtFromDate" runat="server" DateOnly="True" /></td>
        </tr>
        <tr>
            <td>To Date:</td>
            <td><SharePoint:DateTimeControl ID="dtToDate" runat="server" DateOnly="True" TimeOnly="False" /></td>
        </tr>
        <tr>
          <td>Report Type:<asp:DropDownList ID="ddlreporttype" runat="server"><asp:ListItem>Consolidated</asp:ListItem><asp:ListItem>Question Wise</asp:ListItem></asp:DropDownList></td>
            <td>
                <br />               
                <asp:GridView ID="gvwikireport" runat="server">
                </asp:GridView>                   
            </td>
        </tr>   
        <tr>
            <td><asp:Button ID="btnExportToExcel" runat="server" Text="Export To Excel" OnClick="btnExportToExcel_Click"/></td>
        </tr>  
        </table>
    //cs file
    protected void Page_Load(object sender, EventArgs e)
                if (!Page.IsPostBack)
                    BindGridview();
    private void BindGridview()
                DataTable dt = new DataTable();
                dt.Columns.Add("UserId", typeof(Int32));
                dt.Columns.Add("UserName", typeof(string));
                dt.Columns.Add("Education", typeof(string));
                dt.Columns.Add("Location", typeof(string));            
                dt.Rows.Add(1, "SureshDasari", "B.Tech", "Chennai");
                dt.Rows.Add(2, "MadhavSai", "MBA", "Nagpur");
                dt.Rows.Add(3, "MaheshDasari", "B.Tech", "Nuzividu");
                dt.Rows.Add(4, "Rohini", "MSC", "Chennai");
                dt.Rows.Add(5, "Mahendra", "CA", "Guntur");
                dt.Rows.Add(6, "Honey", "B.Tech", "Nagpur");
                gvwikireport.DataSource = dt;
                gvwikireport.DataBind();
    protected void btnExportToExcel_Click(object sender, EventArgs e)
                Page.Response.ClearContent();
                Page.Response.Buffer = true;
                Page.Response.AddHeader("content-disposition", string.Format("attachment; filename={0}", "WikiReport.xls"));
                Page.Response.ContentType = "application/ms-excel";
                StringWriter sw = new StringWriter();
                HtmlTextWriter htw = new HtmlTextWriter(sw);
                gvwikireport.AllowPaging = false;
                BindGridview();
                //Change the Header Row back to white color
                gvwikireport.HeaderRow.Style.Add("background-color", "#FFFFFF");
                //Applying stlye to gridview header cells
                for (int i = 0; i < gvwikireport.HeaderRow.Cells.Count; i++)
                    gvwikireport.HeaderRow.Cells[i].Style.Add("background-color", "#df5015");
                gvwikireport.RenderControl(htw);
                Page.Response.Write(sw.ToString());
                Page.Response.End();            
    But after clicking the 'Export To Excel' button i am getting the below error
    Control 'ctl00_SPWebPartManager1_g_d4fb972b_26ec_4065_9c89_80b51b384492_gvwikireport' of type 'GridView' must be placed inside a form tag with runat=server.
    In case if i am modifying the code as below I am getting error as 'page can have only one server tag'.
    <form id="frmgrdview" runat="server">
     <asp:GridView ID="gvwikireport" runat="server">
                 </asp:GridView></form>
    So please share your ideas/thoughts on the same.
    Regards,
    Sudheer 
    Thanks & Regards, Sudheer

    Hi,
    According to your post, my understanding is that you fail to export to excel.
    I create a demo as below, it works well.
    <table>
    <tr>
    <td>
    <asp:Label ID="Label1" runat="server" Text="Name"></asp:Label>
    </td>
    <td>
    <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
    </td>
    </tr>
    <tr>
    <td>
    <asp:GridView ID="gvwikireport" runat="server">
    </asp:GridView>
    </td>
    <td>
    <br />
    <asp:Button ID="btnExportToExcel" runat="server"
    onclick="btnExportToExcel_Click" Text="Export to excel" />
    </td>
    </tr>
    </table>
    using System;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Data;
    using System.IO;
    namespace Export_to_Excel.VisualWebPart1
    public partial class VisualWebPart1UserControl : UserControl
    protected void Page_Load(object sender, EventArgs e)
    if (!Page.IsPostBack)
    BindGridview();
    private void BindGridview()
    DataTable dt = new DataTable();
    dt.Columns.Add("UserId", typeof(Int32));
    dt.Columns.Add("UserName", typeof(string));
    dt.Columns.Add("Education", typeof(string));
    dt.Columns.Add("Location", typeof(string));
    dt.Rows.Add(1, "SureshDasari", "B.Tech", "Chennai");
    dt.Rows.Add(2, "MadhavSai", "MBA", "Nagpur");
    dt.Rows.Add(3, "MaheshDasari", "B.Tech", "Nuzividu");
    dt.Rows.Add(4, "Rohini", "MSC", "Chennai");
    dt.Rows.Add(5, "Mahendra", "CA", "Guntur");
    dt.Rows.Add(6, "Honey", "B.Tech", "Nagpur");
    gvwikireport.DataSource = dt;
    gvwikireport.DataBind();
    protected void btnExportToExcel_Click(object sender, EventArgs e)
    Page.Response.ClearContent();
    Page.Response.Buffer = true;
    Page.Response.AddHeader("content-disposition", string.Format("attachment; filename={0}", "WikiReport.xls"));
    Page.Response.ContentType = "application/Excel";
    StringWriter sw = new StringWriter();
    HtmlTextWriter htw = new HtmlTextWriter(sw);
    gvwikireport.AllowPaging = false;
    BindGridview();
    //Change the Header Row back to white color
    gvwikireport.HeaderRow.Style.Add("background-color", "#FFFFFF");
    //Applying stlye to gridview header cells
    for (int i = 0; i < gvwikireport.HeaderRow.Cells.Count; i++)
    gvwikireport.HeaderRow.Cells[i].Style.Add("background-color", "#df5015");
    gvwikireport.RenderControl(htw);
    Page.Response.Write(sw.ToString());
    Page.Response.End();
    The result is as below:
    Best Regards,
    Linda Li
    Linda Li
    TechNet Community Support

  • I bought CS6 extended yesterday (yes i did). I have CS4 and lots of photo's in bridge (tagged with keywords). What is the best way to get my photos from bridge cs4 to cs6? Is there a guideline how to go about so I don't loose any of my photos/keywords? Wh

    I bought CS6 extended yesterday (yes i did). I have CS4 and lots of photo's in bridge (tagged with keywords). What is the best way to get my photos from bridge cs4 to cs6? Is there a guideline how to go about: so I don't loose any of my photos/keywords? Who can help?

    The Bridge General Discussion can give you the specifics of transferring your information over to Bridge CS6.

  • MarshalException: Missing end tag for body or Envelop

    Hi, I am new at this, pls advise.
    I have been trying to code a 'hello world' that returns a string, as below.
    //==================
    package simple;
    public class HelloWorld{
    public String sayHello() {
    return "hello";
    //===================
    and my buil.xml looks like this
    //===================
    <project name="simple" default ="all">
    <property file="../properties.txt"/>
    <property name="temp_dir" value="tmp_build" />
    <target name="all" depends="clean,ear,deploy" />
    <target name="clean" >
    <delete dir="${classDir}/tutorial/simple" />
    <delete file="${appDir}/simple.ear" />
    <delete dir="${temp_dir}" />
    <delete file="client.jar" />
    </target>
    <target name="build" depends="ear" />
    <target name="ear" >
    <delete dir="${temp_dir}" />
    <mkdir dir="${temp_dir}" />
    <mkdir dir="${temp_dir}/WEB-INF" />
    <mkdir dir="${temp_dir}/WEB-INF/classes" />
    <javac srcdir="." includes="HelloWorld.java"
    destdir="${temp_dir}" />
    <servicegen
    destEar="simple.ear"
    warName="simple.war"
    contextURI="simple">
    <service
    javaClassComponents="simple.HelloWorld"
    targetNamespace="http://examples/simple"
    serviceName="Echo"
    serviceURI="/HelloWorld"
         generateTypes="True"
    expandMethods="True"
    style="document">
    <client
    packageName="tutorial.simple.client"
    clientJarName="client.jar"
    />
    </service>
    <classpath>
    <pathelement path="${temp_dir}"/>
    <pathelement path="${java.class.path}"/>
    </classpath>
    </servicegen>
    </target>
    <target name="deploy">
    <copy file="simple.ear" todir="${appDir}"/>
    </target>
    </project>
    //======================
    I manage to deploy and run the service on weblogic through the browser. Next, when I try to run it on Java Wirelesss Tookit. I get a "MarshalException: Missing end tag for Body or Evelop" error.
    I basically used the stub generator from WTK and use them as below
    //====================
    try {
    String str = service.sayHello();
    System.out.println( str );
    } catch (Exception e) {
    e.printStackTrace();
    //=====================
    I have no problem running other examples, just this one which i coded on my own. Can anyone pls enlightent me :)

    Hi all,
    as many developers I have encountered the famous "java.rmi.MarshallException:(1)Missing end tag for Body or Envelope" during the development of my WS app for J2ME (JSR 172).
    It is correct that is the empty tag <soapenv:Header /> causing this error.
    To fix this error, it is necessary to stop the server to generate this empty header in the response stream.
    I have fixed this error for Axis2: unfortunaly it is necessary to modify a class in Axiom library. This library is used in Axis2 to produce the SOAP response, you can download the source code at http://ws.apache.org/commons/axiom/source-repository.html.
    Here the class to modify:
    axiom\modules\axiom-impl\src\main\java\org\apache\axiom\soap\impl\llom\soap11\SOAP11Factory.java
    by commenting the line 273 in the method called getDefaultEnvelope() to prevent the empty header insertion in SOAP response:
    public SOAPEnvelope getDefaultEnvelope() throws SOAPProcessingException {
            OMNamespace ns =
                    new OMNamespaceImpl(
                            SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI,
                            SOAP11Constants.SOAP_DEFAULT_NAMESPACE_PREFIX);
            SOAPEnvelopeImpl env = new SOAPEnvelopeImpl(ns, this);
            //createSOAPHeader(env); the line to be commented
            createSOAPBody(env);
            return env;
        }Finally you have to recompile Axiom using Maven to obtain the fixed package axiom-impl.jar and to replace this package on the lib repository of your Axis2 server.
    A little tricky to fix this bug but now my app runs perfectly ;)
    Enjoy!
    Romain Pellerin
    http://www.gasp-mobilegaming.org

  • Writing to multiple tags with the same name

    Hi,
    I am writing to multiple tags with the same name but in different groups. I have noticed only the tag from the first group gets updated. How can I write to a tag in a specific group in this scenario?
    Regards,
    Chanti.

    Heres what I found.
    When I tried "http://<server>:<port>/XMII/Illuminator?Server=<Name of the TAG dataServer>&Mode=CurrentWrite&TagName=<Group>.<TagName>", the outcome was "Message
    Could not add "<Group>.<TagName>" to the response list.
    Message
    No tags selected."
    When I tried "http://<server>:<port>/XMII/Illuminator?Server=<Name of the TAG dataServer>&Mode=CurrentWrite&TagName=<TagName>", it seemed like it worked fine.
    Any thoughts?

  • Send a Mail with Body

    Hi all,
    I want to send a mail with text in the body...I've read some threads in the Forum but i don't understand such well...
    Wich is the minimun SP version I need to be possible send mails with body? I think I've SP12 or SP13. Where can I look my SP?
    Is there any blog or thread I can read about this?
    Thanks a lot.
    Regards.
    Urtzi.

    Hi,
    Please check on hte adapter details to find out the options:
    http://help.sap.com/saphelp_nw04/helpdata/en/6b/4493404f673028e10000000a1550b0/content.htm
    Check this thread to find options available for SP12/13
    http://help.sap.com/saphelp_nw04/helpdata/en/cf/9844428e9cbe30e10000000a155106/frameset.htm
    Regards
    Vijaya

Maybe you are looking for

  • Mac book pro settings keep resetting

    Hi, I am in need of anyone that can help me with my situation. About two days ago, when I booted up my Macbook pro, all the settings would have been resetted (dock is full of apps that I removed, exposes resetted etc). Whenever I would set up all the

  • How do you tell which files are open in bridge cs5?

    In adobe bridge for CS2, open files in Photoshop show an icon in the lower right corner of the bridge thumnail. This is really helpful in sorting if you have a lot of files open. I can't figure out how to tell in bridge CS5 which files are open in ph

  • Change click behavior BAL_DSP_LOG_DISPLAY

    Hello! I have an requirement that is calling FB03 from a double click on an aplication log. I'm using FM BAL_DSP_LOG_DISPLAY to show the required logs. So far so good. The problem is changing the default behavior on the double click of a message (sho

  • Synchronisieren geht nicht mehr

    Hallo Leute, Ich hab da seit Tagen ein riesen Problem. Mein iPhone 4 verbindet sich nicht mehr mit meinem Laptop (Win7) Akku lädt nur sehr langsam, iTunes öffnet sich nicht und das Handy wird auch nicht am Arbeitsplatz oder in iTunes angezeigt..... I

  • Dual monitor: MBP 2012 w/ iMac mid-2010

    Hi everyone I'm about to purchase a 2012 non-retina MacBook Pro which I would like to connect to my mid-2010 iMac. What should I get in order to do that? Thanks