smray7 Posted April 12, 2014 Share Posted April 12, 2014 I need to automatically generate a ticket_id number, so I did just that in a jsp file. Then I want to display that randomly generate ticket number in the Ticket ID text field on my html page. Then I am going to get that ticket number from the text field and insert it into my database through the jsp again. Am I complicating things? Why doesn't the below code work? Should I just execute the random ticket number when the user clicks the submit button on the html form and show a box with the ticket number? Please help and thank you if you do. Any advice is very helpful. Random rand = new Random();int randomnumber = rand.nextInt(90000) + 10000;Ticket ID:<input type="text" name="ticketid" value="<%randomnumber%>"></input><br/> Link to comment Share on other sites More sharing options...
davej Posted April 12, 2014 Share Posted April 12, 2014 See... http://en.wikipedia.org/wiki/JavaServer_Pages 1 Link to comment Share on other sites More sharing options...
smray7 Posted April 13, 2014 Author Share Posted April 13, 2014 Okay, why should i read that? That didn't help me. I need hep generating a number. I already know about syntax and all that...Just because I post here doesn't mean I didn't research anything. I've been looking and trying things. Link to comment Share on other sites More sharing options...
davej Posted April 13, 2014 Share Posted April 13, 2014 Well, did you read it carefully? <%Random rand = new Random();int randomnumber = rand.nextInt(90000) + 10000;%>Ticket ID:<input type="text" name="ticketid" value="<%=randomnumber%>"/><br/> Link to comment Share on other sites More sharing options...
php freelancer Posted June 11, 2014 Share Posted June 11, 2014 Davej Thanks for this solution. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now