Guest User

Untitled

a guest
Sep 20th, 2018
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.19 KB | None | 0 0
  1. thufir@dur:~/ruby/file$
  2. thufir@dur:~/ruby/file$ telnet localhost nntp
  3. Trying 127.0.0.1...
  4. Connected to localhost.
  5. Escape character is '^]'.
  6. 200 Leafnode NNTP Daemon, version 1.11.8 running at localhost (my fqdn: dur.bounceme.net)
  7. GROUP comp.lang.java.help
  8. 211 38 3 40 comp.lang.java.help group selected
  9. BODY
  10. 222 3 <afp6m75oi6nli4b6q87s317lkc13g689c2@4ax.com> article retrieved - body follows
  11. On Tue, 28 Feb 2012 13:53:02 -0800 (PST), navanshu
  12. <mahor1989@gmail.com> wrote:
  13.  
  14. >Uptill now i've read headfirstjava but i want to get my hands dirty by
  15. >making some simple java projects to get a feel how's done practically,
  16. >So plz suggest me guys some reference book
  17.  
  18. Another approach might be looking at Java source code in the Java
  19. library classes and on SourceForge.net, github, etc.
  20. --
  21. Regards,
  22. Casey
  23. .
  24. BODY
  25. 222 3 <afp6m75oi6nli4b6q87s317lkc13g689c2@4ax.com> article retrieved - body follows
  26. On Tue, 28 Feb 2012 13:53:02 -0800 (PST), navanshu
  27. <mahor1989@gmail.com> wrote:
  28.  
  29. >Uptill now i've read headfirstjava but i want to get my hands dirty by
  30. >making some simple java projects to get a feel how's done practically,
  31. >So plz suggest me guys some reference book
  32.  
  33. Another approach might be looking at Java source code in the Java
  34. library classes and on SourceForge.net, github, etc.
  35. --
  36. Regards,
  37. Casey
  38. .
  39. NEXT
  40. 223 4 <ed7f31e9-8a19-46c7-9a7c-ad8aabfb9599@x10g2000pbi.googlegroups.com> article retrieved
  41. BODY
  42. 222 4 <ed7f31e9-8a19-46c7-9a7c-ad8aabfb9599@x10g2000pbi.googlegroups.com> article retrieved - body follows
  43. I have been thinking about the way I have been validating form inputs
  44. in the servelet and wonder if I would be much better off using class
  45. methods to verify these inputs?
  46.  
  47. Consider that I am almost always gathering the inputs to instantiate
  48. one or more objects, but I gather and validate -- and then
  49. instantiate. Maybe I should instantiate an empty object and then use
  50. class methods to validate the inputs?
  51.  
  52. Thanks
  53. .
  54. BODY
  55. 222 4 <ed7f31e9-8a19-46c7-9a7c-ad8aabfb9599@x10g2000pbi.googlegroups.com> article retrieved - body follows
  56. I have been thinking about the way I have been validating form inputs
  57. in the servelet and wonder if I would be much better off using class
  58. methods to verify these inputs?
  59.  
  60. Consider that I am almost always gathering the inputs to instantiate
  61. one or more objects, but I gather and validate -- and then
  62. instantiate. Maybe I should instantiate an empty object and then use
  63. class methods to validate the inputs?
  64.  
  65. Thanks
  66. .
  67. NEXT
  68. 223 5 <uA4ar.13560$fj7.13111@newsfe20.iad> article retrieved
  69. NEXT
  70. 223 6 <9942279.960.1332273017948.JavaMail.geo-discussion-forums@pbbpx7> article retrieved
  71. BODY
  72. 222 6 <9942279.960.1332273017948.JavaMail.geo-discussion-forums@pbbpx7> article retrieved - body follows
  73. Daniel Pitts wrote:
  74. > Davej wrote:
  75. >> I have been thinking about the way I have been validating form inputs
  76. >> in the servelet [sic] and wonder if I would be much better off using class
  77. >> methods to verify these inputs?
  78.  
  79. What exactly do you mean by "class methods"? Do you mean 'static' member methods?
  80.  
  81. >> Consider that I am almost always gathering the inputs to instantiate
  82. >> one or more objects, but I gather and validate -- and then
  83. >> instantiate. Maybe I should instantiate an empty object and then use
  84. >> class methods to validate the inputs?
  85.  
  86. Maybe. It depends on what you mean by "class methods".
  87.  
  88. > There are a few frameworks that do this in several phases actually. Its
  89. > called binding and validating.
  90. >
  91. > In the binding phase, values are parsed into appropriate data types, and
  92. > stored in the model (Form object as it is sometimes called). If the
  93. > data can not be parsed, or the model rejects the value immediately, it
  94. > is a binding error.
  95. >
  96. > In the validation phase, the values are checked for correctness. This is
  97. > often a secondary phase because some values are interdependent.
  98. >
  99. > If, after validation, you want to have an immutable object, then you
  100. > could treat your Form object more as a Builder object, and have it
  101. > construct the Real object, which is fully populated and validated.
  102. > Alternatively, you could use the Form object as a "Parameter" object for
  103. > a different Builder class, to keep the concerns of the Form object more
  104. > pure.
  105. >
  106. > I suggest looking into different frameworks, rather than trying to
  107. > roll-your-own. There are a lot of gotchas that can be avoided, and
  108. > boilerplate code you can rid yourself of. I've had moderate luck with
  109. > Spring Binding. If you have typical use-cases it works well. If you
  110. > have more complicated forms, for instance complex dynamic items, then
  111. > there is some shoehorning needed to make it work correctly.
  112.  
  113. Rolling your own isn't actually that hard, but you won't get the breadth, depth or solidity of a framework with thousands of manhours invested in it already. Then again, you might not need all that.
  114.  
  115. There are plenty of better frameworks out there than Spring. There's JSF, regular old JSP with EL and JSTL, and Struts, to name three.
  116.  
  117. Your use of the term "class methods", OP, suggests that you need to study Java some more, and likely also servlets and presentation technologies some more. Look up the "Model 2" web-application paradigm. Then go with JSP/EL or JSF/Facelets.
  118.  
  119. --
  120. Lew
  121. .
  122. QUIT
  123. 205 Always happy to serve!
  124. Connection closed by foreign host.
  125. thufir@dur:~/ruby/file$
Add Comment
Please, Sign In to add comment