Well, using proper syntax is always a good first step. You say you can't
seem to get it to work, but don't contribute any information about EXACTLY
what you've tried... and what you're trying to do is mimic a javabean at any
rate, and there are better paths to attempt to go down than the one you've
chosen.

Here's a small test:

public class MyBean
{
  String foo;
  public MyBean() { foo=""; }
  public void setFoo(String foo) { this.foo=foo; }
  public String getFoo() { return foo; }
}

Drop this in the closest available WEB-INF/classes directory.

Then use this JSP:

<jsp:useBean id="mybean" class="MyBean" />
<jsp:setProperty name="mybean" property="foo" value="hello" />
<jsp:getProperty name="mybean" property="foo" />

Voila! You should see "hello" as output.

>From: Arcady <[EMAIL PROTECTED]>
>Reply-To: A mailing list about Java Server Pages specification and
>     reference <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>Subject: Passing a string from a JSP to a Java class and back.
>Date: Fri, 4 May 2001 12:30:57 -0700
>
>This is an ultra simple one I would guess.
>
>But for some reason I cannot get it to go...
>
>
>I want to take a string of data and send it from the jsp
>webpage over to a class.
>Then have that class send it back to the webpage which puts
>it on the screen.
>
>In essense step one of a larger process.
>
>My JSP would be something like this:
>
><% String hello="Hello World" %>
><% test.setFoo(hello); %>
><%=test.getFoo() %>
>
>
>My java class would be:
>
>test.java :
>
>import java.util.*;
>
>public class test {
>
>         static public String foo;
>         private test() {}
>         static public void setFoo(String t) {
>                 foo = t;
>         }
>         static public String getGoo() {
>                 return foo;
>         }
>}
>
>
>I assume I'm missing something very obvious here...
>Oddly enough none of my books on JSP cover this topic.
>They all cover more advanced things like putting and pulling
>from SQL databases or whatever...
>But nothing on this simple level of work.
>
>So...
>What exactly do I need to do to get that String to go in and
>come back out again? :)
>
>
>__________________________________________________
>Do You Yahoo!?
>Yahoo! Auctions - buy the things you want at great prices
>http://auctions.yahoo.com/
>
>===========================================================================
>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

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com

===========================================================================
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

Reply via email to