aspose file tools*
The moose likes JSP and the fly likes What am I doing wrong? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "What am I doing wrong?" Watch "What am I doing wrong?" New topic
Author

What am I doing wrong?

steve kelly
Greenhorn

Joined: Feb 15, 2012
Posts: 25
OK this one has me scratching my head. I have a string (rowString) and verified its truely a string value. I want to pass it into my mainView object which is an java view model. The mainView is valid too and used elsewhere just fine. Basically, I want to be able to store this rowString into my view model to be used later but I get the below error. What am I doing wrong?

org.apache.jasper.JasperException: Unable to compile class for JSP:
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60056
    
  65

rowString is a JavaScript variable. It doesn't even exist until after the page has been sent to the browser, and only exists on the client. So there's no way that the JSP engine on the server can know anything about it, right?

Please read this article to understand how JSP operates and why this is impossible.

You should also not be using obsolete Java scriptlets in JSPs. Please read this JspFaq entry.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
steve kelly
Greenhorn

Joined: Feb 15, 2012
Posts: 25
OK maybe I am approching this the hard way. What I am trying to do is this.

I have a spreadsheet jsp page with nested rows using a plus/minus icon. The user can click save at anytime on this page. Right now when saving I re-render all lines expanded back out. I wanted the ability to restore the nested positions after saving. Right now it is annoying. Is there an easier way to approach this?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60056
    
  65

Unspoken is what you are doing upon save. Are you submitting a form? or performing a redirect? Either causes the entire page to have to be re-displayed.

If so, yeah, restoring client state after such an operation is a pain. So the best way to deal with that is not to do it in the first place.

Why not consider doing your saves as Ajax requests that execute behind the scenes? That way, your client-side state is never disturbed, and doesn't need to be restored.
Balram Aggarwal
Greenhorn

Joined: Dec 07, 2012
Posts: 2
i spent my 4 valuable days to solve this exception any finally got the result that it is
all because of tomcat server. A JSP in the end becomes servlet this we all know
when there is error in compiling the JSP it means it is unable to make the servlet class
which is made in the end.
so the it was all fault with my tomcat server, i uninstall the server fully and reinstall the server
and the problem was solved
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60056
    
  65

Re-installing Tomcat is not the solution to this question. A JavaScript variable cannot be accessed by JSP code no matter how many times Tomcat might be re-installed.
steve kelly
Greenhorn

Joined: Feb 15, 2012
Posts: 25
Bear Bibeault wrote:Unspoken is what you are doing upon save. Are you submitting a form? or performing a redirect? Either causes the entire page to have to be re-displayed.

If so, yeah, restoring client state after such an operation is a pain. So the best way to deal with that is not to do it in the first place.

Why not consider doing your saves as Ajax requests that execute behind the scenes? That way, your client-side state is never disturbed, and doesn't need to be restored.

yeah doing submit. I need to implement ajax scripts. I ended up going the painfull route and simply logging values everytime a user clicked on a plus/minus button. When user clicked save I query and store these values. Then use the "afterOpened" type function to on jsp to display. Works decent but not fun.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: What am I doing wrong?
 
Similar Threads
can not compile JSP
Tomcat Error
Calling Java classes from JSP page
Class Import Can't be Resolved
How to access a simple method of a class from jsp?