Results 1 to 2 of 2
  1. #1
    fabbero is offline Member
    Join Date
    Jul 2011
    Posts
    4
    Rep Power
    0

    Default Struts: How to display a grid in Struts??

    Hi again!
    i',m having some problem to display a simple grid in struts,because i can't use java code on the jsp


    this is my struts config:

    <form-bean name="CreaAreaForm" type="it.tbr.form.CreaAreaForm"/>

    <action path="/creaArea"
    type="it.tbr.action.CreaAreaAction"
    name="CreaAreaForm"
    scope="session"
    validate="true"
    input="/area.jsp">
    <forward name="success" path="/area.jsp"/>
    </action>

    ------------------

    this is my jsp:(is just a part,only to suggest you how i'm working)

    <html:form action="/creaArea" method="post">

    <td><html:text name="CreaAreaForm" property="width" /><html:errors property="width" />

    <td><html:text name="CreaAreaForm" property="height" /><html:errors property="height"/> </td>
    <input type="submit" name="search" class="art-button" value="Creazione "/>


    In my CreaGridForm i have

    private int height;
    private int width;


    with all get and set

    and my CreaGridAction

    public ActionForward execute(ActionMapping mapping, ActionForm form,
    HttpServletRequest request, HttpServletResponse response)
    throws Exception
    {

    CreaAreaForm caf=(CreaAreaForm)form;
    for(int y=0; y<caf.getWidth(); y++){
    for(int x=0; x<caf.getHeight(); x++){

    session.setAttribute("x", x);
    session.setAttribute("y", y);
    caf.setHeight((Integer) session.getAttribute("y"));
    caf.setWidth((Integer) session.getAttribute("x"));

    but now my problem.. i don't know how to view the grid on my jsp ,because
    with <bean:write name="CreaAreaForm" property="height" /> and
    <bean:write name="CreaAreaForm" property="width" />

    i saw only the number that i submit.
    So if in my jsp i submit
    h: 2
    w:2

    i need to view 4 cells

    Hope you've understood me and that someone can help me^^"
    Last edited by fabbero; 07-13-2011 at 04:48 PM.

  2. #2
    Petr's Avatar
    Petr is offline Senior Member
    Join Date
    Jan 2011
    Location
    Russia
    Posts
    620
    Rep Power
    4

    Default

    Just use html. Struts has not special widgets for build user interface.
    Skype: petrarsentev
    http://TrackStudio.com

Similar Threads

  1. Struts 2 paging problem using display tag...?
    By prabhurangan in forum Web Frameworks
    Replies: 1
    Last Post: 01-15-2014, 09:00 AM
  2. decorator.jsp problem building Struts Menu in JSP when Struts action is used
    By dkirvan in forum JavaServer Pages (JSP) and JSTL
    Replies: 3
    Last Post: 04-29-2010, 05:33 AM
  3. how to display a jsp by struts.xml
    By kirtichopra2003 in forum Advanced Java
    Replies: 1
    Last Post: 09-14-2009, 10:29 AM
  4. foreach in jstl to display nested colums-struts jsp
    By adil7 in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 02-11-2008, 06:19 AM
  5. how to display image in jsp page(Struts)
    By rama6262 in forum Advanced Java
    Replies: 1
    Last Post: 12-21-2007, 07:50 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •