Win a copy of Rust Web Development this week in the Other Languages forum!

Aaron Parker

Greenhorn
+ Follow
since Jan 31, 2004
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Aaron Parker

I've tried c:set commands that look like this, but I get this error:


org.apache.jasper.JasperException: /strutsNewRSSFeed.jsp(66,8) According to TLD or attribute directive in tag file, attribute var does not accept any expressions

Thanks.
16 years ago
JSP
I've been told that this part of my jsp is correct for passing a value to a servlet:



What I don't know is how to get that data out of the request. I've tried this, but it returns a null:



How do I get the value of id?

Thanks.
16 years ago
JSP
I know of one way using HTML forms. You can pass in user entered data and retrieve it from the request in the called servlet:


...

...

Then in the DoLogin servlet:



If you need to pass non user entered values, it's possible by passing it thru the action parameter of the form, but I'm here trying to find out how!

Hope this helps.

Aaron Parker
16 years ago
JSP
How do I get a value (or call the get method) from a javabean to display on my jsp page?

I've got my usebean statement, but if I have a getEmail method in my bean, how do I get the value of the email to the jsp page?

I've tried




There is a getEmail() and an variable email in the bean.

Thanks.
[ March 24, 2005: Message edited by: Aaron Parker ]
16 years ago
JSP
How do I get results out of the uniqueResult() method of the Query class. I can get a result into it, but I can't find anything that explain how to get stuff out!

Object results;
results = query.uniqueResult();

PS to moderator, I posted this in Servlets, too as that's what I'm working with, but was unsure where to post.

Thanks.
How do I get results out of the uniqueResult() method of the Query class. I can get a result into it, but I can't find anything that explain how to get stuff out!

Object results;
results = query.uniqueResult();
16 years ago
I have code which returns a database query as a list. I need to be able to select individual elements of this list and place them in an html table.

for (ListIterator i = empList.listIterator(); i.hasNext(); ) {
//out.println("<tr><td>"+i.next().get(0)+"</td></tr>");
//above doesn't work, below works but only returns all 8 elements of list
out.println("<tr><td>"+i.next()+"</td></tr>");
}

In the above code, I'd like to expand it to have 8 td elements. The list has 8 elements. I tried using the Get method, but the API is as cryptic as ever as far as the syntax goes.

Contents of i.next():101, Joe, A, Coyne, 111-22-3333, HR, 125, 3726



Aaron Parker

[ November 22, 2004: Message edited by: Aaron Parker ]
[ November 22, 2004: Message edited by: Aaron Parker ]
17 years ago
If you were to try to compile code which can cause an exception without "throws Exception", It won't compile. For certain things you must either have "throws Exception" or have the offending code in a try-catch block. (The compiler will tell you if it needs it when you try to compile). If you're in an intro class and haven't dealt with exception handling yet, it may be enough to know that the throws must be present for compilation.

I/O is one such thing that requires exception handling. Looking at the code you posted, I don't believe there is anything that would require the throws. I suspect that coding them is a habit your instructor wants you to get into.
17 years ago
My PrintWriter will write (some) data to disk if the file written is very large but none if it is small. The StringBuffer writes to screen ok with a small file, but won't write all of a large file, unless PrintWriter is commented out. (Small test file 355b, large 839k).



Help?

Thanks
17 years ago
Thank you so much! I can't believe how simple some of these problems seem after you have the answer!
17 years ago
I get this message on compile:

TokenCount.java:68: cannot resolve symbol
symbol : method getProperty (java.lang.String)
location: class java146.util.PropertiesManager
= new PrintWriter(new BufferedWriter(new FileWriter(props.getProperty("tokencountfile"))));
^
1 error
(carat under dot between props & getProperty)

I passed PropertiesManager() into TokenCount which is an instance of Properties().

The TokenCount file is as follows:



The PropertiesManager is:



I don't understand why it can't resolve this.
17 years ago
Can anyone explain to me why when I run this code, I get 4 cols and 2 rows instead of 2 cols and 2 rows?




(Code tags added by Michael Morris)
[ April 23, 2004: Message edited by: Michael Morris ]
17 years ago
How do I find out how long an array is (number of elements). How do I do that in Java?
My first incorrect guess was (as a oondition in my for loop):
for (x = 0; x < length(fictionTitles[]); ++x) {
17 years ago
(Before I had Date dateAndTime = new Date(); just above JLabel dateTime)
17 years ago
I can't get this to compile. How do I get a date into the label?
17 years ago