Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.gui > #2104 > unrolled thread

Using Struts tag libs

Started by"Oleg Konovalov" <oleg.konovalov@THRWHITE.remove-dii-this>
First post2011-04-27 15:37 +0000
Last post2011-04-27 15:37 +0000
Articles 6 — 4 participants

Back to article view | Back to comp.lang.java.gui


Contents

  Using Struts tag libs "Oleg Konovalov" <oleg.konovalov@THRWHITE.remove-dii-this> - 2011-04-27 15:37 +0000
    Re: Using Struts tag libs "David Mark" <david.mark@THRWHITE.remove-dii-this> - 2011-04-27 15:37 +0000
      Re: Using Struts tag libs "Lew" <lew@THRWHITE.remove-dii-this> - 2011-04-27 15:37 +0000
        Re: Using Struts tag libs "Richard Cornford" <richard.cornford@THRWHITE.remove-dii-this> - 2011-04-27 15:37 +0000
    Re: Using Struts tag libs "Lew" <lew@THRWHITE.remove-dii-this> - 2011-04-27 15:37 +0000
      Re: Using Struts tag libs "Oleg Konovalov" <oleg.konovalov@THRWHITE.remove-dii-this> - 2011-04-27 15:37 +0000

#2104 — Using Struts tag libs

From"Oleg Konovalov" <oleg.konovalov@THRWHITE.remove-dii-this>
Date2011-04-27 15:37 +0000
SubjectUsing Struts tag libs
Message-ID<Wseoi.225$7V6.44@trnddc03>
  To: comp.lang.java.gui,comp.l
Hi,

I am relatively new to Struts [using 1.3].

I need to create a form using Struts tag libs with 2 HTML select's [lists],
connected to 2 DB tables, say allUsers and Admins, which would allow
to select Administrators from the list of AllUsers.

So I will have 3 buttons: Add, Remove and Update.
Add - to add selected item(s) from AllUsers list to Admins list [if it is 
not there already];
Remove- to delete selected item(s) from Admins list;
Update - to save changes to Admins list to the Admins DB table.

So roughly my JSP will looks something like that:

<%@ page import="java.util.Collection" %>

<html:form property="manageAdmins" action="/manageAdmins">

<table>
    <tr>
     <td>&nbsp;&nbsp;</td>
     <td>All Users:</td>
     <td>&nbsp;&nbsp;</td>
     <td>&nbsp;&nbsp;</td>
     <td>&nbsp;&nbsp;</td>
     <td>Administrators:</td>
    </tr>
    <tr>
     <td>&nbsp;</td>

     <td>
          <html:select size="8" property="allUsers" multiple="true" 
styleId="allUsersID">
              <html:options collection="AllUsersList" property="AllUsersId" 
labelProperty="allUsers"/>
          </html:select>
     </td>
      <td>&nbsp;</td>
     <td>
      <table>
       <tr><img src="/images/btn_add.gif" alt="Add" name="add"  border="0" 
id="add" onClick="?">
       </tr>
       <tr><img src="/images/btn_remove.gif" alt="Remove" name="remove" 
id="remove" onClick="?">
       </tr>
       <tr><img src="/images/btn_update.gif" alt="Update" name="update" 
id="update" onClick="?">
       </tr>
      </table>
     </td>
     <td>&nbsp;</td>
     <td>
      <html:select size="8" property="admins" multiple="true" 
styleId="adminsID" onchange="getAdmins();">
              <html:options collection="AdminsList" property="AdminID" 
labelProperty="admins"/>
          </html:select>
     </td>
    </tr>
    <tr>
    </tr>
</table>
</html:form>

So how do I manipulate these <html:options collection=AdminList...> Struts 
tags
in order to implement Add, Remove, Update  ?      In onClick="..." ?
Is it in JavaScript or in Java ?
Any other useful Struts tags for that [especially to do DB synchronization]?
Code snippets ?

Sorry for the newbie question.

Thank you in advance,
Oleg.


A

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [next] | [standalone]


#2105

From"David Mark" <david.mark@THRWHITE.remove-dii-this>
Date2011-04-27 15:37 +0000
Message-ID<1184987203.482237.41090@22g2000hsm.googlegroups.com>
In reply to#2104
  To: comp.lang.java.gui,comp.l
On Jul 20, 10:47 pm, "Oleg Konovalov" <okono...@verizon.net> wrote:
> Hi,
>
> I am relatively new to Struts [using 1.3].
>
Wrong group.

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [next] | [standalone]


#2107

From"Lew" <lew@THRWHITE.remove-dii-this>
Date2011-04-27 15:37 +0000
Message-ID<yO-dnb78AK1V5zzbnZ2dnUVZ_qPinZ2d@comcast.com>
In reply to#2105
  To: comp.lang.java.gui,comp.l
"Oleg Konovalov" wrote:
>> Hi,
>>
>> I am relatively new to Struts [using 1.3].

David Mark wrote:
> Wrong group.

Which group was wrong?  It was perfectly fine for the group from which I'm 
responding, comp.lang.java.help.

Since the OP sent to many groups, it would help them to know which ones were 
inappropriate.  Of course, they really should have stuck with one in the first 
place, or perhaps set follow-up to just one.  I suggest comp.lang.java.help.

-- 
Lew

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [next] | [standalone]


#2113

From"Richard Cornford" <richard.cornford@THRWHITE.remove-dii-this>
Date2011-04-27 15:37 +0000
Message-ID<f7vm76$pid$1$8300dec7@news.demon.co.uk>
In reply to#2107
  To: comp.lang.java.gui,comp.l
Lew wrote:
> David Mark wrote:
>> "Oleg Konovalov" wrote:
>>> I am relatively new to Struts [using 1.3].
>
>> Wrong group.
>
> Which group was wrong?  It was perfectly fine for the group
> from which I'm responding, comp.lang.java.help.
>
> Since the OP sent to many groups, it would help them to know
> which ones were inappropriate.
<snip>

The intended 'wrong group' was almost certainly comp.lang.javascript, 
but as David posted from Google groups it is likely that he was unaware 
of all the Java groups in the cross posting (as it takes positive action 
on the part of their users to see the list of groups in a message's 
Newsgroups header). On the other hand, as the question included "Is it 
in JavaScript or in Java?" I don't see how comp.lang.javascript could be 
the wrong group for asking the question, even if it becomes the wrong 
group for any discussion of the answer as soon as the answer 'Java' is 
given.

Richard.

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [next] | [standalone]


#2106

From"Lew" <lew@THRWHITE.remove-dii-this>
Date2011-04-27 15:37 +0000
Message-ID<yO-dnb_8AK2F5zzbnZ2dnUVZ_qOknZ2d@comcast.com>
In reply to#2104
  To: comp.lang.java.gui,comp.l
Oleg Konovalov wrote:
> I am relatively new to Struts [using 1.3].
> 
> I need to create a form using Struts tag libs with 2 HTML select's [lists],
> connected to 2 DB tables, say allUsers and Admins, which would allow
> to select Administrators from the list of AllUsers.
> 
> So I will have 3 buttons: Add, Remove and Update.
> Add - to add selected item(s) from AllUsers list to Admins list [if it is 
> not there already];
> Remove- to delete selected item(s) from Admins list;
> Update - to save changes to Admins list to the Admins DB table.
...
> So how do I manipulate these <html:options collection=AdminList...
> Struts tags in order to implement Add, Remove, Update  ?  
> In onClick="..." ? Is it in JavaScript or in Java ?
> Any other useful Struts tags for that [especially to do DB synchronization]?
> Code snippets ?

Forget Javascript for now.  I'm reading this in one of the many, many Java 
groups to which you posted your request - you should set follow-up to just one 
of them.  Struts is primarily a server-side application framework that 
coordinates the thin-client view artifacts (JSPs) with the application logic.

On the server side the Struts "ActionServlet" (the "controller") will forward 
the request parameters to an "Action" class, with parameters from the request 
captured in an "ActionForm" class.  It is the Action class that forwards the 
request information to business logic and maybe populates the ActionForm with 
the results, then reports the outcome to Struts.

The Struts framework invokes the execute() method of the Action class, which 
in turn returns an ActionForward return type object that the Struts framework 
uses to choose the next view (JSP).  The execute() method coordinates logic 
invoked via custom logic-class instances (typically JavaBeans) that you write 
to handle the application-specific behaviors.  The ActionForward return object 
encapsulates the success, failure or other termination state of the execute() 
invocation.

Values in the ActionForm, session scope or elsewhere may change as a result of 
the Action object's execute().

The next screen will dutifully show those values.

Struts implements the "Model-View-Controller" paradigm, and supplies the 
controller and the glue to join the three parts.  Wikipedia is a good source 
of knowledge for that.  So is Sun.  The JSPs represent the view, and should 
have no business logic coded in them at all.  The model layer, those 
server-side classes invoked by the Action classes, handles all logic.  Struts 
glues the navigation together with its controller.

For more, see:
<http://struts.apache.org/1.3.8/userGuide/index.html>

-- 
Lew

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [next] | [standalone]


#2117

From"Oleg Konovalov" <oleg.konovalov@THRWHITE.remove-dii-this>
Date2011-04-27 15:37 +0000
Message-ID<opUoi.621$Ub7.208@trnddc04>
In reply to#2106
  To: comp.lang.java.gui,comp.l
Thank you for the Struts intro,
but I don't see how that answers any of my questions...

Thanks,
Oleg.


"Lew" <lew@lewscanon.nospam> wrote in message 
news:yO-dnb_8AK2F5zzbnZ2dnUVZ_qOknZ2d@comcast.com...
> Oleg Konovalov wrote:
>> I am relatively new to Struts [using 1.3].
>>
>> I need to create a form using Struts tag libs with 2 HTML select's 
>> [lists],
>> connected to 2 DB tables, say allUsers and Admins, which would allow
>> to select Administrators from the list of AllUsers.
>>
>> So I will have 3 buttons: Add, Remove and Update.
>> Add - to add selected item(s) from AllUsers list to Admins list [if it is 
>> not there already];
>> Remove- to delete selected item(s) from Admins list;
>> Update - to save changes to Admins list to the Admins DB table.
> ...
>> So how do I manipulate these <html:options collection=AdminList...
>> Struts tags in order to implement Add, Remove, Update  ?  In 
>> onClick="..." ? Is it in JavaScript or in Java ?
>> Any other useful Struts tags for that [especially to do DB 
>> synchronization]?
>> Code snippets ?
>
> Forget Javascript for now.  I'm reading this in one of the many, many Java 
> groups to which you posted your request - you should set follow-up to just 
> one of them.  Struts is primarily a server-side application framework that 
> coordinates the thin-client view artifacts (JSPs) with the application 
> logic.
>
> On the server side the Struts "ActionServlet" (the "controller") will 
> forward the request parameters to an "Action" class, with parameters from 
> the request captured in an "ActionForm" class.  It is the Action class 
> that forwards the request information to business logic and maybe 
> populates the ActionForm with the results, then reports the outcome to 
> Struts.
>
> The Struts framework invokes the execute() method of the Action class, 
> which in turn returns an ActionForward return type object that the Struts 
> framework uses to choose the next view (JSP).  The execute() method 
> coordinates logic invoked via custom logic-class instances (typically 
> JavaBeans) that you write to handle the application-specific behaviors. 
> The ActionForward return object encapsulates the success, failure or other 
> termination state of the execute() invocation.
>
> Values in the ActionForm, session scope or elsewhere may change as a 
> result of the Action object's execute().
>
> The next screen will dutifully show those values.
>
> Struts implements the "Model-View-Controller" paradigm, and supplies the 
> controller and the glue to join the three parts.  Wikipedia is a good 
> source of knowledge for that.  So is Sun.  The JSPs represent the view, 
> and should have no business logic coded in them at all.  The model layer, 
> those server-side classes invoked by the Action classes, handles all 
> logic.  Struts glues the navigation together with its controller.
>
> For more, see:
> <http://struts.apache.org/1.3.8/userGuide/index.html>
>
> -- 
> Lew

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.java.gui


csiph-web