Hey Luke, This is really good... I will look into the codes u gave me...
For now... I need to just build a front page ... That takes - a mobile number - a password and verify it then login... Once logged in... I want to just make the user publish so post or bulletin board... For now... The default project which I downloaded in appfuse 2 had a username and password... Where in the source do i look to change these settings... I hope im making sense... Thanks mate... Luke McLean wrote: > > OK, found a copy of the source code here at home on an old backup disk. > > You first have to follow the instructions on the site > http://smslib.sourceforge.net/ regarding setting up the comms package on > the computer that is going to connect with the GPRS modem. After you have > done that the old code that I have gopes like this (note that references > to org.jsmsengine should now be changed to the new package reference...) > > 1) add a variable to the system somewhere that you can access that tells > the application your hardware port that the GPRS modem is located on. For > this old code I used a context-param in the web.xml but I'd probably now > add it to the applicationContext.xml from a property in the pom at build > time. > ... > <context-param> > <param-name>comport</param-name> > <param-value>COM5</param-value> > </context-param> > ... > > 2) Now in the Controller for the page I have the following code: > > protected ModelAndView handleRequestInternal(final HttpServletRequest > request, final HttpServletResponse response) > throws Exception { > //this gets the sms device phone number to send the message to... > final String smsOTPNo = request.getParameter("smsotpnumber"); > //this is the code number to send to the device in the message for > validation > final String tempNumber = request.getParameter("code"); > //retrieve the comport for the GPRS modem > String > comport=request.getSession().getServletContext().getInitParameter("comport"); > int status; > final Map model = new HashMap(); > CService srv = new CService(comport, 115200); > try > { > // Initialize service. > srv.initialize(); > // Set the cache directory. > srv.setCacheDir(".\\"); > > // Set the phonebook. > // srv.setPhoneBook("../misc/phonebook.xml"); > // Connect to GSM device. > status = srv.connect(); > // Did we connect ok? > if (status == CService.ERR_OK) > { > // Set the operation mode to PDU - default > is ASCII. > srv.setOperationMode(CService.MODE_PDU); > > // Set the SMSC number (set to default). > srv.setSmscNumber(""); > > COutgoingMessage msg = new > COutgoingMessage(smsOTPNo, "Your OTP is > "+tempNumber); > > // Character set is 7bit by default - lets > make it UNICODE :) > // We can do this, because we are in PDU > mode (look at line 63). When > in ASCII mode, > // this does not make ANY > difference... > > msg.setMessageEncoding(CMessage.MESSAGE_ENCODING_UNICODE); > > if (srv.sendMessage(msg) == CService.ERR_OK){ > System.out.println("Message Sent!"); > model.put("code","ok"); > } > else{ > System.out.println("Message Failed!"); > model.put("code","failed"); > } > > // Disconnect from GSM device. > srv.disconnect(); > } > else{ > System.out.println("Connection to mobile > failed, error: " + status); > model.put("code","failed"); > } > } > catch (Exception e) > { > e.printStackTrace(); > model.put("code","failed"); > } > > > return new ModelAndView(this.successView, model); > } > > The successView then asks the user to enter the OTP code when it arrives. > I store the code in the session as you see above, compare the two and > logic flows from success or failure in a spring webflow... of course you > will need the appropriate import statements at the top of your Controller > class. I note that I have: > > import org.jsmsengine.CMessage; > import org.jsmsengine.COutgoingMessage; > import org.jsmsengine.CService; > > I am not sure what the current version of the library uses as this has > been working successfully so have not yet updated it. There are probably > examples available on that link I gave below. The hardest part appears to > be getting a modem that talks turkey with the software. A list of modems > is on the smslib site. I have not yet tried a 3G device, just a plain old > GPRS modem. I have not performed any performance testing either to see > whether I need to write to a queue and then send from that queue. There > is example code in the smslib download including code to handle queues 0 > refer to the SMSLIBServer code that can use a database or XML files, you > could use quartz instead for batch sending/receiving (if you wanted > receiving as well). > > Hope this helps you in your quest, > Luke. > > > > Luke McLean wrote: >> >> Hello preman, >> >> I do a very similar thing. I found it not that easy to implement via SMS >> (GPRS) but got there in the end. I use the jSMSEngine which has now >> found here http://smslib.sourceforge.net/. It only works with certain >> GPRS modems. I use a GPRS modem attached to the server to send the sms >> message. To send validation via email is much easier. I can supply you >> some code to have a look through but it is at work. I can post code >> Monday (New Zealand time) if you are still interested. Are you using >> 1.9.4 or 2.0 appfuse? >> >> Luke. >> >> > > -- View this message in context: http://www.nabble.com/How-to-customize-login-page-tf3776111s2369.html#a10797761 Sent from the AppFuse - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
