Custom tag or javascript

I have few JSP pages with input fields.
I want to do vaildation for these input fields. (check if empty and popup message) Approach to do the same are:1.Define javascript and include the .js in all the JSPOR 2. Define custom tag for form and use it in all JSP when the <myform:> tag is used,this custom tag will add javascript function in JSP to check the fields in form I am not sure which approach is better.Suggestions are welcome.Thanks

Javascript can be disabled.
Whatever approach you use, back it up with validation on the server-side.

Similar Messages

  • Passing Javascript Enabled or Disabled value in a custom tag

    Hi,
    In my JSP I am using a custom tag.
    This custom tag is having one attribute called status(whose value will be jsenabled means true or jsdisabled means false) depending on the browser's javascript enabled or disabled
    How can i find the value of javascript enabled or javascript disabled and set the value of the attribute status in my jsp.
    This is the custom tag
    <t:tab summary="tabs" url="/services/eservicepac/registrationprocess/process.wss" tabNames='<%=tabList%>' currentTab="<%=currentTab%>" zone="WWW_ZONE" fetchText="false" status=" "
    </t:tab>
    The value of this attribute status=" " should be the value of jsenabled or disabled.
    Since the user can visit any page at any time, the jsenabled value is not maintained in session or request, so i can't take from session or request also.
    As this is urgent,
    --I am expecting the reply                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    Hi Merlin,
    In addition to what was written above, you must make sure that you tell your web application to run as a JSP 2.0 web application.
    You do this by defining your web.xml a little differently. Like this at the top:
    <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee web-app_2_4.xsd">
    That should be what you need to get it working correctly.
    Damian Sutton

  • Generate & using Javascript in custom Tag

    Hi everyone,
    I'm developing a custom tag to create a treeview from a TreeModel.
    I've got a script found on the web which uses a few javascripts file.
    My question is :
    How do i have to use my javascripts file ?
    Do i have to just import the javascipt files in my project ? (i.e. in a directory called "scripts"). Or do the javascripts have to be only available for my tag.
    Of course, the javascripts for the tag should only be used by the tag.
    So, if anyone can give my what's the best practice.
    Thank's
    Sebastien Degardin

    Javascript runs only on the client.
    So the javascript file needs to be on your web server, and your jsp page needs to import that script using the <script> tag.
    It doesn't necessarily need to be in your java project, as it is not needed at compile time. Consider it a static resource like an image or a .html file.
    Basically your JSP is then just generating javascript code that will run on the client.

  • Calling custom CF tag from javascript

    Could someone please help me by posting some psuedo code to
    call a custome cf tag from javascript? I am feeling pretty dumb but
    can't figure it out...
    Thanks bunches!
    Va.

    > ... call a custome cf tag from javascript...
    > ...Press button, call tag to export to excel ...
    Doing it with Javascript defeats the purpose of a custom tag.
    A custom tag is your own custom Coldfusion tag, hence to be used as
    a tag in a cfm or cfc page. I would instead have Javascript
    open the cfm page directly, thus
    <html>
    <head>
    <title>Opening excel page with
    Javascript</title>
    <script type="text/javascript">
    function openIt () {
    window.open("excelExport.cfm","_blank","height=300,width=500,status=yes,menubar=yes,resiz able=yes,scrollbars=yes");
    </script>
    </head>
    <body>
    <FORM>
    <BUTTON name="btn" onclick="openIt();">open
    it</BUTTON>
    </FORM>
    </body>
    </html>
    excelExport.cfm
    ================
    <cfheader name="Content-Disposition" value="attachment;
    filename=testPage.xls">
    <cfcontent type="application/vnd.msexcel"
    file="C:\CFusionMX7\wwwroot\testPage.xls">
    Here follows code that does it the custom tag way. You will
    get the feel of redundancy immediately.

  • Add customized tags on shared review comments

    Hi,
    We have been using shared review to do our document review heavily. Recently I got a request from our stakeholder to add customized tags so we can assign comments in different categories.
    Is it doable with some customization effort? I did some research online and found out Acrobat XI supports customization Wizard and for earlier version (we are on Pro 9), you can do customization using JavaScript, but it's not clear to me if these customization efforts can be applied on shared review PDF, or it's just on regular PDF.
    Does anyone have experience on Acrobat customization? Any thought or information will be appreciated.
    Thanks,
    -Yunju

    Hi Ajlan,
    Thanks for the answer. I also found out about the customization wizard later. Now I'm researching how to use the wizard and deploy the customization feature we desire.
    Here are the things we want to do:
    -  Creating customized menu so we can assign comments to different categories, something like set the comment status
    -  Modify the workflow. Instead of asking reviewer to "connect" or "cancel" when they first open the PDF, we can to only show "connect"
    I also have couple of questions about the wizard:
    1. Are the features I describe above can be done through wizard?
    2. If we deploy the changes using Acrobat 9 + wizard, will users with all version Acrobat/Reader see the same end result and preform regular shared review operations without problem?
    Thanks for the answer.
    -Yunju

  • Custom tag for Marquee in JSF

    Hi,
    I am trying to develop a custom tag for Marquee in JSF, my usecase is to display a value from managed bean(Dynamically). please find the code below and guide me where i have made mistake
    regards
    Sandeep
    Component class:
    package customtags;
    import javax.el.ValueExpression;
    import javax.faces.component.UIComponentBase;
    import javax.faces.context.FacesContext;
    public class Marquee extends UIComponentBase {
         public static final String COMPONENT_TYPE = "marqueecomp";
         public static final String RENDERER_TYPE = "marqueeRenderer";
         private Object[] _state = null;
         private String value;
         public String getValue() {
              if (null != this.value) {
                   return this.value;
              ValueExpression _ve = getValueExpression("value");
              return (_ve != null) ? (String) _ve.getValue(getFacesContext()
                        .getELContext()) : null;
         public void setValue(String marquee) {
              this.value = marquee;
         public String getFamily() {
              // TODO Auto-generated method stub
              return COMPONENT_TYPE;
    //     public void encodeBegin(FacesContext context) throws IOException {
    //          ResponseWriter writer = context.getResponseWriter();
    //          writer.startElement("marquee", this);
    //          writer.write(getValue());
    //          writer.endElement("marquee");
         public void restoreState(FacesContext context, Object state) {
              this._state = (Object[]) _state;
              super.restoreState(_context, this._state[0]);
              value = (String) this._state[1];
         public Object saveState(FacesContext _context) {
              if (_state == null) {
                   _state = new Object[2];
              state[0] = super.saveState(context);
              _state[1] = value;
              return _state;
    Tag Class:
    package customtags;
    import javax.el.ValueExpression;
    import javax.faces.component.UIComponent;
    import javax.faces.webapp.UIComponentELTag;
    public class MarqueeTag extends UIComponentELTag {
         protected ValueExpression marquee;
         public String getComponentType() {
              // TODO Auto-generated method stub
              return Marquee.COMPONENT_TYPE;
         public String getRendererType() {
              // TODO Auto-generated method stub
              return Marquee.RENDERER_TYPE;
         * protected void setProperties(UIComponent component) {
         * super.setProperties(component); Marquee marqComp = (Marquee) component;
         * if (marquee != null) { marqComp.setValue(marquee); } }
         protected void setProperties(UIComponent component) {
              super.setProperties(component);
              Marquee marqComp = null;
              try {
                   marqComp = (Marquee) component;
              } catch (ClassCastException cce) {
                   throw new IllegalStateException(
                             "Component "
                                       + component.toString()
                                       + " not expected type. Expected: com.foo.Foo. Perhaps you're missing a tag?");
              if (marquee != null) {
                   //marqComp.setValueExpression("value", marquee);
                   marqComp.setValue("fsdfsdfsdfsdfsd");
         * @return the marquee
         public ValueExpression getMarquee() {
              return marquee;
         * @param marquee
         * the marquee to set
         public void setMarquee(ValueExpression marquee) {
              this.marquee = marquee;
    *.tld file*
    <?xml version="1.0" encoding="UTF-8"?>
    <taglib xmlns="http://java.sun.com/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd"
         version="2.1">
         <tlib-version>1.0</tlib-version>
         <short-name>marqueecomp</short-name>
         <uri>http://tags.org/marquee</uri>
         <tag>
              <name>marqueeTag</name>
    <tag-class>customtags.MarqueeTag</tag-class>
    <body-content>empty</body-content>
    <attribute>
    <description><![CDATA[Your description here]]></description>
    <name>id</name>
    <required>false</required>
    <rtexprvalue>true</rtexprvalue>
    </attribute>
    <attribute>
    <description><![CDATA[Your description here]]></description>
    <name>value</name>
    </attribute>
         </tag>
    </taglib>
    Renderer class:
    package customtags;
    import java.io.IOException;
    import javax.faces.component.UIComponent;
    import javax.faces.context.FacesContext;
    import javax.faces.context.ResponseWriter;
    import javax.faces.render.Renderer;
    public class MarqueeRenderer extends Renderer {
         public void encodeBegin(final FacesContext facesContext,
    final UIComponent component) throws IOException {
    super.encodeBegin(facesContext, component);
    final ResponseWriter writer = facesContext.getResponseWriter();
    writer.startElement("DIV", component);
    /*String styleClass =
    (String)attributes.get(Shuffler.STYLECLASS_ATTRIBUTE_KEY);
    writer.writeAttribute("class", styleClass, null);*/
    public void encodeEnd(final FacesContext facesContext,
    final UIComponent component) throws IOException {
    final ResponseWriter writer = facesContext.getResponseWriter();
    writer.endElement("DIV");
    in Faces-Config:
    <component>
              <display-name>marqueecomp</display-name>
              <component-type>marqueecomp</component-type>
              <component-class>customtags.Marquee</component-class>
              <component-extension>
    <renderer-type>marqueeRenderer</renderer-type>
    </component-extension>
         </component>
         <render-kit>
    <renderer>
    <component-family>marqueecomp</component-family>
    <renderer-type>marqueeRenderer</renderer-type>
    <renderer-class>customtags.MarqueeRenderer</renderer-class>
    </renderer>
    </render-kit>
    In class path --->marquee.taglib.xml
    <?xml version="1.0"?>
    <!DOCTYPE facelet-taglib PUBLIC
    "-//Sun Microsystems, Inc.//DTD Facelet Taglib 1.0//EN"
    "http://java.sun.com/dtd/facelet-taglib_1_0.dtd">
    <facelet-taglib>
    <namespace>http://tags.org/marquee</namespace>
    <tag>
    <tag-name>marqueeTag</tag-name>
    <component>
    <component-type>marqueecomp</component-type>
    <renderer-type>marqueeRenderer</renderer-type>
    </component>
    </tag>
    </facelet-taglib>
    *.xhtml file*
    <html xmlns="http://www.w3.org/1999/xhtml"
         xmlns:ui="http://java.sun.com/jsf/facelets"
         xmlns:h="http://java.sun.com/jsf/html"
         xmlns:f="http://java.sun.com/jsf/core" xml:lang="en" lang="en"
         xmlns:a4j="http://richfaces.org/a4j"
         xmlns:rich="http://richfaces.org/rich" xmlns:mycomp="http://tags.org/marquee">
    <head>
    <title>DEBTDOC Home Page</title>
    <meta http-equiv="keywords" content="enter,your,keywords,here" />
    <meta http-equiv="description"
         content="A short description of this page." />
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
    <link rel="stylesheet" type="text/css" href="../css/common.css"></link>
    <script language="javascript" src="../script/common.js"></script>
    </head>
    <body>
    <f:view>
    <mycomp:marqueeTag value="hello World"></mycomp:marqueeTag>

    There exist the JSTL SQL taglib, but I don't recommend this. It should only be used for quick development and testing. For database connectivity, rather create a data layer with DAO classes which you on its turn just plug in your business layer (with servlets).

  • Custom tag - setProperties() not called

    Hi all,
    I've created my first custom tag with it's own component class, Tag Class, Renderer and TLD. However, when the JSP first loads, the encode() method fails in trying to get the attribute values from the attribute Map - the Map is empty. Upon further debugging I can see that the Tag class is called and the setter methods are called for each attribute but the setProperties() method is never called before release(), so the attributes are never stored in the UIComponent's attribute Map.
    Anybody know what I'm doing wrong?
    Some code:
    Tag Class...
    public class ListShuttleTag extends UIComponentTag
    public void setProperites(UIComponent component)
      super.setProperties(component);
      ComponentTagHelper.setString(component, "sourceValue", sourceValue);
      ComponentTagHelper.setString(component, "targetValue", targetValue);
      ComponentTagHelper.setInteger(component, "size", size);
      ComponentTagHelper.setInteger(component, "targetListWidth", targetListWidth);
      ComponentTagHelper.setInteger(component, "sourceListWidth", sourceListWidth);
      ComponentTagHelper.setString(component, "sourceCaption", sourceCaption);
      ComponentTagHelper.setString(component, "targetCaption", targetCaption);
    ...TLD...
      <taglib>
        <tlib-version>1.1</tlib-version>
        <jsp-version>2.1</jsp-version>
        <tag>
          <name>listShuttle</name>
          <tag-class>com.katun.jsf.tag.ListShuttleTag</tag-class>
          <description>A listShuttle allows the moving of items from one listBox to another</description>
          <!-- General component attributes -->
          <attribute>
            <name>binding</name>
            <description>
                 A binding that points to a bean property
            </description>     
          </attribute>
          <attribute>
            <name>id</name>
            <description>The client id of this component</description>     
          </attribute>
          <attribute>
            <name>rendered</name>
            <description>Is this component rendered?</description>     
          </attribute>
          <attribute>
            <name>disabled</name>
            <description>Is this component disabled?</description>     
          </attribute>
          <attribute>
            <name>required</name>
            <description>Is this component required?</description>     
          </attribute>
          <!-- listShuttle specific attributes -->
          <attribute>
            <name>sourceValue</name>
            <required>true</required>
            <description>A binding for the items in the source list</description>
          </attribute>
          <attribute>
            <name>targetValue</name>
            <description>A binding for the items in the target list</description>
          </attribute>
          <attribute>
            <name>size</name>
            <description>Defines the number of items visible in each list</description>
          </attribute>
          <attribute>
            <name>sourceListWidth</name>
            <description>Width of the source list</description>
          </attribute>
          <attribute>
            <name>targetListWidth</name>
            <description>Width of the target list</description>
          </attribute>
          <attribute>
            <name>sourceCaption</name>
            <description>Label displayed above the source list</description>
          </attribute>
          <attribute>
            <name>targetCaption</name>
            <description>Label displayed above the target list</description>
          </attribute>
        </tag>
    ...

    Gotcha........
    First, this is what the jsp spec has to say in sec 1.14.1
    When using scriptlet expressions, the expression must
    appear by itself (multiple expressions, and mixing of expressions and string
    constants are not permitted). Multiple operations must be performed within the
    expression.Simple, isnt it ? All you have to is evaluate the expression as a whole.
    <form:toolbaritem id="icon_cancelar" action="<%="javascript:listingAction('" + request.getContextPath() + "/logout.do;')"%>" icon<%= request.getContextPath() + " /images/toolbar/Cancelar_32.gif " %>"/>cheers,
    ram.

  • Custom Tag Attribute not correctly rendered

    Hello,
    I made a custom tag and I want the engine to parse dynamic scripts and evaluate them.
    I call the tag like this :
        <form:toolbaritem id="icon_cancelar" action="javascript:listingAction('<%= request.getContextPath() %>/logout.do');" icon="<%= request.getContextPath() %>/images/toolbar/Cancelar_32.gif"/>The icon and action attributes are declared in the tld like so :
              <attribute>
                   <name>action</name>
                   <required>true</required>
                   <rtexprvalue>true</rtexprvalue>
              </attribute>
              <attribute>
                   <name>icon</name>
                   <required>true</required>
                   <rtexprvalue>true</rtexprvalue>
              </attribute>However, the tag is not working with the evaluated expression, receiving "<%= request.getContextPath() %>" instead.
    Any help would be very welcome :) thank you
    Eamerial

    Gotcha........
    First, this is what the jsp spec has to say in sec 1.14.1
    When using scriptlet expressions, the expression must
    appear by itself (multiple expressions, and mixing of expressions and string
    constants are not permitted). Multiple operations must be performed within the
    expression.Simple, isnt it ? All you have to is evaluate the expression as a whole.
    <form:toolbaritem id="icon_cancelar" action="<%="javascript:listingAction('" + request.getContextPath() + "/logout.do;')"%>" icon<%= request.getContextPath() + " /images/toolbar/Cancelar_32.gif " %>"/>cheers,
    ram.

  • Using gateway'd URLs in JSP custom tag attributes

    Hello,
    I am running Plumtree G6 using a gateway prefix to gateway Javascript from a remote server. I have recently discovered, thanks to people's help on the forum here, that in certain cases, you need to wrap a URL in a pt:url tag in order for Plumtree to recognize it as a URL that has to be gateway'd (i.e. a URL inside of a Javascript function).
    However, I have a custom tag that contains a contextPath attribute. This custom tag then includes other XML files that get included in the final page that is displayed. I am passing this value as my contextPath:
    <mytag:body sessionName="mysession" campusName="SampleCampus" contextPath="<pt:url pt:href='http://localhost:7021/application/scripts' xmlns:pt='http://www.plumtree.com/xmlschemas/ptui/'/>"/>
    However, in the resulting content that is created from this custom tag, the contextPath value is still set to <pt:url pt:href=......./>, and not the actual gateway'd URL. I would have thought that Plumtree would have recognized and gateway'd this URL before it got substituted in the custom tag.
    Does anyone have any thoughts on how to get around a problem like this? One thought I had was to get ahold of the gateway URL value and pass that value directly in my contextPath attribute. Is it possible to get that gateway value, or is there a better solution here?
    Thanks again for any help you can provide.

    Chris,
    I added your code, changed the portlet's web service to send a login token for this portlet, and was then getting some ClassNotFoundExceptions related to Axis classes. So, I went and added all of the jar files from the devkit's lib directory (i.e. plumtree\ptedk\5.3\devkit\WEB-INF\lib), recompiled, and those errors went away. But, now I see the following error:
    java.lang.NoSuchFieldError: RPC
         at com.plumtree.remote.prc.soap.QueryInterfaceAPISoapBindingStub.(QueryInterfaceAPISoapBindingStub.java:27)
         at com.plumtree.remote.prc.soap.QueryInterfaceAPIServiceLocator.getQueryInterfaceAPI(QueryInterfaceAPIServiceLocator.java:43)
         at com.plumtree.remote.prc.soap.QueryInterfaceProcedures.(QueryInterfaceProcedures.java:37)
         at com.plumtree.remote.prc.xp.XPRemoteSession.(XPRemoteSession.java:202)
         at com.plumtree.remote.prc.xp.XPRemoteSessionFactory.GetTokenContext(XPRemoteSessionFactory.java:80)
         at com.plumtree.remote.portlet.xp.XPPortletContext.getRemotePortalSession(XPPortletContext.java:261)
         at com.plumtree.remote.portlet.PortletContextWrapper.getRemotePortalSession(PortletContextWrapper.java:45)
         at jsp_servlet._collabrasuite.__riarooms._jspService(__riarooms.java:325)
         at weblogic.servlet.jsp.JspBase.service(JspBase.java:33)
         at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1006)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
         at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
         at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:417)
         at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:315)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6718)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
         at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
         at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3764)
         at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2644)
         at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
         at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)
    I am using version 5.3 of the EDK, and running Plumtree Foundation G6. Have you ever seen an error like this before?
    Thanks again for all of your help.

  • Creating drop down menus in JSP using custom tags

    Hi, i am working on a JSP which has custom tags for displaying menubar and menus, now i want to have these menus converted into drop down menus, and the submenus displayed onmouseover event. I am getting solutions with pure html page calling javascript functions.But i dont need this, i want the work done by my TagHandler class which sends the output to output stream, which in turn is transformed in to actual HTML by a XSLT embedded in my JSP.
    Please help as i am new to custom tags, and desperately in need of help.
    If possible give some sample code or useful links.
    I will be highly grateful.
    Thankx in advance

    that's fine, but the tag has to, ultimately, generate the HTML/Javascript stuff like you've already seen.

  • Simultaneous Client and Server Form Validation using Custom Tag Library

    I am developing a custom tag library for validator tags
    which are capable of doing client side validation (Javascript)
    and server side (Java). My problem is with the development
    of a regular expression based validator. Because of differences
    in the way Javascript and Java handle regular expressions
    i can not use the same regular expression for both types of
    validation. Is there any way to convert a valid regular
    expression from the java.util.regex format into the Javascript
    format or vice versa? My major problems are with the (or, ||)
    statements and the user of backslashes.

    If you are speaking of RE syntax flavours, they are basically the same(namely perl5 flavour). Any expression that works in JS should work in j.u.regex too.
    Though, their usage is quite different.
    So, there is no need for convertion of expressions.
    But porting the code may be not so trivial.

  • Custom Tag

    Hello,
    I wonder how to call a custom tag from a jsp function.
    I've got a funcion called void mostrarGrid(........) that has to show a grid. But i dont Know how to call the grid. If i use it in the jsp body it works ok, but if i put it inside a function it doesnt work. Thanks
    <%@ taglib uri="/webapp/mytaglib" prefix="FormUsuario"%><%
    response.setDateHeader ("Expires", 0); //prevents caching at the proxy server
    %>
    <%@ page contentType='text/html;charset=windows-1252'%>
    <%@ page errorPage="error.jsp" %>
    <%@ page import='CapaNegocio.LocalGaraje,
    CapaNegocio.GestionLocales,
    java.util.*'%>
    <jsp:useBean id='GestionLocales' class='CapaNegocio.GestionLocales' scope='request'/>
    <jsp:setProperty name='GestionLocales' property='*'/>
    <jsp:useBean id='LocalGaraje' class='CapaNegocio.LocalGaraje' scope='request'/>
    <jsp:setProperty name='LocalGaraje' property='*'/>
    <%@ taglib uri='/webapp/mytaglib' prefix='FormUsuario'%>
    <html>
    <head>
    <base target="_self">
    <link type='text/css' rel='stylesheet' href='css/estilos.css'/>
    <meta http-equiv='Content-Type' content='text/html; charset=windows-1252'>
    <title>Gesti�n de Telefonos</title>
    </head>
    <%@ include file='rutinas.jsp' %>
    <%!
    int WIDTH_AJUSTE_PAGINA = 600;
    static final int OP_MOSTRAR_LISTA = 1; //VIENE DE LA PANTALLA DE lOCALES (BOTON RECIBOS)
    %>
    <BODY>
    <%
    String urlGrid = "";
    String orden = "";
    String pagina = "";
    String id = "";
    String OP = "";
    id = request.getParameter("id");
    OP = request.getParameter("OP");
    orden = request.getParameter("orden");
    if (orden==null)
    orden = "";
    pagina = request.getParameter("pagina");
    if (pagina==null)
    pagina = "";
    switch (Integer.parseInt(OP)){
    case OP_MOSTRAR_LISTA:{
    LocalGaraje.setIdLocal(id);
    urlGrid = "telefonos.jsp?OP=1&id="+id;
    mostrarGrid(out,id,orden,GestionLocales,LocalGaraje,urlGrid);
    mostrarBotones(out,id);
    break;
    %>
    <%!
    void mostrarGrid(JspWriter out,String id,String orden,GestionLocales ges,LocalGaraje loc,String urlGrid) throws Exception{
    out.print("<FormUsuario:Grid ");
    out.print(" Datos=" + null );
    out.print(" rsDatos=\"" + ges.listarTelefonosRs(loc,orden) + "\"");
    out.print(" titulo=\"Lista de Telefonos\"");
    out.print(" Columnas=\"idPlaza,Descripci�n,N�mero,Letra,Nif,Nombre,P.Apellido,S.Apellido,Tel.,Tel.\"");
    out.print(" Campos=\"pla.idPlazaGaraje,Descripcion,numero,letra,nifCif,nombre,apellido1,apellido2,telefono1,telefono2\"");
    out.print(" anchoColumna=\"0,6,2,2,9,21,21,21,9,9\"");
    out.print(" tipoColumna=\"P,L,L,L,L,L,L,L,L,L\"");
    out.print(" anchoCaracteres=\"0,6,2,2,9,20,20,20,10,10\"");
    out.print(" RegPorPagina=\"10\"");
    out.print(" cabBusqueda=\"N\"");
    out.print(" accionId=\"datosCliente.jsp?OP=1\"");
    out.print(" targetAccionId=\"\"");
    out.print(" modal=\"NOMODAL\"");
    out.print(" retornoModal=\"NifCif,nombre\"");
    out.print(" titleBotonTodos=\"\"");
    out.print(" urlGrid=\"" + urlGrid + "\"");
    out.print(" accionCheck=\"\">");
    // mostrarBotones(JspWriter out,String id) throws Exception{
    void mostrarBotones(JspWriter out,String id) throws Exception{
    out.print("<TABLE align='center' Border='1' bordercolor='Silver' Width='" WIDTH_AJUSTE_PAGINA"' cellspacing=0 cellpadding=0 >");
    out.print(" <TR><TD bgcolor='Silver' align='CENTER' >");
    out.print(" <INPUT Class='importante' type='button' value='Imprimir' title='Generar los Recibos' onclick=\"javascript:imprimir('"+id+"')\" id='cmdImprimir' name='cmdImprimir'>");
    out.print(" </TD>");
    out.print(" </TR>");
    out.print("</TABLE>");
    %>
    </BODY>
    </html>
    <script>
    function imprimir(id){
    var strMsg = "";
    window.alert(id);
    </script>

    The idea is to have a fucntion to paint the grid, the problem is that is i put the tag inside de function it always is executed even if i dont call the funtion.
    i could change the call by an include but.......
    <%@ taglib uri="/webapp/mytaglib" prefix="FormUsuario"%><%
      response.setDateHeader ("Expires", 0); //prevents caching at the proxy server
    %>
    <%@ page contentType='text/html;charset=windows-1252'%>
    <%@ page errorPage="error.jsp" %>
    <%@ page import='CapaNegocio.LocalGaraje,
                     CapaNegocio.GestionLocales,
                     java.util.*'%>
    <jsp:useBean id='GestionLocales' class='CapaNegocio.GestionLocales'  scope='request'/>
    <jsp:setProperty name='GestionLocales' property='*'/>
    <jsp:useBean id='LocalGaraje' class='CapaNegocio.LocalGaraje'  scope='request'/>
    <jsp:setProperty name='LocalGaraje' property='*'/>
    <%@ taglib uri='/webapp/mytaglib' prefix='FormUsuario'%>
    <html>
    <head>
        <base target="_self">
        <link type='text/css' rel='stylesheet' href='css/estilos.css'/> 
        <meta http-equiv='Content-Type' content='text/html; charset=windows-1252'>
        <title>Gesti�n de Telefonos</title>
    </head>
    <%@ include file='rutinas.jsp' %>
    <%!
        int  WIDTH_AJUSTE_PAGINA = 600;
        static final int    OP_MOSTRAR_LISTA       = 1; //VIENE DE LA PANTALLA DE lOCALES (BOTON RECIBOS)
    %>
    <BODY>
    <%
        String urlGrid = "";
        String orden = "";
        String pagina = "";
        String id = "";
        String OP = "";
        id     = request.getParameter("id");
        OP     = request.getParameter("OP");
        orden = request.getParameter("orden");
        if (orden==null)
          orden = "";
        pagina = request.getParameter("pagina");   
        if  (pagina==null)
          pagina = "";
          switch (Integer.parseInt(OP)){
            case OP_MOSTRAR_LISTA:{
              LocalGaraje.setIdLocal(id);
              urlGrid = "telefonos.jsp?OP=1&id="+id;
              mostrarGrid(out,id,orden,GestionLocales,LocalGaraje,urlGrid);                 
              mostrarBotones(out,id);       
              break;
    %>     
    <%!
      void mostrarGrid(JspWriter out,String id,String orden,GestionLocales ges,LocalGaraje loc,String urlGrid) throws Exception{
           out.print("<FormUsuario:Grid ");
           out.print("    Datos=" + null  );
           out.print("      rsDatos=\"" + ges.listarTelefonosRs(loc,orden) + "\"");
           out.print("      titulo=\"Lista de Telefonos\"");
           out.print("      Columnas=\"idPlaza,Descripci�n,N�mero,Letra,Nif,Nombre,P.Apellido,S.Apellido,Tel.,Tel.\"");
           out.print("      Campos=\"pla.idPlazaGaraje,Descripcion,numero,letra,nifCif,nombre,apellido1,apellido2,telefono1,telefono2\"");
           out.print("      anchoColumna=\"0,6,2,2,9,21,21,21,9,9\"");
           out.print("      tipoColumna=\"P,L,L,L,L,L,L,L,L,L\"");
           out.print("      anchoCaracteres=\"0,6,2,2,9,20,20,20,10,10\"");
           out.print("      RegPorPagina=\"10\"");
           out.print("      cabBusqueda=\"N\"");
           out.print("      accionId=\"datosCliente.jsp?OP=1\"");
           out.print("      targetAccionId=\"\"");
           out.print("      modal=\"NOMODAL\"");
           out.print("      retornoModal=\"NifCif,nombre\"");
           out.print("      titleBotonTodos=\"\"");
           out.print("      urlGrid=\"" + urlGrid + "\"");
           out.print("      accionCheck=\"\">");
    //   mostrarBotones(JspWriter out,String id) throws Exception{
       void mostrarBotones(JspWriter out,String id) throws Exception{
        out.print("<TABLE align='center' Border='1' bordercolor='Silver' Width='" +WIDTH_AJUSTE_PAGINA+"' cellspacing=0 cellpadding=0 >");
        out.print("  <TR><TD bgcolor='Silver' align='CENTER' >");
        out.print("    <INPUT Class='importante' type='button' value='Imprimir' title='Generar los Recibos' onclick=\"javascript:imprimir('"+id+"')\" id='cmdImprimir' name='cmdImprimir'>");
        out.print("   </TD>");
        out.print("  </TR>");
        out.print("</TABLE>");
    %>     
    </BODY>
    </html>
    <script>
      function imprimir(id){
      var strMsg = "";
      window.alert(id);
    </script>

  • JSP Custom tag issues.

    Hi all,
    When my JAVA_HOME env variable is pointing to C:\jdk1.3, the JSP below which contains some custom tags fails to compile in Weblogic 5.1. However, when i change my JAVA_HOME env variable to C:\weblogic\jre1_2\jre, the same JSP compiles and deploys with no problems. I was of the opinion that the jre in jdk 1.3 is the same as jre1_2 which is bundled with weblogic 5.1. Does anyone know of any differences btw the Jre's or why the JSP below cannot be compiled when i use JDK1.3. Thanks for the help.
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <%@ page import="java.util.Vector" %>
    <%@ page import="com.spcs.premiere.common.framework.errorhandling.ErrorUtility" %>
    <%@ page import="com.spcs.premiere.common.framework.errorhandling.PremiereLogger" %>
    <%@ page import="org.grnds.structural.web.GrndsServletException" %>
    <%@ taglib uri="/tlds/profiling/profile.tld" prefix="profile" %>
    <%@ page import="com.spcs.premiere.web.common.HTMLListBuilder" %>
    <%@ page import="com.spcs.premiere.web.common.ListParametersDomain" %>
    <%@ page import="com.spcs.premiere.web.common.PremiereConstants" %>
    <%@ page import="com.spcs.premiere.ejb.authentication.LoginDomain" %>
    <html>
    <head>
         <title>Premiere Business...Assign Credit Class</title>
         <LINK HREF="<%= request.getContextPath()%>/stylesheets/premiere.css" REL="stylesheet" TYPE="text/css">
         <SCRIPT LANGUAGE="javascript">
              var winHandle=window.dialogArguments;
         function userFocus()
              window.document.SupervisorLoginForm.SupervisorUserName.focus();
         </SCRIPT>
    </head>
    <body onload="userFocus();">
    <%
    try{
    %>
    <TABLE WIDTH="100%" HEIGHT="100%" CLASS="groupbox">
    <TR>
              <TABLE WIDTH="100%" HEIGHT="75%" CLASS="groupbox">
              <TR HEIGHT="15%"></TR>
              <FORM NAME="SupervisorLoginForm" ACTION="<%= request.getContextPath() %>/Premiere/AddAccountConversation/SupervisorLogin" METHOD="post" TARGET="_self">
    <TR HEIGHT="15%">
    <TD align=center><LABEL NAME="SupervisorUserNameLabel">User ID:</LABEL></TD></TD>
    <TD align=left><INPUT TYPE="text" NAME="SupervisorUserName" MAXLENGTH="20" SIZE="20" TABINDEX="1"></TD></TR>
              </TR>
              <TR>
    <TD align=center>    <LABEL NAME="SupervisorPasswordLabel">Password:</LABEL></TD></TD>
    <TD align=left><INPUT TYPE="password" NAME="SupervisorPassword" TABINDEX="2" MAXLENGTH="20" SIZE="20" ENABLED></TD>
              </TR>
              <TR>
              <TD COLSPAN="2" ALIGN="center"><BUTTON TYPE="submit" NAME="Login" TABINDEX="3" Class="button">Login</BUTTON></TD>
              <TD></TD>
              </TR></FORM>
              <FORM NAME="CreditClassForm" ACTION="<%= request.getContextPath() %>/Premiere/AddAccountConversation/AssignCreditManually" METHOD="post">
    <TR HEIGHT="60%">
    <TD align=center>        <LABEL NAME="SupervisorCreditClassLabel">Credit Class:</LABEL></TD></TD>
    <TD align=left>
              <profile:user WidgetName="CreditClass" Context="JSP" SubContext="SupervisorLogin" Evaluate="SUPERVISOR">
              <%= HTMLListBuilder.buildHTMLList((ListParametersDomain)session.getAttribute("CreditClassCodes")) %></TD>
              </profile:user>
              <TD></TD>          
              </TR>
              <TR></TR>
              </TR></TBODY></TABLE>
    </TR>
              <TR>
              <TABLE WIDTH="100%" HEIGHT="25%" CLASS="groupbox">
              <TD></TD>
              <TD align=right><BUTTON NAME="Cancel" Class="button" TABINDEX="4" ONCLICK="window.close()">Cancel</BUTTON>  
              <profile:user WidgetName="Save" Context="JSP" SubContext="SupervisorLogin" Evaluate="SUPERVISOR">
                   <BUTTON TYPE="submit" NAME="Save" TABINDEX="6" Class="button">Save</BUTTON>  
                   </profile:user>
              </TD>
              </TR></TBODY></TABLE>
              </TR></TBODY></TABLE>
              </FORM>
    <%
    catch (Exception e)
    LoginDomain loginDomain = (LoginDomain)session.getAttribute(PremiereConstants.LOGIN_DOMAIN);
    PremiereLogger.log( "ERROR", loginDomain.getUserName()+" General Exception Error: ", e );
    request.setAttribute(ErrorUtility.ERROR_CONDITION, ErrorUtility.getMessage(PremiereConstants.GENERIC_JSP_EXCEPTION_ERROR_ID) );
    throw new GrndsServletException();
    %>          
    </body>
    </html>

    UUh, interesting.
    Try to use the last Service Pack for 5.1 - i think it is sp9.
    Hope it'll work. I've had some problems with XML parsing but they resolved when I installed the last SP...

  • A Custom tag/servlet that calculates the session size ?

    Hi all,
              is anybody aware of a custom tag/library that calculates the size of the Session ?
              Thanks a lot
              Francesco

    250 lines, lol.  You need a loop then.
    // Function in document JavaScript
    function calcTotal() {
    for (var i = 0; i<=249; i++){
        this.getField("Total1.0." + i).value = this.getField("Price1.0." + i).value * this.getField("Qty.1.0." + i).value;
    Launch this script only ONCE in a custom calculate script and the script will run through all 250 lines from line 0 to line 249.
    to launch it:
    //put this in a calulate script
    calcTotal();

  • How can a custom tag write multiple fragments in the response ?

    I have a custom tag that needs to write at least 2 html/xhtml fragments into the response in order to be html compliant. The custom tag outputs a script that must be located in the head section and other elements that refers to the script.
    Events handlers of html input elements follow this pattern. The handler may need to refer to script functions defined in the head section of the document.
    Is it possible with the custom tag architecture to handle this scenario ?

    I don't think so, unless the tag wraps the entire page, but that's harder to do. Maybe a tag could wrap the whole page and you could have another inner tag that acts as a marker of where to put things (kinda like Jakarta Commons Tiles tags).
    Otherwise, you could use 2 tags and share data put in the request scope by the header tag in the subsequent body tags.
    Or since you are writing Javascripts with the one tag, you don't strictly need to put the JS in the head. Although I'm not sure about that restriction in XHTML.

Maybe you are looking for

  • File sharing to Windows with XServe as Domain Member

    I have an XServe (10.4.3 server) that I am attempting to use as a new fileserver on an established Windows network (with SBS2000 on the old Windows server). I had the XServe as a standalone server, and set up some folders to share, and used WGM to sh

  • Tomcat exception of broken pipes

    I got the exeption continueously as below. how to get rid of it? thanks 2005-3-29 14:46:05 org.apache.jk.server.JkCoyoteHandler action : Error in action code java.net.SocketException: Broken pipe      at java.net.SocketOutputStream.socketWrite0(Nativ

  • Jerky mouse, poor responses after installing OS 10.5.7

    I installed OS 10.5.7 on my 20" iMac dual core Intel (3Gb RAM) about three weeks ago. Since then, I've noticed that the computer does many things poorly: Jerky mouse behavior, especially in Photoshop CS3 (but to a lesser extent in other programs), ve

  • When my wife changes contacts on her phone it changes contacts on my phone and vice versa

    When my wife or I make changes to our contacts on iphone 4 and 5 it changes the other ones contacts.

  • Table Handling

    Hi, We specify the logical database. And we want a field that is not present in any of the tables defaulted in logical database. How can we want to add this additional field from a different table? Thanks, Ashish.