StrutsTags/JSP or... Another Nesting Newbie

I am having trouble teaching myself Struts taglib syntax/JSP coding and I am stuck on a classic nested object JSP/Struts syntax problem...
Can you explain the errors in the following snippet?
Background: The form associated with the jsp contains a property called "electronicDocDetails" which is an ArrayList of "DisplayFieldList" objects. DisplayFieldList objects have a list of "DisplayField" objects that have displayNames and values, etc..
The Jsp validation results in the error "Jsp Translate: The Attribute value has no value"
Also, I've tried writing this using only 'logic' and 'bean' tags instead of using nesting and I get the same error. (Yes, I've read two Struts books and the Apache Struts website documentation :-( ).
<BODY>
<html:form action="/CaseInquiryDetails">
<nested:iterate property="electronicDocDetails" >
     <TR align="center">
<TD align="center" colspan="4" class="MssTDFormLabel">
                    <bean:message key="label.caseinquirydetails.electronicdoc"/></TD>
     </TR>
          <nested:iterate property="fieldList" >
          <TR align="center">
               <TD align="left" class="MssTDFormLabel" colspan="1">
                    <nested:write property="displayName" />
               </TD>
               <nested:equal property="displayName" value="NAME" >
                    <TD align="left" class="MssTDFormLabel" colspan="3">
<%-- ERROR ON THE FOLLOWING LINE with the first '<bean:write>' --%>     
<%-- "Jsp Translate: The Attribute value has no value" --%>
<html:link href="<%=prefix%><bean:write property="value" />">
                    <bean:write property="value" />
</html:link>
                    </TD>
               </nested:equal>
               <nested:notEqual property="displayName" value="Name" >                                   
                    <TD align="left" class="MssTDFormResult" colspan="3">
                         <bean:write property="value" />
                    </TD>
               </nested:notEqual>
          </TR>
          </nested:iterate>
     </nested:iterate>
TIA...
jrh

The "nested" tags are for use in navigating bean hierarchies.
NOT for nesting tags.
ie you use them like this (pulling an example from the documentation: http://struts.apache.org/struts-doc-1.2.x/userGuide/struts-nested.html
//Instead of this:
<nested:write property="myNestedLevel.propertyOne" />
<nested:write property="myNestedLevel.propertyTwo" />
<nested:write property="myNestedLevel.propertyThree" />
//You can write this:
<nested:nest property="myNestedLevel" >
  <nested:write property="propertyOne" />
  <nested:write property="propertyTwo" />
  <nested:write property="propertyThree" />
</nested:nest >You should just be using the regular "logic" and "bean" tags
Your main problem is here:
<html:link href="<%=prefix%><bean:write property="value" />">
You can't nest custom tags as attributes to other custom tags.
You can only use expressions.
Try declaring a temp variable with that value like this:
<bean:define id="tempURL"><%=prefix%><bean:write property="value" /></bean:define>
<html:link href="<%= tempURL %>">
  <bean:write property="value" />
</html:link>

Similar Messages

  • Passing html object in a JSP to another JSP

    Below, I have a jsp page I want to pass the object name "BP" and all its values to a jsp in another jsp page. I can't use the session object can I? The html the jsp creates is within a form.
    I know the request.getParameter("BP") doesn't work because it must be a string.
    out.println("<form name=myform action='RevUpdate.jsp' method=post>");
    out.println("<PRE><Center><TABLE border = '5'>");
    for (int i=0; i < vBP.size(); i++)
    out.println("<TR><TD><font size='4'>" + ((Fetch_BP_RevLetter)vBP.elementAt(i)).getBP() + "</font></TD><TD><font size='4'><input type='text' size='3' maxlength='2' name='BP' value='" + ((Fetch_BP_RevLetter)vBP.elementAt(i)).getItemRev() + "'/></font></TD></TR>");
    out.println("</Center></Table>");
    out.println("<input type='submit' value='Save'><INPUT TYPE='Button' VALUE='Back' onClick='history.go(-1)'>");
    out.println("</Center>");
    out.println("</form>"); //END OF myform
    HttpSession sessionid = request.getSession(false);
    sessionid.invalidate();

    request.setAttribute()

  • Trouble looking up EJB from a JSP in another server

    I'm using the Sun Reference Implementation of J2EE. I'm deploying a session EJB in one J2EE app on one machine, and accessing it from a JSP in another J2EE app on another machine. My lookup code that is called from the JSP first sets the properties of the InitialContext as follows:
            Properties env = new Properties();
            env.put(Context.INITIAL_CONTEXT_FACTORY,
                    "com.sun.jndi.cosnaming.CNCtxFactory");
            env.put(Context.PROVIDER_URL, "iiop://afowlertest:1050");
            Context initial = new InitialContext(env);When I run both apps in the same server using this code, they work fine. However, when I run them in separate servers, the code throws the following exception (even if the JSP and EJB are deployed in the same server):
    javax.naming.NameNotFoundException.  Root exception is org.omg.CosNaming.NamingContextPackage.NotFound:
    IDL:omg.org/CosNaming/NamingContext/NotFound:1.0
            at org.omg.CosNaming.NamingContextPackage.NotFoundHelper.read(NotFoundHelper.java:72)
            at org.omg.CosNaming._NamingContextExtStub.resolve(_NamingContextExtStub.java:406)
            at com.sun.jndi.cosnaming.CNCtx.callResolve(CNCtx.java:440)
            at com.sun.jndi.cosnaming.CNCtx.lookup(CNCtx.java:492)
            at com.sun.jndi.cosnaming.CNCtx.lookup(CNCtx.java:470)
            at javax.naming.InitialContext.lookup(InitialContext.java:347)
            at com.sun.enterprise.naming.NamingManagerImpl.lookup(NamingManagerImpl.java:599)
            at com.sun.enterprise.naming.java.javaURLContext.lookup(javaURLContext.java:90)
            at microminer.client.SearchHandler.search(SearchHandler.java:127)
            at org.apache.jsp.test$jsp._jspService(test$jsp.java:79)
            at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
            . . .(My class is the microminer.client.SearchHandler in the stack above.)
    I've searched the forum for answers, but have not hit on anything yet. Any ideas? Thanks in advance!
    Abraham Fowler

    I'm going to answer my own question, because I kept searching the forums and eventually found the answer... maybe someone else in the same situation will find this answer here too. I got the answer from the following thread:
    http://forum.java.sun.com/thread.jsp?forum=13&thread=256151
    Basically, if you are doing a JNDI lookup with "java:comp/env" prefixed to the JNDI name, the app server will try to do a lookup within the current machine. If you leave that prefix off, it will look up using whatever properties you set in the InitialContext. At least, this is how I understood it from the thread I mentioned above.

  • Include a jsp in another

    I wanr to include a jsp into another, but dinamically. I have a file named Inicio.jsp. This file has a link that calls the servlet "ServletMenu". This servlet decides which jsp page to load. But I want to load "inside" the Inicio.jsp.
    Here a send some code
    Inicio.jsp: shows a menu
    <tr>
    <td>Menu 1</td>
    </tr>
    ServletMenu
    public void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
    response.setContentType(CONTENT_TYPE);
    String operacion = (String)request.getParameter("operacion");
    if(operacion.equalsIgnoreCase("menu1")) {
    RequestDispatcher dispatcher = this.getServletContext().getRequestDispatcher("/WebModulo1/Menu1");
    dispatcher.forward(request, response);
    Menu1 contains a form
    The page given by the servlet should show everything that is shown in Inicio.jsp and in the middle of the page should be the content of the Menu1.jsp.
    Am I clear? The idea is mantain a fix menu and load only dynamic content in the middle of the page.
    hope you can help

    I have the code working but ServletMenu only loads the Menu1.jsp and that is not what I want.
    I' m developing an Intranet site. Depending on the user that is logged, the menu that is shown, because not all users have access to all the system tasks.
    I thought of having the pages containing the menu shown to the user done statically and in the middle of that statical page load the content of a dynamic page.
    For example, suppose I have in the server the pages Inicio.jsp, that shows the menu, and Menu1.jsp that shows the same things that Inicio.jsp (but the link to menu1should not exit) and whatever is loaded when the user clicks in the link menu1 of the Inicio.jsp page. The "whatever is loadded" will be another .jsp page, that should be inside Menu1.jsp.
    Hope I'm clearer this time
    Thanks

  • Linking one JSP to another

    How do you create a link going from one JSP to another?
    I would like to know how to go by clicking on a link on the first page which when clicked will take you to the second.
    I would also like to know how to go to the next page if a certain condition is met.
    Thank you in advance.

    Sorry I was not that clear before.
    I would like to know how to open another JSP page if a
    button I have setup is pressed in my first JSP page.
    Thank you.
    <SCRIPT>
    f()
       document.myForm.submit() ;
    </SCRIPT>
    <FORM ACTION="secondPage.jsp" METHOD="POST" NAME="myForm">
    <INPUT TYPE="button" VALUE="Close Window"   onClick="f()">
    </FORM>

  • Can I have a JSP  inside another JSP??

    if so,
    say, I have a JSP inside another JSP then,
    how many servlets r generated by the JSP engine??

    Yes U can have JSP inside another JSP, ofcourse using jsp:include and in that case two servlets will be generated. Thats what i feel that happens.

  • HOW TO MOVE FROM ONE JSP TO ANOTHER BY HIDING URL CHANGES

    HOW TO MOVE FROM ONE JSP TO ANOTHER BY HIDING URL CHANGES IN AN ADDRESS BAR

    Please check before posting that you have not accidentally turned on the CAPS LOCK feature of your keyboard.
    To answer your question. You can't do that. There are alterate ways to solve this sort of problem. What exactly is the nature of the problem you are seeking to solve?

  • Passing variable from one JSP to another

    Hi....
    I am working on customizing Oracle Application(istore).
    I need to pass variable from 1 JSP to another.
    JSP 1 contains the following line of code:
    <INPUT type="HIDDEN" name="soldtoCustPartyName" value="<%=soldtoCustPartyName%>">
    How can I pass this to another JSP Page. The other JSP should take the 'soldtoCustPartyName' and find out the primary address country.
    So please help me in getting variable passed from 1st JSP to next.
    By default, 1st JSP is not fwded to 2nd JSP.
    This is very very urgent...Please help.....

    When you push the submit button on jsp1 - it goes to jsp2?
    ie
    // in jsp1.jsp
    <form action="jsp2.jsp">
    <INPUT type="HIDDEN" name="soldtoCustPartyName" value="<%=soldtoCustPartyName%>">
    <input type="submit">
    </form>
    //Then in jsp2.jsp all you need is
    request.getParameter("soldtoCustPartyName");This will pick up the value that is coming from the hidden field on jsp1

  • Passing value from one jsp to another?

    how to pass value from one jsp to another? i have a value assigned in the link, i want to pass that value to another jsp page?
    please help with code?

    Instead of the value being passed, i am getting a null value.
    Here is my calendar code:
    <%@page import="java.util.*,java.text.*" %>
    <html>
    <head>
    <title>Print a month page.</title>
    </head>
    <body bgcolor="white">
    <%
                  boolean yyok = false;
                  int yy = 0, mm = 0;
                  String yyString = request.getParameter("year");
                  if (yyString != null && yyString.length() > 0)
                      try
                          yy = Integer.parseInt(yyString);
                                  yyok = true;
                       catch (NumberFormatException e)
                          out.println("Year " + yyString + " invalid" );
                  Calendar c = Calendar.getInstance( );
                  if (!yyok)yy = c.get(Calendar.YEAR);  
                         mm = c.get(Calendar.MONTH);
    %>
                  <table align="center">
                      <tr>
                  <td>
                       <form method=post action="calendar.jsp">
                          Enter Year : <select name="year">
    <%         
                 for(int i= yy;i<=2010;i++)
    %>
                  <OPTION VALUE= <%=i%> > <%=i%> </option>
    <%       
    %>
              </select>
                      <input type=submit value="Display">
                      </form>
                      </td>
                    </tr>
    <tr>
                     <table>
    <%!
    String[] months = {"January","February","March",
                    "April","May","June",
                    "July","August","September",
                    "October","November", "December"
    int dom[] =     {
                        31, 28, 31, 30,
                        31, 30, 31, 31,
                        30, 31, 30, 31
    %>
    <%
                int leadGap =0;
    %>
    <div id="t1" class="tip"><table border="4" cellpadding=3 cellspacing="3" width="250" align="center" bgcolor="lavender">
    <tr>
    <td halign="centre" colgroup span="7" style="color:#FF0000;">
    </colgroup>
    <tr>
    <td>
    <%
              GregorianCalendar calendar =null;
              for(int j=0;j<12;j++)
                        calendar = new GregorianCalendar(yy, j, 1);
                  int row = 1 ;
                  row = row + j;
        %>
              <table>
                <tr>
              <colgroup span="7" style="color:#FF0000;">
              </colgroup>
                </tr>
              <tr align="center">
              <th colspan=7>
                  <%= months[j] %>
                  <%= yy %>
              </th>
              </tr>
    <tr>
    <td>Sun</td><td>Mon</td><td>Tue</td><td>Wed</td><td>Thu</td><td>Fri</td><td>Sat</td>
    </tr>
    <%
        leadGap = calendar.get(Calendar.DAY_OF_WEEK)-1;
        int daysInMonth = dom[j];
        if ( calendar.isLeapYear( calendar.get(Calendar.YEAR) ) && j == 1)
        ++daysInMonth;
        out.print("<tr>");
        out.print(" ");
          for (int h = 0; h < leadGap; h++)
           out.print("<td>");
          out.print("</td>");
        for (int h = 1; h <= daysInMonth; h++)
          out.print("<td>");
          out.print("<a href=desc.jsp>" + h + "</a>" );
          out.print("</td>");
        if ((leadGap + h) % 7 == 0)
            out.println("</tr>");
    out.println("</tr></table></div>");
    if( row%3 != 0)
    out.println("</td><td>");
    else
    out.println("</td></tr>\n<tr><td>");
    %>
    </html>I need to pass the value in 'h' to the desc.jsp page.
    my code for desc.jsp is :
    <html>
    <head>
    </head>
    <body bgcolor="lightblue">
    <form method=post action="Calenda.jsp">
    <br>
    <%= request.getParameter("h") %>
    <h2> Description of the event <INPUT NAME="description" TYPE=TEXT SIZE=20> </h2>
    <BR> <INPUT TYPE=SUBMIT VALUE="submit">
    </form>
    </body>
    </html>But i am not able to pass the value. The 'h' value contains all the date. i want to pass only a single date, the user clicks to the other page. please help

  • Passing variables from one jsp to another

    Hi All,
    I've searched thru the forum and can't find an answer to a prob I'm having, trying to pass a variable from one jsp to another.
    in file searchBar.jsp i have
    <%
    String archiveSearch = "off";
    %>
    and
    <%
    if (userUtils != null && userUtils.getSearch().equals("on"))
    %>
    <a href="/webLayout/webSideBar.jsp?searchState=<%=archiveSearch%>onclick="archiveSearch = "on""></a>
    and in file webSideBar.jsp
    <%
    String searchState = "off";
    String archiveSearch = (String)request.getParameter("searchState");
    %>
    basically it will give me a variable archiveSearch set to on in webSideBar when the user clicks on the search button, but as it is it's not passing the variable from the searchBar.jsp to the webSideBar.jsp and I think it looks ok !!!! but it's not
    Help

    Looks good to me as well.
    Couple of suggestions
    1 - view source on searchbar.jsp - see what the generated source code for that link is
    2 - Look at the url used to generate webSideBar.jsp. If its not in the address bar, right click the webSideBar page and choose properties.
    Check to see what parameter was passed.
    Are these pages in a frameset? Do you have to specify a target frame for your link?

  • How to pass information from one JSP to another JSP? help please

    hi there
    my question is how to pass some information such from one JSP to another one. for exmple, on one page there is a form, and i need to pass some values from the form to another jsp, or some values that were calculated on one JSP and need to be passed to another one. thanks

    You can do this in several ways...here is a simple one...
    When you call the second page url, use this
    http://www.mysite.com?myVariableFromPageOne="hello"
    on the second page use this:
    String firstPageVariable = request.getParameter("myVariableFromPageOne");
    Thanks

  • Include a JSP inside another JSP

    Hi SDN,
    I am stuck with a problem. There is a JSP file available. In this JSP I have to add some more fields. But when I try to ad new fields I am getting a Portal Runtime Error stating that "Code Too Large". So now I thought of putting the new code in another JSP and include that JSP inside my main JSP. Here I cannot use <@include file="..."> because this finally compiles both the JSPs as one.
    So I tried to use <JSP:include>. Some one please help me with how to include a JSP inside another using <JSP:include>. Here both the JSPs are having HBJ content inside.
    I know that <jsp:include page="relPathOfChild.jsp"/> will include the child.jsp into my main jsp. Problem is both the JSPs are having HBJ content, so If I dont declare <hbj:content> tag inside the child jsp, it is throwing an error. But If I declare a <hbj:content> tag inside my child jsp, only child content is coming and main jsp content is not coming.
    Please help me..
    Regards,
    SrinivaS

    Hi,
    This Problem is solved. Now I am able to include a child JSP inside the parent JSP. But now the problem is,
    This Parent JSP will have 8 tabs. Now my chils JSP should come inside 7th tab.  but it is coming above the parent JSP.
    Below is how I am including my child JSP.
    <% try{ if(isCAR){
         %>
                   <tr>
    <jsp:include page="/pagelet/CAREligibility.txt" />
                   </tr>
                <%} } catch(Exception e) {}%>
    Please help.
    Regards,
    SrinivaS

  • How can I get the value for static content of 1 jsp into another jsp

    Hi, I have a jsp which have a header ,now i want this header value in another jsp dynamically.Can u tell me how I can do it?

    What I want to know is that , is it possible to get the value of a static content of one jsp into another jsp,something like getParameter() method that we use to get the value of a field in the jsp to a servlet,or to another jsp,the only difference here is I do not have a field here but a static jsp content .

  • How to forward from a jsp  to another jsp on another server

    I am facing issue in forwarding to a jsp residing in another server. While using response.redirect(url), the response is send back to the browser and then redirected(which is not expected as it would create problem in production). i am facing issue while using the <jsp: forward> tag and forward() as they seem to be taking relative URL. Please help me with this issue.

    probably, you could use <c:redirect url=""/> tag to request to jsp on another server and pass ur parameters as 'GET' so that u can get all your respective params values. Other way (or crude) way is to do a scoket or HttpConnection to post your all datas via 'POST' and expect respective values on the server side.

  • How to carry an object from one JSP to another JSP?

    How can I carry an object from one JSP to another JSP?
    I have a servlet where I am setting an object in request as an attribute and then forwarding to PageA.jsp.
    MyDTO myDTO = new MyDTO();
    request.setAttribute("MyDTO", myDTO);
    RequestDispatcher rd = getServletContext().getRequestDispatcher("/PageA.jsp");
    rd.forward(request, response);
    I can get MyDTO object in PageA.jsp:
    MyDTO myDTO = (MyDTO) request.getAttribute("MyDTO");
    Now PageA.jsp has a form named form_pageA which submits to PageB.jsp. How can I make sure that myDTO object is available in PageB.jsp? I would like to not store it in session.
    Edited by: srhcan on May 4, 2012 7:52 PM

    srhcan wrote:
    but its not a text I want to store; instead its a JavaBean object. Thats why I cannot use a hidden text type input field.No, but perhaps you could stick something in there which you can use to reconstruct your DTO object on the next request?

Maybe you are looking for