Win a copy of Spring Boot in Practice this week in the Spring forum!

Nick Sher

Ranch Hand
+ Follow
since Nov 10, 2008
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
1
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Nick Sher

Recently I renamed the webapp and for compatibility reason I need to redirect requests from old webapp name to new webapp name. How do I do this? For example, if old webapp name is 'abc', how do I redirect all the requests coming to 'abc' to the new name 'xyz'. Please help.
11 years ago
Thanks Paul, that's what I was doing with the subclass SAXParseException and thought there might be a better practice. Thanks again.
11 years ago
Hi,

What I am trying to do is throw a custom exception that I have created from a api method that I am implementing. For example, 'startElement' method throws SAXException, but I want to throw my own exception, how do I do this?

Please help.
11 years ago
Resolved.

The fix is to use:
11 years ago
Hi,

I am trying to download a file using Struts 2 but the downloaded XML file is corrupt. It works if the xml file has around 60 lines else the content is ignored. I am not an IO expert but kindly correctly me if I need to fix anything here. Can someone please help me? Here is what I am trying to do.

The Action class
:


The service class:


The struts.xml settings:
11 years ago
Hello! any recommendations?
11 years ago
I am using struts 2.1.6 with dojo and jquery ui dialog. Everything works fine in Firefox and IE. However, in Chrome I see a rubbish textarea being generated whenever a jQuery UI dialog is created.
Does anyone have any idea why this happens? How do I fix this?

I have attached a screenshot for review.
11 years ago

Vic Hood wrote:Hi All,
I have a situation where I have to call an action class , when there is a change in the values of a dropdown box that im implementing using struts 2 tags , im trying to use javascript for this and need to pass a variable to the function being called > Could anyone please help me with an example .Thanks.



Try this,
In your javascript method you will have
11 years ago
Hi,

I am using Struts 2.1.6 and Tiles 2.0.x with Ajax. I have an action configuration which returns a tiles result. Now I want to use this action with AJAX. I am using the bind tag to generate a listener and update a div.

When the action executes it returns a tiles result and updates the div with the new content. However, all the action properties (any lists, objects and variables are lost, they are not displayed). When there is an error, only the error key is displayed and its description is not picked up from the resource bundle. This used to work without AJAX.

How can I fix this? When I looked at the data returned using 'afterNotifyTopics', it displays complete response HTML from server but I don't need all this. I just need some action properties back so that I can update the error message and data on the page.

Please help.
11 years ago
Hi,

I am working on a struts 2 web application where a user can customize the UI (show/hide columns or buttons etc) and the preferences need to be restored whenever the page is viewed. There are only few screens and each screen can be customized.

Please share if there is any well-known approach to implementing this.
11 years ago

Jaydeep Wagh wrote: Hello all, I am preparing for the Sun Certification of Java and I have a question about the String class in Java.




my question is that in the above code how many objects are created after the line #3 executes...?

Please do provide your explanation as well. Thanks in advance.



Creates 4 strings:
1. "abc"
2. "def"
3. " "
4. "abc def"

Chris Montgomery wrote:I've struggled with these as well. unchecked boxes basically don't exist.
To be honest, I avoid the struts implementation of checkboxes if I need to get 'fancy'.

An alternative is to create your own checkboxes ( this can be done dynamically ) and assign meaningful id's to each of the checkboxs. From there, you can leverage jQuery's select event along with AJAX to deal with the user selection realtime. No form submit necessary...

This exact solution may not be relevant, but hopefully provides you some alternative perspectives on solving your issue.



Thanks for the reply Chris. It's sad that this simple problem has not been addressed properly yet. This is how I did it:
1. Have hidden fields in the form
2. Action class will receive values of these hidden fields and update a set to correctly reflect which checkboxes have been updated. For example, if hidden fields 1, 2, and 3 are submitted, then all these entries will be removed from the set. The set is again updated with values of checked checkboxes.

This works correctly with pagination.

I am unhappy with this solution as it is adding the overhead of iterating through all the values again and again. I have to be happy with it because it solves my problem.

If anyone has a better solution please share it here.
11 years ago
The landing page of my web application supports pagination and I want the user to be able to select multiple items using checkboxes to perform few operations. The checkboxes are backed by String array, I tried this using sessions.

There is one use case that I am struggling with, and that is:
1. Suppose, the user initially selects two items to delete then I add these to a session attribute,
2. If one of these two items is unchecked and the user submits form, I need to update the session variable but I have no idea about the unchecked values because I don't see the unchecked items in the action class.

How do I overcome this issue?

Here is my code:

JSP:


Action class: The following property has it's getters/setters.


Please advise.
11 years ago
Hi,

I have created an xml in which are some special characters. In the browser the characters are displayed as black rhombus with ? inside it. Now I want to parse this xml and display on JSP, the characters are now displayed as ½½½ .

I don't have any clue why this happens. How do I resolve this?

Please help.
Nik.