Struts html:link

hi all,
I am new to struts, but experienced with jsp and serlets.
I am facing a difficulty using <html:link..............
what i need is that, i should be able to transfer current page status and data like link clicked to action class which can analyze the page data and make decision there. this will allow me to have same url for multiple purposes, i can do this using <form action="" but similar feature is required in <html:link
I am really stuck. Need urgent Help.
Helping me understand the <html:link name="" action="" forward="" may also help
Thanks in advance....
Edited by: ksinha on Aug 16, 2010 11:21 PM

Either that or possibly create a filter in the second app that catches it and forwards it where you want it.

Similar Messages

  • How to use pdk-struts-html:link

    i have a portlet,
         <pdk-html:link href="/StartEhrpHrj.do?targetGroup=Hrj1030MInfDtlGroup">
                   xyz
    </pdk-html:link> </td>
    but no link,why

    Hi,
    It is not an issue with the tag. Look at the docs for the struts html:link tag; the pdk-html:link tag is intended to replace this tag and not the regular HTML anchor tag.
    Good luck,
    Hernando
    hjbconsulting at comcast dot net

  • Struts - HTML:link tag with dynamic page attribute?

    I am trying to use the html:link but the page value is dynamic (resulting from the bean within the iterate tag). The code below doesn't work - error. Is there a way to use all Struts tags and make this happen. Any ideas?
            <logic:iterate id="myMenuForm" property="menuItem" scope="session" name="menuForm" >          <html:link page="<bean:write name="myMenuForm" property="menuDisplayName"/>">                  <bean:write name="myMenuForm" property="menuDisplayName"/>          </html:link>        </logic:iterate> Thanks,
    mlv

    Thanks for all your help. Based on all you your comments, it is now working
    and I thought I would provide some details about how I got it working.
    There are not that many examples within the Struts documentation.
    id = unique name for the object that can be referenced within the iterate
    tag.
    name = is the Bean, in this case it's the ActionForm, that contains the List
    object that will be iterated. In my case, I have a ActionForm that contains
    a List property that contains all the menu item rows from the databse.
    property = is the property name within the ActionForm that is the List
    object. Links to the getter method
    Within the <bean:write> tag you use the id name to get a handle on the final
    object from the iterate tag and the property is one of the property values
    within the bean that is contained within the List.
    So in this case I have a ActionForm bean that contains a List property that
    contains a collection of beans.
    FormAction - bean
    property menuItems of type List contains:
    - row 1 = bean (with a property of menuDisplayName)
    - row 2 = bean (with a property of menuDisplayName)
    - row 3 = bean (with a property of menuDisplayName)
    Here's the JSP code for the tag.
            <logic:iterate id="myMenuForm" name="menuForm" property="menuItem" >
              <html:link page="www.yahoo.com"/>
                      <bean:write name="myMenuForm" property="menuDisplayName"/>
              </html:link>
            </logic:iterate>Now I would like to make the <html:link> page attribute value dynamic from
    the iterate bean. Therefore, you can make the url for the link dynamic If
    you know how to do that, please feel free to provide some help.

  • Struts tag html:link doesn´t work in Safari

    *Very important question for our company!*
    I´m trying to optimize our web application( www.seb.de) for Safari browser.
    The problem is that Safari don´t display Struts <html:link> on the page. On the page should be a button "delete" at the right side.
    Button Code:
    <html:link>
    href="DeleteMail"
    newFlow="true"
    styleClass="a_delete"
    bundle="<%=SebMailBoxConstants.BUNDLESEBMAIL%>"
    titleKey="Delete"
    </html:link>
    There is a styleClass "a_delete", which this button uses:
    a.a_delete
    background-image: url('icon/icon_delete.gif');
    background-repeat: no-repeat;
    width: 12px;
    padding-right: 12px;
    margin-top: 2px
    Please help me to solve this problem.
    Best regards,
    Sergei.
    SEB Group.

    same thing here, I've talked to apple twice and no resolution
    if you move the screen up you can usually get the links to work
    also when I do Google searches I can get to the second page of results and then I can go no further

  • How to use the html:link with a arraylist

    Hi everyone:
    I want to display the data using struts html:link.
    I query the database and place all the data to javabean,later place all the javabean to ArrayList.In Action,I use the "request.setAttribute("lovetable",articlelist) to set request to jsp page.
    I want to pass a parameter "id" use the hyperlink so I can get the parameter when I click the hyperlink.
    But how to use html:link to display it?
    I use <html:link action="viewtopic.do" paramId="id" paramName="lovetable" paramProperty="id"/>,it can't work and Tomcat report error :
    org.apache.jasper.JasperException: No getter method for property id of bean lovetable
         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:248)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
    The lovetable is a ArrayList and it don't have a getter or setter method.
    How to use it pass parameter? :( Thks

    Thank you.
    I use the bean:define successful.And display all the data to jsp.My jsp code is:
    <logic:iterate id="love" name="lovetable">
    <bean:define id="idbean" name="love"/>
    <tr bgcolor="<%=color%>">
    <td><bean:write name="love" property="id"/></td>
    <td><html:link forward="viewtopic" paramId="id" paramName="idbean" paramProperty="id"><bean:write name="love" property="title"/></html:link></td>
    <td><bean:write name="love" property="name"/></td>
    <td><bean:write name="love" property="time"/></td>
    </tr>
    </logic:iterate>
    In Action : request.setAttribute("lovetable",articlelist)
    ResutlSet rs=.............
    List articlelist=new ArrayList();
    while(rs.next()){
    articlebean bean=new articlebean();
    bean.setName(rs.getString("name"));
    bean.setTitle(rs.getString("title"));
    articlelist.add(bean);
    The above code will work property.
    The Tag "html:link" need bean to work other than arraylist so I iterate all the bean out.
    The Tag "logic:iterate" need collection to work so I make Action return a List.
    right?
    Any idea? :)

  • Shed graphics and html link bug

    When I link my shed graphics to html links the links do not
    stay, but instead changes to a macro. I was able to do this in my
    last compile but that was in RoboHelp 6.
    Alycia

    Thanks, I tried it you way and it looks like I am getting the same thing. Here is my version of your code:
    <jsp:useBean id="linkParams" class="java.util.HashMap"/>
    <c:set target="${linkParams}" property="userId" value="${user.userId}"/>
    <c:set target="${linkParams}" property="firstName" value="${user.firstName}"/>
    <c:set target="${linkParams}" property="lastName" value="${user.lastName}"/>
    <pdk-struts-html:link action="/showUser.do" name="linkParams">
    <font class="UnSelectedTabText"><bean:write name="user" property="email"/></font>
    </pdk-struts-html:link>
    Which returns this link, again with the repeated values:
    https://hostname/portal/page?_pageid=53,36325,53_36329&_dad=portal&_schema=PORTAL&_piref53_36355_53_36325_36329.strutsAction=%2FshowUser.do%3FuserId%3Dmsidoti%26amp%3BfirstName%3DMichael%26amp%3BlastName%3DSidoti&userId=msidoti&firstName=Michael&lastName=Sidoti
    Anyone else have any idea? Its looking like a bug in the PDK to me.

  • Html:link not working in struts project driving me mad, please help...

    Afternoon all,
    Can anyone help me with an issue I'm having with my first struts project, I'm learning as I go.
    Anyway, I'm trying to create a bog standard hypertext link which passes a value back to a specified struts action. The flow of the application
    is as follows:
    1) search.jsp
    User enters a name and postcode to search on, then click submit
    2) searchAction
    Struts action 'search' is called and does the search in a back-end db.
    Each result found from search is created as a javabean (named resultsBean), and added to a list object. The list object is set as a request
    attribute named 'SearchResults'.
    The action is then forwarded on to another jsp page named results.jsp
    3) results.jsp
    The results.jsp page retrieves the list object from the 'SearchResults' attribute and loops through each entry
    in the list and converts each entry to the 'resultsBean' javabean object.
    Each resultsBean object has a getVirtualID method which stores a string value. This value is retrieved and a hypertext link is created which
    passes this value on to another struts action named 'select'.
    When this link is clicked on, the select struts action is called and the value passed as a parameter is retrieved.
    This is the part I can't get to work, I can't get the link to render properly. When I click the link the select action retrieves
    & lt;%= resultsBean.getVirtualID() & gt; as the value of the parameter 'vid' instead of the value stored in the getVirtualID method of the resultsBean.
    Listed below is the code from my results.jsp page. If anyone can help me get this to work I would be very grateful.
    Thanks in advance,
    Alex
    results.jsp code
    <%
       List searchResults = (List)portletRequest.getPortletSession().getAttribute("SearchResults");
    %>
    <div id="table_layout" style="width: 713px; margin: 0px 0px 0px 3px;">
      <div id="row">
        <div id="column"><img src='<%= response.encodeURL("/images/results.gif") %>' alt="" width="223" height="159" border="0" /></div>
         <div id="column" style="width: 30px;"></div>
         <div id="column">
          <div id="table_layout" style="width: 460px;">
            <div id="row" style="width: 430px; border-bottom: 1px solid #4e137d;">
              <div id="column" style="width: 155px;">Name</div>
              <div id="column" style="width: 10px;"> </div>
              <div id="column" style="width: 130px;">Address</div>
              <div id="column" style="width: 10px;"> </div>
              <div id="column" align="right" style="width: 120px;">References</div>
            </div>
    <% if (searchResults.size() > 0) {
           Iterator it = searchResults.subList(0, searchResults.size()).iterator();
           ResultsBean resultsBean = new ResultsBean();
           while (it.hasNext()) {
                resultsBean = (ResultsBean)it.next(); %>
            <div id="row" style="padding: 5px 0px 10px 0px;">
              <div id="column" style="width: 155px;"><html:link styleClass="results"  page="/select.do?vid='<%= resultsBean.getVirtualId() %>'" title="<%= resultsBean.getFullName() %>"><%= resultsBean.getFullName() %></html:link></div>
              <div id="column" style="width: 10px;"></div>
              <div id="column" style="width: 130px;"><%= resultsBean.getFullAddress() %></div>
              <div id="column" style="width: 10px;"></div>
              <div id="column" align="right" style="width: 120px;"><%= resultsBean.getReferenceIcons(portletResponse) %></div>
              <div id="column" style="width: 13px;"></div>
              <div id="column" style="width: 22px;"><input id="<%= resultsBean.getVirtualId() %>" name="ckbox" type="checkbox" value="" title="tick to select for merging" style="border: 0px solid #ffffff;"></div>
            </div>
    <%     }
       } %>
           </div>
         </div>
      </div>
    </div>
    <br />
    <br />
    <html:link forward="/searchpage">Return to search page</html:link>

    If you have part of an attribute dynamic, you need to make the entire attribute an expression.
    ie instead of
    page="/select.do?vid='<%= resultsBean.getVirtualId() %>'"
    it has to be
    page="<%= "/select.do?vid=" + resultsBean.getVirtualID() %>"
    However for my approach, I would aim for zero scriptlets, and use the struts tags even more. For instance instead of an iterator, use the struts logic:iterate tag (or the JSTL c:forEach>
    Also instead of div tags, I would use html table tags - <table> <tr><td> etc etc. Thats what its for right?
    Here is at least some of it rewritten with struts tags.
    I left out the div tags so I could focus on the "important" stuff.
    <logic:iterate id="resultsBean" name="SearchResults">
      <html:link styleClass="results"  page="/select.do" paramId="vid" paramName = "resultsBean" paramProperty="virtualId">
        <bean:write name="resultsBean" property="fullName"/>
      </html:link>
      <bean:write name="resultsBean" property="fullAddress"/>
    <%= resultsBean.getReferenceIcons(portletResponse) %>
    <input id="<%= resultsBean.getVirtualId() %>" name="ckbox" type="checkbox" value="" title="tick to select for merging" style="border: 0px solid #ffffff;">
    </logic:iterate>I'm not entirely certain what you are doing with that checkbox at the end. They all have the same name, but no value. You couldn't identify at the server end which one was clicked.
    Hope this helps some,
    evnafets

  • Passing values to action form in struts using html:link tag in struts

    hi
    As we can post values to action form bean in struts using a <html:text> tag in side a form.
    Can the same be achieved by using a html:link attribute.
    If not then how can this be achieved (i.e. posting a form on click of a link and populating action form bean property for the same).
    thanx in advance.

    Crosspost:
    http://forum.java.sun.com/thread.jspa?threadID=5244035&tstart=0

  • html:link .... Struts

    I want a Link as action
    MyJsp.jsp
    <html:link action="/MyAction?myParam=true">MyText</html:link>
    MyAction.java
    in der Methode execute (...........)
    String Str = request.getParameter("MyParam");
    the pProblem I becom the Str null whay ????
    thanks

    You can't map the action directly to an Action class.
    You have to map it via the struts-config.xml with an action like:
    <action path="/myAction" type="MyAction"/>
    And call this action from the jsp by f.ex.
    <% pageContext.setAttribute("MyParam", "Hello"); %>  <!--just adding a parameter -->
    <html:link action="/myAction" name="MyParam"/>The name attribute specifies the query string parameter(s).
    You should be able to access the parameter now in MyAction with your original execute method.

  • html:link problem in struts

    <a href="photo.jsp?cmd=showa&Id=<%=Id)  %> target="thumbs">This is normal coding in jsp. how to use the same coding in struts using <html:link>
    Please Help me.
    Thanks in Advance
    regards
    pooja</a>

    Have a look at this.
    http://struts.apache.org/struts-action/struts-el/tagreference.html#link

  • Problem in html:link tag in struts

    hi every body i have a problem i have to pass two dynamic variable to next page using html:link tag how can i send it
    for example
    <a href = "editEmp.jsp?id=<%= empSno %>&&delete=no"> Edit </a>
    should be coverted into <html:link >and i want to pass 2 parameters to next page how can i do can anybody help

    i have used forward only but how to passs variable dynamically in forward for eaxmpleeee
    i am retreving records from database
    emdID name desig
    1 suresh PM edit
    2 ram PL edit
    when user clecks on link of edit of suresh then i should pass controll to edit page with his empID an parameter............
    i have done this prevoiusly by href tag like
    while (rst.next()) { %>
                        <tr>
                             <% empSno = rst.getInt ("ID");%>
                             <td align = "left"><%= empSno %></td>
                             <td align = "left"><%= rst.getString ("empno") %></td>
                             <td align = "left"><%= rst.getString ("empname") %></td>
                             <td align = "left"><%= rst.getString ("desig") %></td>
                             <td><a href = "strutsEx/ch05/editEmp.jsp?id=<%= empSno %>&&delete=no"> Edit </a>&nbsp&nbsp&nbsp&nbsp<a href = "editEmp.jsp?id=<%= empSno %>&&delete=yes"> Delete </a>
                             </td>
                        </tr>
    now i want to use html:link action in place of HREF can u help me plzzzzzzzzzz

  • How to pass request parameters using html:link in struts

    Hi All,
    I am trying to send parameters to action class using <html:link>.
    Can anybody give sample code how to do it?
    Thanks in advance.
    By
    K.Siva Prasad Reddy

    hi,
    you can pass the parameters in link like this
    http://www.xyz.com&username=someuserID&password=somePassword
    username and password are parameters which you want to pass as paramets to server..hope this will work for you...
    Thanks
    Surya

  • Having problems passing more than one parameter with html:link tag

    Hi guys,
    for my web application I�m using Struts. I�ve got a database with user details. I would like to get users list and link to the details of each user. I wrote the code and everything is working fine only the users list is repeating as many times as users in the list.
    For ex: I have in the database User1, User2 and User3. I would like to have a result like:
    User1
    User2
    User3
    Instead of it I have the result like:
    User1
    User2
    User3
    User1
    User2
    User3
    User1
    User2
    User3
    What I�m doing wrong? Could somebody help me please?
    Thank you in advance
    There is a snippet of the code, which I�m using in jsp:
    <code>
    <logic:iterate id="root" name="user">               
                   <%
                        java.util.HashMap users = new java.util.HashMap();
                        params.put("user",root);
                        pageContext.setAttribute("usersName", users);
                   %>
                   <html:link name=" usersName " scope="page" page="/name.do">
                        <logic:iterate id="folder" name="user">
                             <bean:write name="folder" /><br>
                        </logic:iterate>
                   </html:link><br>
                   </logic:iterate>
    </code>

    Suggestion: next time you post code use the "CODE" button to put code tags around it. It formats much nicer that way :-)
    You have a nested loop structure here.
    <logic:iterate id="root" name="user">
      <%
        java.util.HashMap users = new java.util.HashMap();
        params.put("user",root);
        pageContext.setAttribute("usersName", users);
      %>
      <html:link name=" usersName " scope="page" page="/name.do">
        <logic:iterate id="folder" name="user">
          <bean:write name="folder" /><br>
        </logic:iterate>
      </html:link><br>
    </logic:iterate>Both loops iterate over your "user".
    Your first loop loops over each user.
    Then your second loop also loops over each user - hence you get number of users * number of users = 3 groups of 3.
    If you have 4 users, you would have 4 groups of 4.
    I only see you setting one parameter: "usersName" What other parameters do you need to pass?
    At a guess, the inner loop is unnecessary, and you want to write the users name as the text for the link, and also use it as a link parameter.
    <logic:iterate id="root" name="user">
      <%
        java.util.HashMap users = new java.util.HashMap();
        params.put("user",root);
        pageContext.setAttribute("usersName", users);
      %>
      <html:link name="usersName" scope="page" page="/name.do">
          <bean:write name="user" /><br>
      </html:link><br>
    </logic:iterate>

  • It is question on portlet pdk struts tags link

    hi:
    <td>
    <jsp:useBean id="rowEditSet" class="java.util.HashMap"/>
    <c:set target="${rowEditSet}" property="event" value="setCurrentRowWithKey"/>
    <c:set target="${rowEditSet}" property="Arg0" value="${Row.rowKeyStr}"/>
    <pdk-html:link action="/browseCustomers.do" name="rowEditSet">Select
    </pdk-html:link>
    result:
    Select
    dont use

    The problem was an old copy of the struts.jar file, which was missing the calculateUrl() method called by the Oracle tag. With a new struts.jar file, all was good.

  • Html:link and javascript

    Maybe I'm asking the wrong question, how do you execute JavaScript within a <html:link> tag in Struts. I simply want to execute a collapse / expand divs with an onclick attribute in the <html:link> tag.
    Can this be done with some other tag?
    TC

    and why didnt u try putting the onlick tag ?
    <html:link href=# onClick="myJSfunction()">Rohit</html:link>
    -Rohit

Maybe you are looking for