Problems with for loop (!)

2001-05-16 Thread James Childers

Sometimes the simplest things cause the most problems...

The following code is giving me problems:

for (int t = Integer.valueOf("minModStr"); t <= 25; t++) {
out.println("" + t + "");
}

The error it returns is:

Error: The type of the left-hand side in this assignment, "int", is not
compatible with the type of the right-hand side expression,
"java/lang/Integer".

I have tried to declare t as Integer, but doing that gives

Error: The type of this expression, "Integer", is not numeric.

Hay-ulp.

- James

===
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets



Re: URGENT How TO Handle (MULTIPLE FORMS)

2001-05-29 Thread James Childers

jyothirmai porika wrote:

> I have a jsp page with 3 forms.
> What i want to do is when the 2nd form is submitted, fist and third should
> not be submitted and vice versa.
> I tried to submit by calling each submit based on condition,
> But it's not working.
> How can i handle multiple forms.

Stylistically, you probably want to avoid having multiple forms on a
single page. However, if this is a requirement for some reason then you
just need to set your ACTION attribute of the FORM tag to be different
pages for each tag.

Ex:


[... form elements ...]


[... form elements ...]


[... form elements ...]


Hope this helps.

- J

===
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets



Re: forward / sendRedirect

2001-08-27 Thread James Childers

> Delivered-To: [EMAIL PROTECTED]
> Date: Mon, 27 Aug 2001 16:03:34 +0700
> From: Dinesh Somasundram <[EMAIL PROTECTED]>
> Subject: forward / sendRedirect
> To: [EMAIL PROTECTED]
>
> Hi All,
>
> I have a page. In the middle of the page, if a certain condition is true, I
> want to go to a different page. If I use response.sendRedirect(), I keep
> getting "Response has already been committed". If I use jsp:forward I keep
> getting "Cannot forward as OutputStream or Writer has already been obtained"
>
> Any ideas or I just cannot forward to another page from within the
> middle of my JSP. Please kindly advice.

Since the HTTP redirect header is, well, a header, once the headers have been
written (i.e. after the HTML has already been sent) you can no longer use
redirection. Similarly, the jsp:forward mechanism is designed to transfer the
processing of a JSP page to another before *any* data (including headers) are
sent to the client.

The only way to do "redirect" a user after the data has been written would be to
use client-side scripting such as JavaScript.

===
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets



Re: Result Set and Servlet

2001-08-29 Thread James Childers

> I´m a newbie and struggle with the following problem:
> I want the RestultSet to write out every database record, 
> between two horizontal lines, but it doest not work. I have a 
> method, that converts everything to HTML, and I want a for 
> loop, to perform this method on every Record in the table. I 
> tried with rs.getArray() and with array.length I tried to 
> invoke the methode on every record.
 
Othmar,

I sounds like you're just wanting to print all the results in the
resultset. Try this:

rs.beforeFirst();
while(rs.next()) {
out.println("The value is " + rs.getString("column1")
+ ".");
}

The rs.beforeFirst() is optional if this is your first traversal through
the resultset. 

- James

==To 
unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets



Re: Creating a JSP Function

2001-08-29 Thread James Childers

> How do I create a simply function into a JSP scriptlet? I'm
> developing an application than cannot call a Servlet.

Very easy. You need to put the function definition in the bottom of the
code. It'll look like this:

<%! public String printVomitVolume (boolean isDisgusting) {
[function statements go here]
}
%>

"public" makes it accessible to the entire page, String is the return
value in this case.

Hope this helps.

- James

===
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets



Re: recompiling JSP pages

2001-09-06 Thread James Childers

Troy,

Try a simple "touch *" in the JSP folder. Nice n 'easy.

- James

> Does anyone know how to recompile a folder full of JSPs
> without opening and making a change to each one (this is a
> SOLARIS UNIX MACHINE)??

===
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets



Breadcrumbing Design Pattern

2001-09-18 Thread James Childers

Friends,

My group is in the process of designing a site that uses breadcrumbs
throughout. So, for example, towards the top of the page a user will see
something like the following:

Home --> Product Information --> Widget 5000i --> Architecture

Each section will obviously be a link to the indicated place.

The question I have is if there is a known design pattern that handles
such a beast. The best answer I have come up with so far is creating a
table in the database that stores this information, but this seems
inadequate from a maintenance standpoint: every time a page is added to
the site a corresponding entry will need to be made in the DB.

Suggestions?

- James Childers

===
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets



Re: Help on JSP formatting.

2001-09-26 Thread James Childers

>
> Job Details Table:
> 1. Job Order no.
> 2. Description.
>
> Description is used to record the job requirement, and all the details.
> Should I save the html tag to the table together with the data ?
> As I want to display the data with a formatting such as separate paragraph,
> bold and etc.
>
> Is there any good way that only save the data without the html tag but the
> output with formatting ??

Dick,

I would suggest looking into creating a more robust table (or tables) instead of 
storing
multiple values in a single table. In your case, you might be able to add fields that
indicate whether it is a contract or permanent position, salary, whether travel is
required and if so how much, and so forth.

But no matter what the underlying data is you want to separate it into as many fields
as necessary. Storing different kinds of data in a single field defeats the purpose
of storing data in a database in the first place. This will also help with 
presentation,
because you can display values however you like without having to store markup in the
database.

Get on Google and do a search for "normalizing" or "normalization." That's really what
we're talking about here.

Good luck!

- James Childers

===
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets



(Query)String to java.sql.Date

2001-10-19 Thread James Childers

I spent most of yesterday afternoon getting a string pulled in via a
request.getParameter properly typed so that it could be updated or
inserted into our Sybase backend. I searched the archives and wasn't
able to find anything that specifically talked about how to do this,
so I wanted to share.


// Initialize to Jan 1, 1901
java.sql.Date sqlDate = new java.sql.Date(1, 0, 1);

String tmpDateStr = request.getParameter("releaseDate");

try {
// executeUpdate fails on date fields unless they are in
// -MM-dd format (at least on our setup. YMMV.)
SimpleDateFormat sdfTemplate = new SimpleDateFormat("-MM-dd");

// Going from string to java.util.Date because that is what
// format() expects
java.util.Date nptDate = new java.util.Date(tmpDateStr);

// Format returns a string, which is what we want for our next
// statment.
tmpDateStr = sdfTemplate.format(nptDate);

// Finally put it into the form needed by our
// preparedStatement.setDate()
sqlDate = java.sql.Date.valueOf(tmpDateStr);
}
catch (Exception ex) {
// Exception parsing code
}
finally {
// Whatever
}

So the pattern is String --> java.util.Date --> String -->
java.sql.Date. Hope this helps someone.


--

===
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com



Re: Beginners tutorial

2001-10-29 Thread James Childers

* On Tue, Oct 30, 2001 at 09:02:40AM +1100, the featherless biped known as Theo Starr 
<[EMAIL PROTECTED]> wrote:
> I am not a JSP guru but I do agree with you.
>
> I have studied JAVA and Object Oriented Programming for 18 months and have just 
>begun to look at JSP.  In my opinion if I didn't have this background I would be 
>struggling to have any understanding of what is going on.
>
> Once you gain an ounce of understranding of JAVA and JSP beyond the programming 
>language aspect, it bites you and your addicted.  The technology grows on you and 
>then you in turn grow with it.
>
> And once you understand JAVA and JSP, your ASP skills do gain another dimension and 
>you gain what you missed the first time on your first pass - My Experience.

I totally agree. Despite presence of sun.com in my email address I am
not (yet!) a Java guru, and have come from an ASP background. The
project I am working on forced me to switch to JSP, but I have only
recently begun to delve into the truly OO aspects of Java/JSP,
specifically the richness of custom tags.

The easiest and quickest route is to learn JSP first, only later moving
to beans, custom tags, and servlets. If you want to save yourself time
in the long run, however, you will study these more advanced topics
first.

- James

===
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com



Counting body tag elements in custom tag

2001-11-16 Thread James Childers

All,

I am implementing a custom tag to display a breadcrumb. The tag will look like
this:


Home
BleCH
Blarg


The results from the tag will look something like this:

Home > BleCH > Blarg

However, in order to determine whether or not to display the >'s, I need to get
a count of the  elements. How can this be done? Seems simple, but I can't
seem to find the answer.

- James

===
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com



Re: Using JSP and Flash Together, How is it done?

2001-11-21 Thread James Childers

What are you wanting to do with them? Flash is really not related to JSP
(or any server side scripting language). You don't need JSP to display
Flash, just an HTML  tag.

> -Original Message-
> From: A mailing list about Java Server Pages specification
> and reference [mailto:[EMAIL PROTECTED]] On Behalf Of
> Antony Stace
> Sent: Tuesday, November 20, 2001 7:11 PM
> To: [EMAIL PROTECTED]
> Subject: Using JSP and Flash Together, How is it done?
>
>
> Hello Ladies and Gentlemen
>
> Can someone give me some pointers on how to integrate Flash
> and JSP pages or give me a reference to a website or books
> which explain how to use them together.
>

===
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com



Re: Charset problem.

2001-11-21 Thread James Childers

MySQL supports mutli-byte characters (Unicode), but it has to be
recompiled to support this. Are you sure that MySQL is storing the data
correctly?

> -Original Message-
> From: A mailing list about Java Server Pages specification
> and reference [mailto:[EMAIL PROTECTED]] On Behalf Of
> Dick Wong
> Sent: Tuesday, November 20, 2001 9:47 PM
> To: [EMAIL PROTECTED]
> Subject: Charset problem.
>
>
> Dear all,
>
> When my jsp retrieve data from mysql. All the chinese
> characters cannot be displayed and become special symbol.
> However, if I type a chinese characted in jsp file. It can
> display. So I think this is the mm driver problem or jdbc.
>
> Is there any suggestion or hints ??
>

===
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com